Loading res/values/strings.xml +3 −2 Original line number Diff line number Diff line Loading @@ -456,8 +456,9 @@ <!-- String describing the icon used to start a voice search --> <string name="description_start_voice_search">Start voice search</string> <!-- The string used to represent an unknown location for a phone number in the call log [CHAR LIMIT=3] --> <string name="call_log_empty_gecode">\u0020</string> <!-- The string used to represent an unknown location for a phone number in the call log Do not translate. --> <string name="call_log_empty_geocode"></string> <!-- Menu item used to call a contact, containing the number of the contact to call --> <string name="menu_callNumber">Call <xliff:g id="number">%s</xliff:g></string> Loading src/com/android/dialer/PhoneCallDetailsHelper.java +2 −3 Original line number Diff line number Diff line Loading @@ -62,8 +62,8 @@ public class PhoneCallDetailsHelper { PhoneNumberUtilsWrapper phoneUtils) { mResources = resources; mCallTypeHelper = callTypeHelper; mPhoneNumberHelper = new PhoneNumberDisplayHelper(resources); mPhoneNumberUtilsWrapper = phoneUtils; mPhoneNumberHelper = new PhoneNumberDisplayHelper(mPhoneNumberUtilsWrapper, resources); } /** Fills the call details views with content. */ Loading Loading @@ -121,7 +121,7 @@ public class PhoneCallDetailsHelper { nameText = displayNumber; if (TextUtils.isEmpty(details.geocode) || mPhoneNumberUtilsWrapper.isVoicemailNumber(details.number)) { numberText = mResources.getString(R.string.call_log_empty_gecode); numberText = mResources.getString(R.string.call_log_empty_geocode); } else { numberText = details.geocode; } Loading @@ -136,7 +136,6 @@ public class PhoneCallDetailsHelper { } views.nameView.setText(nameText); views.labelView.setText(labelText); views.labelView.setVisibility(TextUtils.isEmpty(labelText) ? View.GONE : View.VISIBLE); } Loading src/com/android/dialer/calllog/PhoneNumberDisplayHelper.java +9 −3 Original line number Diff line number Diff line Loading @@ -18,8 +18,8 @@ package com.android.dialer.calllog; import android.content.res.Resources; import android.provider.CallLog.Calls; import android.telephony.PhoneNumberUtils; import android.text.TextUtils; import android.util.Log; import com.android.dialer.R; Loading @@ -27,10 +27,17 @@ import com.android.dialer.R; * Helper for formatting and managing the display of phone numbers. */ public class PhoneNumberDisplayHelper { private final PhoneNumberUtilsWrapper mPhoneNumberUtils; private final Resources mResources; public PhoneNumberDisplayHelper(Resources resources) { mResources = resources; mPhoneNumberUtils = new PhoneNumberUtilsWrapper(); } public PhoneNumberDisplayHelper(PhoneNumberUtilsWrapper phoneNumberUtils, Resources resources) { mPhoneNumberUtils = phoneNumberUtils; mResources = resources; } /* package */ CharSequence getDisplayName(CharSequence number, int presentation) { Loading @@ -43,7 +50,7 @@ public class PhoneNumberDisplayHelper { if (presentation == Calls.PRESENTATION_PAYPHONE) { return mResources.getString(R.string.payphone); } if (new PhoneNumberUtilsWrapper().isVoicemailNumber(number)) { if (mPhoneNumberUtils.isVoicemailNumber(number)) { return mResources.getString(R.string.voicemail); } if (PhoneNumberUtilsWrapper.isLegacyUnknownNumbers(number)) { Loading @@ -62,7 +69,6 @@ public class PhoneNumberDisplayHelper { int presentation, CharSequence formattedNumber) { final CharSequence displayName = getDisplayName(number, presentation); if (!TextUtils.isEmpty(displayName)) { return displayName; } Loading src/com/android/dialer/dialpad/DialpadFragment.java +5 −5 Original line number Diff line number Diff line Loading @@ -1561,8 +1561,8 @@ public class DialpadFragment extends Fragment */ private void updateDialString(char newDigit) { if (newDigit != WAIT && newDigit != PAUSE) { Log.wtf(TAG, "Not expected for anything other than PAUSE & WAIT"); return; throw new IllegalArgumentException( "Not expected for anything other than PAUSE & WAIT"); } int selectionStart; Loading Loading @@ -1642,8 +1642,8 @@ public class DialpadFragment extends Fragment /* package */ static boolean canAddDigit(CharSequence digits, int start, int end, char newDigit) { if(newDigit != WAIT && newDigit != PAUSE) { Log.wtf(TAG, "Should not be called for anything other than PAUSE & WAIT"); return false; throw new IllegalArgumentException( "Should not be called for anything other than PAUSE & WAIT"); } // False if no selection, or selection is reversed (end < start) Loading tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java +5 −3 Original line number Diff line number Diff line Loading @@ -51,6 +51,8 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { private static final String TEST_COUNTRY_ISO = "US"; /** The geocoded location used in the tests. */ private static final String TEST_GEOCODE = "United States"; /** Empty geocode label */ private static final String EMPTY_GEOCODE = ""; /** The object under test. */ private PhoneCallDetailsHelper mHelper; Loading Loading @@ -183,18 +185,18 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { public void testSetPhoneCallDetails_NoGeocode() { setPhoneCallDetailsWithNumberAndGeocode("+14125555555", "1-412-555-5555", null); assertNameEquals("1-412-555-5555"); // The phone number is shown as the name. assertLabelEquals("-"); // The empty geocode is shown as the label. assertLabelEquals(EMPTY_GEOCODE); // The empty geocode is shown as the label. } public void testSetPhoneCallDetails_EmptyGeocode() { setPhoneCallDetailsWithNumberAndGeocode("+14125555555", "1-412-555-5555", ""); assertNameEquals("1-412-555-5555"); // The phone number is shown as the name. assertLabelEquals("-"); // The empty geocode is shown as the label. assertLabelEquals(EMPTY_GEOCODE); // The empty geocode is shown as the label. } public void testSetPhoneCallDetails_NoGeocodeForVoicemail() { setPhoneCallDetailsWithNumberAndGeocode(TEST_VOICEMAIL_NUMBER, "", "United States"); assertLabelEquals("-"); // The empty geocode is shown as the label. assertLabelEquals(EMPTY_GEOCODE); // The empty geocode is shown as the label. } public void testSetPhoneCallDetails_Highlighted() { Loading Loading
res/values/strings.xml +3 −2 Original line number Diff line number Diff line Loading @@ -456,8 +456,9 @@ <!-- String describing the icon used to start a voice search --> <string name="description_start_voice_search">Start voice search</string> <!-- The string used to represent an unknown location for a phone number in the call log [CHAR LIMIT=3] --> <string name="call_log_empty_gecode">\u0020</string> <!-- The string used to represent an unknown location for a phone number in the call log Do not translate. --> <string name="call_log_empty_geocode"></string> <!-- Menu item used to call a contact, containing the number of the contact to call --> <string name="menu_callNumber">Call <xliff:g id="number">%s</xliff:g></string> Loading
src/com/android/dialer/PhoneCallDetailsHelper.java +2 −3 Original line number Diff line number Diff line Loading @@ -62,8 +62,8 @@ public class PhoneCallDetailsHelper { PhoneNumberUtilsWrapper phoneUtils) { mResources = resources; mCallTypeHelper = callTypeHelper; mPhoneNumberHelper = new PhoneNumberDisplayHelper(resources); mPhoneNumberUtilsWrapper = phoneUtils; mPhoneNumberHelper = new PhoneNumberDisplayHelper(mPhoneNumberUtilsWrapper, resources); } /** Fills the call details views with content. */ Loading Loading @@ -121,7 +121,7 @@ public class PhoneCallDetailsHelper { nameText = displayNumber; if (TextUtils.isEmpty(details.geocode) || mPhoneNumberUtilsWrapper.isVoicemailNumber(details.number)) { numberText = mResources.getString(R.string.call_log_empty_gecode); numberText = mResources.getString(R.string.call_log_empty_geocode); } else { numberText = details.geocode; } Loading @@ -136,7 +136,6 @@ public class PhoneCallDetailsHelper { } views.nameView.setText(nameText); views.labelView.setText(labelText); views.labelView.setVisibility(TextUtils.isEmpty(labelText) ? View.GONE : View.VISIBLE); } Loading
src/com/android/dialer/calllog/PhoneNumberDisplayHelper.java +9 −3 Original line number Diff line number Diff line Loading @@ -18,8 +18,8 @@ package com.android.dialer.calllog; import android.content.res.Resources; import android.provider.CallLog.Calls; import android.telephony.PhoneNumberUtils; import android.text.TextUtils; import android.util.Log; import com.android.dialer.R; Loading @@ -27,10 +27,17 @@ import com.android.dialer.R; * Helper for formatting and managing the display of phone numbers. */ public class PhoneNumberDisplayHelper { private final PhoneNumberUtilsWrapper mPhoneNumberUtils; private final Resources mResources; public PhoneNumberDisplayHelper(Resources resources) { mResources = resources; mPhoneNumberUtils = new PhoneNumberUtilsWrapper(); } public PhoneNumberDisplayHelper(PhoneNumberUtilsWrapper phoneNumberUtils, Resources resources) { mPhoneNumberUtils = phoneNumberUtils; mResources = resources; } /* package */ CharSequence getDisplayName(CharSequence number, int presentation) { Loading @@ -43,7 +50,7 @@ public class PhoneNumberDisplayHelper { if (presentation == Calls.PRESENTATION_PAYPHONE) { return mResources.getString(R.string.payphone); } if (new PhoneNumberUtilsWrapper().isVoicemailNumber(number)) { if (mPhoneNumberUtils.isVoicemailNumber(number)) { return mResources.getString(R.string.voicemail); } if (PhoneNumberUtilsWrapper.isLegacyUnknownNumbers(number)) { Loading @@ -62,7 +69,6 @@ public class PhoneNumberDisplayHelper { int presentation, CharSequence formattedNumber) { final CharSequence displayName = getDisplayName(number, presentation); if (!TextUtils.isEmpty(displayName)) { return displayName; } Loading
src/com/android/dialer/dialpad/DialpadFragment.java +5 −5 Original line number Diff line number Diff line Loading @@ -1561,8 +1561,8 @@ public class DialpadFragment extends Fragment */ private void updateDialString(char newDigit) { if (newDigit != WAIT && newDigit != PAUSE) { Log.wtf(TAG, "Not expected for anything other than PAUSE & WAIT"); return; throw new IllegalArgumentException( "Not expected for anything other than PAUSE & WAIT"); } int selectionStart; Loading Loading @@ -1642,8 +1642,8 @@ public class DialpadFragment extends Fragment /* package */ static boolean canAddDigit(CharSequence digits, int start, int end, char newDigit) { if(newDigit != WAIT && newDigit != PAUSE) { Log.wtf(TAG, "Should not be called for anything other than PAUSE & WAIT"); return false; throw new IllegalArgumentException( "Should not be called for anything other than PAUSE & WAIT"); } // False if no selection, or selection is reversed (end < start) Loading
tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java +5 −3 Original line number Diff line number Diff line Loading @@ -51,6 +51,8 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { private static final String TEST_COUNTRY_ISO = "US"; /** The geocoded location used in the tests. */ private static final String TEST_GEOCODE = "United States"; /** Empty geocode label */ private static final String EMPTY_GEOCODE = ""; /** The object under test. */ private PhoneCallDetailsHelper mHelper; Loading Loading @@ -183,18 +185,18 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { public void testSetPhoneCallDetails_NoGeocode() { setPhoneCallDetailsWithNumberAndGeocode("+14125555555", "1-412-555-5555", null); assertNameEquals("1-412-555-5555"); // The phone number is shown as the name. assertLabelEquals("-"); // The empty geocode is shown as the label. assertLabelEquals(EMPTY_GEOCODE); // The empty geocode is shown as the label. } public void testSetPhoneCallDetails_EmptyGeocode() { setPhoneCallDetailsWithNumberAndGeocode("+14125555555", "1-412-555-5555", ""); assertNameEquals("1-412-555-5555"); // The phone number is shown as the name. assertLabelEquals("-"); // The empty geocode is shown as the label. assertLabelEquals(EMPTY_GEOCODE); // The empty geocode is shown as the label. } public void testSetPhoneCallDetails_NoGeocodeForVoicemail() { setPhoneCallDetailsWithNumberAndGeocode(TEST_VOICEMAIL_NUMBER, "", "United States"); assertLabelEquals("-"); // The empty geocode is shown as the label. assertLabelEquals(EMPTY_GEOCODE); // The empty geocode is shown as the label. } public void testSetPhoneCallDetails_Highlighted() { Loading