summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-03-04 21:18:28 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-03-04 21:18:28 +0000
commit724927cd6ca0222ab7fcef555b6222db98097e37 (patch)
tree201ccb901f82643d86f3eb21b4416e6efa917076 /src
parent4d7a0f8ea5e53b29a5bea7dcfac67bdb38a31d79 (diff)
parentcfe34de350034af9c0b703800e0961205e657d37 (diff)
am cfe34de3: am ef793edd: Fix Dialer tests
* commit 'cfe34de350034af9c0b703800e0961205e657d37': Fix Dialer tests
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/PhoneCallDetailsHelper.java5
-rw-r--r--src/com/android/dialer/calllog/PhoneNumberDisplayHelper.java12
-rw-r--r--src/com/android/dialer/dialpad/DialpadFragment.java10
3 files changed, 16 insertions, 11 deletions
diff --git a/src/com/android/dialer/PhoneCallDetailsHelper.java b/src/com/android/dialer/PhoneCallDetailsHelper.java
index 8e6c943a4..446df021d 100644
--- a/src/com/android/dialer/PhoneCallDetailsHelper.java
+++ b/src/com/android/dialer/PhoneCallDetailsHelper.java
@@ -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. */
@@ -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;
}
@@ -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);
}
diff --git a/src/com/android/dialer/calllog/PhoneNumberDisplayHelper.java b/src/com/android/dialer/calllog/PhoneNumberDisplayHelper.java
index 81f3ca1e5..5d7ce7ea9 100644
--- a/src/com/android/dialer/calllog/PhoneNumberDisplayHelper.java
+++ b/src/com/android/dialer/calllog/PhoneNumberDisplayHelper.java
@@ -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;
@@ -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) {
@@ -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)) {
@@ -62,7 +69,6 @@ public class PhoneNumberDisplayHelper {
int presentation, CharSequence formattedNumber) {
final CharSequence displayName = getDisplayName(number, presentation);
-
if (!TextUtils.isEmpty(displayName)) {
return displayName;
}
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index 00b8281a7..093cde246 100644
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -1560,9 +1560,9 @@ public class DialpadFragment extends Fragment
* or Wait character (;).
*/
private void updateDialString(char newDigit) {
- if(newDigit != WAIT && newDigit != PAUSE) {
- Log.wtf(TAG, "Not expected for anything other than PAUSE & WAIT");
- return;
+ if (newDigit != WAIT && newDigit != PAUSE) {
+ throw new IllegalArgumentException(
+ "Not expected for anything other than PAUSE & WAIT");
}
int selectionStart;
@@ -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)