diff options
7 files changed, 24 insertions, 20 deletions
diff --git a/src/com/android/dialer/PhoneCallDetailsHelper.java b/src/com/android/dialer/PhoneCallDetailsHelper.java index 5e960f985..c5f2fb675 100644 --- a/src/com/android/dialer/PhoneCallDetailsHelper.java +++ b/src/com/android/dialer/PhoneCallDetailsHelper.java @@ -85,8 +85,7 @@ public class PhoneCallDetailsHelper { // Show the video icon if the call had video enabled. views.callTypeIcons.setShowVideo( - (details.features & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO - && CallUtil.isVideoEnabled()); + (details.features & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO); views.callTypeIcons.requestLayout(); views.callTypeIcons.setVisibility(View.VISIBLE); diff --git a/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java b/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java index 3c0795530..d53f77f8a 100644 --- a/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java +++ b/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java @@ -124,7 +124,7 @@ public class CallDetailHistoryAdapter extends BaseAdapter { int callType = details.callTypes[0]; boolean isVideoCall = (details.features & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO - && CallUtil.isVideoEnabled(); + && CallUtil.isVideoEnabled(mContext); callTypeIconView.clear(); callTypeIconView.add(callType); diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index b12bbec4a..e009ddafb 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -775,7 +775,7 @@ public class CallLogAdapter extends GroupingListAdapter null, accountIcon, features, dataUsage, transcription); } - mCallLogViewsHelper.setPhoneCallDetails(views, details); + mCallLogViewsHelper.setPhoneCallDetails(mContext, views, details); int contactType = ContactPhotoManager.TYPE_DEFAULT; diff --git a/src/com/android/dialer/calllog/CallLogListItemHelper.java b/src/com/android/dialer/calllog/CallLogListItemHelper.java index 23b70d9ed..68ca7a8dc 100644 --- a/src/com/android/dialer/calllog/CallLogListItemHelper.java +++ b/src/com/android/dialer/calllog/CallLogListItemHelper.java @@ -16,6 +16,7 @@ package com.android.dialer.calllog; +import android.content.Context; import android.content.res.Resources; import android.provider.CallLog.Calls; import android.text.TextUtils; @@ -52,17 +53,19 @@ import com.android.dialer.R; /** * Sets the name, label, and number for a contact. * + * @param context The application context. * @param views the views to populate * @param details the details of a phone call needed to fill in the data */ - public void setPhoneCallDetails(CallLogListItemViews views, PhoneCallDetails details) { + public void setPhoneCallDetails( + Context context, CallLogListItemViews views, PhoneCallDetails details) { mPhoneCallDetailsHelper.setPhoneCallDetails(views.phoneCallDetailsViews, details); // Set the accessibility text for the contact badge views.quickContactView.setContentDescription(getContactBadgeDescription(details)); // Set the primary action accessibility description - views.primaryActionView.setContentDescription(getCallDescription(details)); + views.primaryActionView.setContentDescription(getCallDescription(context, details)); // Cache name or number of caller. Used when setting the content descriptions of buttons // when the actions ViewStub is inflated. @@ -124,10 +127,12 @@ import com.android.dialer.R; * Examples: * 3 calls. New Voicemail. Missed call from Joe Smith mobile 2 hours ago. * 2 calls. Answered call from John Doe mobile. Last called 1 hour ago. + * + * @param context The application context. * @param details Details of call. * @return Return call action description. */ - public CharSequence getCallDescription(PhoneCallDetails details) { + public CharSequence getCallDescription(Context context, PhoneCallDetails details) { int lastCallType = getLastCallType(details.callTypes); boolean isVoiceMail = lastCallType == Calls.VOICEMAIL_TYPE; @@ -155,7 +160,7 @@ import com.android.dialer.R; // If call had video capabilities, add the "Video Call" string. if ((details.features & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO && - CallUtil.isVideoEnabled()) { + CallUtil.isVideoEnabled(context)) { callDescription.append(mResources.getString(R.string.description_video_call)); } diff --git a/src/com/android/dialer/list/RegularSearchListAdapter.java b/src/com/android/dialer/list/RegularSearchListAdapter.java index b1223b74f..3ce4bea72 100644 --- a/src/com/android/dialer/list/RegularSearchListAdapter.java +++ b/src/com/android/dialer/list/RegularSearchListAdapter.java @@ -75,7 +75,7 @@ public class RegularSearchListAdapter extends DialerPhoneNumberListAdapter { // Otherwise, it should add it to a new contact as a name. setShortcutEnabled(SHORTCUT_ADD_NUMBER_TO_CONTACTS, showNumberShortcuts); setShortcutEnabled(SHORTCUT_MAKE_VIDEO_CALL, - showNumberShortcuts && CallUtil.isVideoEnabled()); + showNumberShortcuts && CallUtil.isVideoEnabled(getContext())); super.setQueryString(queryString); } } diff --git a/src/com/android/dialer/list/SmartDialNumberListAdapter.java b/src/com/android/dialer/list/SmartDialNumberListAdapter.java index 898115a74..b2e031074 100644 --- a/src/com/android/dialer/list/SmartDialNumberListAdapter.java +++ b/src/com/android/dialer/list/SmartDialNumberListAdapter.java @@ -120,7 +120,7 @@ public class SmartDialNumberListAdapter extends DialerPhoneNumberListAdapter { final boolean showNumberShortcuts = !TextUtils.isEmpty(getFormattedQueryString()); setShortcutEnabled(SHORTCUT_ADD_NUMBER_TO_CONTACTS, showNumberShortcuts); setShortcutEnabled(SHORTCUT_MAKE_VIDEO_CALL, - showNumberShortcuts && CallUtil.isVideoEnabled()); + showNumberShortcuts && CallUtil.isVideoEnabled(getContext())); super.setQueryString(queryString); } } diff --git a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java index c00116573..85dbf8c83 100644 --- a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java @@ -233,7 +233,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, new int[]{Calls.OUTGOING_TYPE, Calls.OUTGOING_TYPE}, TEST_DATE, TEST_DURATION); - CharSequence description = mHelper.getCallDescription(details); + CharSequence description = mHelper.getCallDescription(getContext(), details); assertFalse(description.toString() .contains(this.mResources.getString(R.string.description_new_voicemail))); } @@ -247,7 +247,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, new int[]{Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE}, TEST_DATE, TEST_DURATION); - CharSequence description = mHelper.getCallDescription(details); + CharSequence description = mHelper.getCallDescription(getContext(), details); assertFalse(description.toString() .contains(this.mResources.getString(R.string.description_new_voicemail))); } @@ -261,7 +261,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, new int[]{Calls.MISSED_TYPE, Calls.OUTGOING_TYPE}, TEST_DATE, TEST_DURATION); - CharSequence description = mHelper.getCallDescription(details); + CharSequence description = mHelper.getCallDescription(getContext(), details); assertFalse(description.toString() .contains(this.mResources.getString(R.string.description_new_voicemail))); } @@ -275,7 +275,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, new int[]{Calls.VOICEMAIL_TYPE, Calls.OUTGOING_TYPE}, TEST_DATE, TEST_DURATION); - CharSequence description = mHelper.getCallDescription(details); + CharSequence description = mHelper.getCallDescription(getContext(), details); assertTrue(description.toString() .contains(this.mResources.getString(R.string.description_new_voicemail))); } @@ -289,7 +289,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, new int[]{Calls.VOICEMAIL_TYPE}, TEST_DATE, TEST_DURATION); - CharSequence description = mHelper.getCallDescription(details); + CharSequence description = mHelper.getCallDescription(getContext(), details); // Rather than hard coding the "X calls" string message, we'll generate it with an empty // number of calls, and trim the resulting string. This gets us just the word "calls", @@ -308,7 +308,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, new int[]{Calls.VOICEMAIL_TYPE, Calls.INCOMING_TYPE}, TEST_DATE, TEST_DURATION); - CharSequence description = mHelper.getCallDescription(details); + CharSequence description = mHelper.getCallDescription(getContext(), details); assertTrue(description.toString() .contains(this.mResources.getString(R.string.description_num_calls, 2))); } @@ -324,7 +324,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { new int[]{Calls.INCOMING_TYPE, Calls.INCOMING_TYPE}, TEST_DATE, TEST_DURATION, null, null, Calls.FEATURES_VIDEO, null, null); - CharSequence description = mHelper.getCallDescription(details); + CharSequence description = mHelper.getCallDescription(getContext(), details); assertTrue(description.toString() .contains(this.mResources.getString(R.string.description_video_call, 2))); } @@ -346,7 +346,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { /** Sets the details of a phone call using the specified phone number. */ private void setPhoneCallDetailsWithNumberAndType(String number, int presentation, String formattedNumber, int callType) { - mHelper.setPhoneCallDetails(mViews, + mHelper.setPhoneCallDetails(getContext(), mViews, new PhoneCallDetails(number, presentation, formattedNumber, TEST_COUNTRY_ISO, TEST_GEOCODE, new int[]{ callType }, TEST_DATE, TEST_DURATION) @@ -355,7 +355,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { /** Sets the details of a phone call using the specified call type. */ private void setPhoneCallDetailsWithTypes(int... types) { - mHelper.setPhoneCallDetails(mViews, + mHelper.setPhoneCallDetails(getContext() ,mViews, new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, types, TEST_DATE, TEST_DURATION) @@ -364,7 +364,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { /** Sets the details of an unread phone call using the specified call type. */ private void setUnreadPhoneCallDetailsWithTypes(int... types) { - mHelper.setPhoneCallDetails(mViews, + mHelper.setPhoneCallDetails(getContext(), mViews, new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, types, TEST_DATE, TEST_DURATION) |