Loading res/layout/call_log_list_item.xml +1 −13 Original line number Diff line number Diff line Loading @@ -74,24 +74,12 @@ android:background="@drawable/ic_divider_dashed_holo_dark" /> <ImageView android:id="@+id/call_icon" android:id="@+id/secondary_action_icon" android:layout_width="@dimen/call_log_call_action_width" android:layout_height="@dimen/call_log_call_action_height" android:layout_gravity="center_vertical" android:scaleType="center" android:src="@drawable/ic_ab_dialer_holo_dark" android:background="@drawable/list_selector" android:contentDescription="@string/description_call_log_call_button" /> <ImageView android:id="@+id/play_icon" android:layout_width="@dimen/call_log_call_action_width" android:layout_height="@dimen/call_log_call_action_height" android:layout_gravity="center_vertical" android:scaleType="center" android:src="@drawable/ic_play_holo_dark" android:background="@drawable/list_selector" android:contentDescription="@string/description_call_log_play_button" /> </LinearLayout> <LinearLayout Loading src/com/android/contacts/calllog/CallLogFragment.java +7 −9 Original line number Diff line number Diff line Loading @@ -327,7 +327,8 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility PhoneCallDetailsHelper phoneCallDetailsHelper = new PhoneCallDetailsHelper( resources, callTypeHelper, mPhoneNumberHelper); mCallLogViewsHelper = new CallLogListItemHelper(phoneCallDetailsHelper, mPhoneNumberHelper); new CallLogListItemHelper( phoneCallDetailsHelper, mPhoneNumberHelper, resources); mCallLogGroupBuilder = new CallLogGroupBuilder(this); } Loading Loading @@ -660,8 +661,7 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility private void findAndCacheViews(View view) { // Get the views to bind to. CallLogListItemViews views = CallLogListItemViews.fromView(view); views.callView.setOnClickListener(mCallPlayOnClickListener); views.playView.setOnClickListener(mCallPlayOnClickListener); views.secondaryActionView.setOnClickListener(mCallPlayOnClickListener); view.setTag(views); } Loading Loading @@ -703,17 +703,15 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility if (callType == Calls.VOICEMAIL_TYPE) { String voicemailUri = c.getString(CallLogQuery.VOICEMAIL_URI); final long rowId = c.getLong(CallLogQuery.ID); views.playView.setTag( views.secondaryActionView.setTag( IntentProvider.getPlayVoicemailIntentProvider(rowId, voicemailUri)); views.callView.setTag(null); } else if (!TextUtils.isEmpty(number)) { // Store away the number so we can call it directly if you click on the call icon. views.callView.setTag(IntentProvider.getReturnCallIntentProvider(number)); views.playView.setTag(null); views.secondaryActionView.setTag( IntentProvider.getReturnCallIntentProvider(number)); } else { // No action enabled. views.callView.setTag(null); views.playView.setTag(null); views.secondaryActionView.setTag(null); } // Lookup contacts with this number Loading src/com/android/contacts/calllog/CallLogListItemHelper.java +26 −8 Original line number Diff line number Diff line Loading @@ -18,7 +18,9 @@ package com.android.contacts.calllog; import com.android.contacts.PhoneCallDetails; import com.android.contacts.PhoneCallDetailsHelper; import com.android.contacts.R; import android.content.res.Resources; import android.provider.CallLog.Calls; import android.view.View; Loading @@ -30,6 +32,8 @@ import android.view.View; private final PhoneCallDetailsHelper mPhoneCallDetailsHelper; /** Helper for handling phone numbers. */ private final PhoneNumberHelper mPhoneNumberHelper; /** Resources to look up strings. */ private final Resources mResources; /** * Creates a new helper instance. Loading @@ -38,9 +42,10 @@ import android.view.View; * @param phoneNumberHelper used to process phone number */ public CallLogListItemHelper(PhoneCallDetailsHelper phoneCallDetailsHelper, PhoneNumberHelper phoneNumberHelper) { PhoneNumberHelper phoneNumberHelper, Resources resources) { mPhoneCallDetailsHelper = phoneCallDetailsHelper; mPhoneNumberHelper= phoneNumberHelper; mResources = resources; } /** Loading @@ -59,22 +64,35 @@ import android.view.View; if (canPlay) { // Playback action takes preference. views.callView.setVisibility(View.GONE); views.playView.setVisibility(View.VISIBLE); configurePlaySecondaryAction(views); views.unheardView.setVisibility(isHighlighted ? View.VISIBLE : View.GONE); views.dividerView.setVisibility(View.VISIBLE); } else if (canCall) { // Call is the main action. views.callView.setVisibility(View.VISIBLE); views.playView.setVisibility(View.GONE); // Call is the secondary action. configureCallSecondaryAction(views); views.unheardView.setVisibility(View.GONE); views.dividerView.setVisibility(View.VISIBLE); } else { // No action available. views.callView.setVisibility(View.GONE); views.playView.setVisibility(View.GONE); views.secondaryActionView.setVisibility(View.GONE); views.unheardView.setVisibility(View.GONE); views.dividerView.setVisibility(View.GONE); } } /** Sets the secondary action to correspond to the call button. */ private void configureCallSecondaryAction(CallLogListItemViews views) { views.secondaryActionView.setVisibility(View.VISIBLE); views.secondaryActionView.setImageResource(R.drawable.ic_ab_dialer_holo_dark); views.secondaryActionView.setContentDescription( mResources.getString(R.string.description_call_log_call_button)); } /** Sets the secondary action to correspond to the play button. */ private void configurePlaySecondaryAction(CallLogListItemViews views) { views.secondaryActionView.setVisibility(View.VISIBLE); views.secondaryActionView.setImageResource(R.drawable.ic_play_holo_dark); views.secondaryActionView.setContentDescription( mResources.getString(R.string.description_call_log_play_button)); } } src/com/android/contacts/calllog/CallLogListItemViews.java +8 −12 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import com.android.contacts.R; import android.content.Context; import android.view.View; import android.widget.ImageView; import android.widget.QuickContactBadge; import android.widget.TextView; Loading @@ -30,13 +31,11 @@ import android.widget.TextView; public final class CallLogListItemViews { /** The quick contact badge for the contact. */ public final QuickContactBadge quickContactView; /** The main action button on the entry. */ public final View callView; /** The play action button used for voicemail. */ public final View playView; /** The secondary action button on the entry. */ public final ImageView secondaryActionView; /** The icon used for unheard voicemail. */ public final View unheardView; /** The divider between callView and playView. */ /** The divider between the primary and secondary actions. */ public final View dividerView; /** The details of the phone call. */ public final PhoneCallDetailsViews phoneCallDetailsViews; Loading @@ -46,12 +45,11 @@ public final class CallLogListItemViews { public final TextView listHeaderTextView; private CallLogListItemViews(QuickContactBadge quickContactView, View callView, View playView, View unheardView, View dividerView, ImageView secondaryActionView, View unheardView, View dividerView, PhoneCallDetailsViews phoneCallDetailsViews, View listItemView, TextView listHeaderTextView) { this.quickContactView = quickContactView; this.callView = callView; this.playView = playView; this.secondaryActionView = secondaryActionView; this.unheardView = unheardView; this.dividerView = dividerView; this.phoneCallDetailsViews = phoneCallDetailsViews; Loading @@ -62,8 +60,7 @@ public final class CallLogListItemViews { public static CallLogListItemViews fromView(View view) { return new CallLogListItemViews( (QuickContactBadge) view.findViewById(R.id.quick_contact_photo), view.findViewById(R.id.call_icon), view.findViewById(R.id.play_icon), (ImageView) view.findViewById(R.id.secondary_action_icon), view.findViewById(R.id.unheard_icon), view.findViewById(R.id.divider), PhoneCallDetailsViews.fromView(view), Loading @@ -74,8 +71,7 @@ public final class CallLogListItemViews { public static CallLogListItemViews createForTest(Context context) { return new CallLogListItemViews( new QuickContactBadge(context), new View(context), new View(context), new ImageView(context), new View(context), new View(context), PhoneCallDetailsViews.createForTest(context), Loading tests/src/com/android/contacts/activities/CallLogActivityTests.java +7 −7 Original line number Diff line number Diff line Loading @@ -174,7 +174,7 @@ public class CallLogActivityTests insert(CallerInfo.PRIVATE_NUMBER, NOW, 0, Calls.INCOMING_TYPE); View view = mAdapter.newGroupView(getActivity(), mParentView); mAdapter.bindGroupView(view, getActivity(), mCursor, 3, false); assertNotNull(view.findViewById(R.id.call_icon)); assertNotNull(view.findViewById(R.id.secondary_action_icon)); } @MediumTest Loading @@ -183,7 +183,7 @@ public class CallLogActivityTests insert(CallerInfo.PRIVATE_NUMBER, NOW, 0, Calls.INCOMING_TYPE); View view = mAdapter.newStandAloneView(getActivity(), mParentView); mAdapter.bindStandAloneView(view, getActivity(), mCursor); assertNotNull(view.findViewById(R.id.call_icon)); assertNotNull(view.findViewById(R.id.secondary_action_icon)); } @MediumTest Loading @@ -192,7 +192,7 @@ public class CallLogActivityTests insert(CallerInfo.PRIVATE_NUMBER, NOW, 0, Calls.INCOMING_TYPE); View view = mAdapter.newChildView(getActivity(), mParentView); mAdapter.bindChildView(view, getActivity(), mCursor); assertNotNull(view.findViewById(R.id.call_icon)); assertNotNull(view.findViewById(R.id.secondary_action_icon)); } @MediumTest Loading Loading @@ -303,7 +303,7 @@ public class CallLogActivityTests mAdapter.bindStandAloneView(view, getActivity(), mCursor); CallLogListItemViews views = (CallLogListItemViews) view.getTag(); IntentProvider intentProvider = (IntentProvider) views.callView.getTag(); IntentProvider intentProvider = (IntentProvider) views.secondaryActionView.getTag(); Intent intent = intentProvider.getIntent(mActivity); // Starts a call. assertEquals(Intent.ACTION_CALL_PRIVILEGED, intent.getAction()); Loading @@ -319,7 +319,7 @@ public class CallLogActivityTests mAdapter.bindStandAloneView(view, getActivity(), mCursor); CallLogListItemViews views = (CallLogListItemViews) view.getTag(); IntentProvider intentProvider = (IntentProvider) views.playView.getTag(); IntentProvider intentProvider = (IntentProvider) views.secondaryActionView.getTag(); Intent intent = intentProvider.getIntent(mActivity); // Starts the call detail activity. assertEquals(new ComponentName(mActivity, CallDetailActivity.class), Loading Loading @@ -357,9 +357,9 @@ public class CallLogActivityTests String number = getPhoneNumberForListEntry(i); if (CallerInfo.PRIVATE_NUMBER.equals(number) || CallerInfo.UNKNOWN_NUMBER.equals(number)) { assertFalse(View.VISIBLE == mItem.callView.getVisibility()); assertFalse(View.VISIBLE == mItem.secondaryActionView.getVisibility()); } else { assertEquals(View.VISIBLE, mItem.callView.getVisibility()); assertEquals(View.VISIBLE, mItem.secondaryActionView.getVisibility()); } } } Loading Loading
res/layout/call_log_list_item.xml +1 −13 Original line number Diff line number Diff line Loading @@ -74,24 +74,12 @@ android:background="@drawable/ic_divider_dashed_holo_dark" /> <ImageView android:id="@+id/call_icon" android:id="@+id/secondary_action_icon" android:layout_width="@dimen/call_log_call_action_width" android:layout_height="@dimen/call_log_call_action_height" android:layout_gravity="center_vertical" android:scaleType="center" android:src="@drawable/ic_ab_dialer_holo_dark" android:background="@drawable/list_selector" android:contentDescription="@string/description_call_log_call_button" /> <ImageView android:id="@+id/play_icon" android:layout_width="@dimen/call_log_call_action_width" android:layout_height="@dimen/call_log_call_action_height" android:layout_gravity="center_vertical" android:scaleType="center" android:src="@drawable/ic_play_holo_dark" android:background="@drawable/list_selector" android:contentDescription="@string/description_call_log_play_button" /> </LinearLayout> <LinearLayout Loading
src/com/android/contacts/calllog/CallLogFragment.java +7 −9 Original line number Diff line number Diff line Loading @@ -327,7 +327,8 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility PhoneCallDetailsHelper phoneCallDetailsHelper = new PhoneCallDetailsHelper( resources, callTypeHelper, mPhoneNumberHelper); mCallLogViewsHelper = new CallLogListItemHelper(phoneCallDetailsHelper, mPhoneNumberHelper); new CallLogListItemHelper( phoneCallDetailsHelper, mPhoneNumberHelper, resources); mCallLogGroupBuilder = new CallLogGroupBuilder(this); } Loading Loading @@ -660,8 +661,7 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility private void findAndCacheViews(View view) { // Get the views to bind to. CallLogListItemViews views = CallLogListItemViews.fromView(view); views.callView.setOnClickListener(mCallPlayOnClickListener); views.playView.setOnClickListener(mCallPlayOnClickListener); views.secondaryActionView.setOnClickListener(mCallPlayOnClickListener); view.setTag(views); } Loading Loading @@ -703,17 +703,15 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility if (callType == Calls.VOICEMAIL_TYPE) { String voicemailUri = c.getString(CallLogQuery.VOICEMAIL_URI); final long rowId = c.getLong(CallLogQuery.ID); views.playView.setTag( views.secondaryActionView.setTag( IntentProvider.getPlayVoicemailIntentProvider(rowId, voicemailUri)); views.callView.setTag(null); } else if (!TextUtils.isEmpty(number)) { // Store away the number so we can call it directly if you click on the call icon. views.callView.setTag(IntentProvider.getReturnCallIntentProvider(number)); views.playView.setTag(null); views.secondaryActionView.setTag( IntentProvider.getReturnCallIntentProvider(number)); } else { // No action enabled. views.callView.setTag(null); views.playView.setTag(null); views.secondaryActionView.setTag(null); } // Lookup contacts with this number Loading
src/com/android/contacts/calllog/CallLogListItemHelper.java +26 −8 Original line number Diff line number Diff line Loading @@ -18,7 +18,9 @@ package com.android.contacts.calllog; import com.android.contacts.PhoneCallDetails; import com.android.contacts.PhoneCallDetailsHelper; import com.android.contacts.R; import android.content.res.Resources; import android.provider.CallLog.Calls; import android.view.View; Loading @@ -30,6 +32,8 @@ import android.view.View; private final PhoneCallDetailsHelper mPhoneCallDetailsHelper; /** Helper for handling phone numbers. */ private final PhoneNumberHelper mPhoneNumberHelper; /** Resources to look up strings. */ private final Resources mResources; /** * Creates a new helper instance. Loading @@ -38,9 +42,10 @@ import android.view.View; * @param phoneNumberHelper used to process phone number */ public CallLogListItemHelper(PhoneCallDetailsHelper phoneCallDetailsHelper, PhoneNumberHelper phoneNumberHelper) { PhoneNumberHelper phoneNumberHelper, Resources resources) { mPhoneCallDetailsHelper = phoneCallDetailsHelper; mPhoneNumberHelper= phoneNumberHelper; mResources = resources; } /** Loading @@ -59,22 +64,35 @@ import android.view.View; if (canPlay) { // Playback action takes preference. views.callView.setVisibility(View.GONE); views.playView.setVisibility(View.VISIBLE); configurePlaySecondaryAction(views); views.unheardView.setVisibility(isHighlighted ? View.VISIBLE : View.GONE); views.dividerView.setVisibility(View.VISIBLE); } else if (canCall) { // Call is the main action. views.callView.setVisibility(View.VISIBLE); views.playView.setVisibility(View.GONE); // Call is the secondary action. configureCallSecondaryAction(views); views.unheardView.setVisibility(View.GONE); views.dividerView.setVisibility(View.VISIBLE); } else { // No action available. views.callView.setVisibility(View.GONE); views.playView.setVisibility(View.GONE); views.secondaryActionView.setVisibility(View.GONE); views.unheardView.setVisibility(View.GONE); views.dividerView.setVisibility(View.GONE); } } /** Sets the secondary action to correspond to the call button. */ private void configureCallSecondaryAction(CallLogListItemViews views) { views.secondaryActionView.setVisibility(View.VISIBLE); views.secondaryActionView.setImageResource(R.drawable.ic_ab_dialer_holo_dark); views.secondaryActionView.setContentDescription( mResources.getString(R.string.description_call_log_call_button)); } /** Sets the secondary action to correspond to the play button. */ private void configurePlaySecondaryAction(CallLogListItemViews views) { views.secondaryActionView.setVisibility(View.VISIBLE); views.secondaryActionView.setImageResource(R.drawable.ic_play_holo_dark); views.secondaryActionView.setContentDescription( mResources.getString(R.string.description_call_log_play_button)); } }
src/com/android/contacts/calllog/CallLogListItemViews.java +8 −12 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import com.android.contacts.R; import android.content.Context; import android.view.View; import android.widget.ImageView; import android.widget.QuickContactBadge; import android.widget.TextView; Loading @@ -30,13 +31,11 @@ import android.widget.TextView; public final class CallLogListItemViews { /** The quick contact badge for the contact. */ public final QuickContactBadge quickContactView; /** The main action button on the entry. */ public final View callView; /** The play action button used for voicemail. */ public final View playView; /** The secondary action button on the entry. */ public final ImageView secondaryActionView; /** The icon used for unheard voicemail. */ public final View unheardView; /** The divider between callView and playView. */ /** The divider between the primary and secondary actions. */ public final View dividerView; /** The details of the phone call. */ public final PhoneCallDetailsViews phoneCallDetailsViews; Loading @@ -46,12 +45,11 @@ public final class CallLogListItemViews { public final TextView listHeaderTextView; private CallLogListItemViews(QuickContactBadge quickContactView, View callView, View playView, View unheardView, View dividerView, ImageView secondaryActionView, View unheardView, View dividerView, PhoneCallDetailsViews phoneCallDetailsViews, View listItemView, TextView listHeaderTextView) { this.quickContactView = quickContactView; this.callView = callView; this.playView = playView; this.secondaryActionView = secondaryActionView; this.unheardView = unheardView; this.dividerView = dividerView; this.phoneCallDetailsViews = phoneCallDetailsViews; Loading @@ -62,8 +60,7 @@ public final class CallLogListItemViews { public static CallLogListItemViews fromView(View view) { return new CallLogListItemViews( (QuickContactBadge) view.findViewById(R.id.quick_contact_photo), view.findViewById(R.id.call_icon), view.findViewById(R.id.play_icon), (ImageView) view.findViewById(R.id.secondary_action_icon), view.findViewById(R.id.unheard_icon), view.findViewById(R.id.divider), PhoneCallDetailsViews.fromView(view), Loading @@ -74,8 +71,7 @@ public final class CallLogListItemViews { public static CallLogListItemViews createForTest(Context context) { return new CallLogListItemViews( new QuickContactBadge(context), new View(context), new View(context), new ImageView(context), new View(context), new View(context), PhoneCallDetailsViews.createForTest(context), Loading
tests/src/com/android/contacts/activities/CallLogActivityTests.java +7 −7 Original line number Diff line number Diff line Loading @@ -174,7 +174,7 @@ public class CallLogActivityTests insert(CallerInfo.PRIVATE_NUMBER, NOW, 0, Calls.INCOMING_TYPE); View view = mAdapter.newGroupView(getActivity(), mParentView); mAdapter.bindGroupView(view, getActivity(), mCursor, 3, false); assertNotNull(view.findViewById(R.id.call_icon)); assertNotNull(view.findViewById(R.id.secondary_action_icon)); } @MediumTest Loading @@ -183,7 +183,7 @@ public class CallLogActivityTests insert(CallerInfo.PRIVATE_NUMBER, NOW, 0, Calls.INCOMING_TYPE); View view = mAdapter.newStandAloneView(getActivity(), mParentView); mAdapter.bindStandAloneView(view, getActivity(), mCursor); assertNotNull(view.findViewById(R.id.call_icon)); assertNotNull(view.findViewById(R.id.secondary_action_icon)); } @MediumTest Loading @@ -192,7 +192,7 @@ public class CallLogActivityTests insert(CallerInfo.PRIVATE_NUMBER, NOW, 0, Calls.INCOMING_TYPE); View view = mAdapter.newChildView(getActivity(), mParentView); mAdapter.bindChildView(view, getActivity(), mCursor); assertNotNull(view.findViewById(R.id.call_icon)); assertNotNull(view.findViewById(R.id.secondary_action_icon)); } @MediumTest Loading Loading @@ -303,7 +303,7 @@ public class CallLogActivityTests mAdapter.bindStandAloneView(view, getActivity(), mCursor); CallLogListItemViews views = (CallLogListItemViews) view.getTag(); IntentProvider intentProvider = (IntentProvider) views.callView.getTag(); IntentProvider intentProvider = (IntentProvider) views.secondaryActionView.getTag(); Intent intent = intentProvider.getIntent(mActivity); // Starts a call. assertEquals(Intent.ACTION_CALL_PRIVILEGED, intent.getAction()); Loading @@ -319,7 +319,7 @@ public class CallLogActivityTests mAdapter.bindStandAloneView(view, getActivity(), mCursor); CallLogListItemViews views = (CallLogListItemViews) view.getTag(); IntentProvider intentProvider = (IntentProvider) views.playView.getTag(); IntentProvider intentProvider = (IntentProvider) views.secondaryActionView.getTag(); Intent intent = intentProvider.getIntent(mActivity); // Starts the call detail activity. assertEquals(new ComponentName(mActivity, CallDetailActivity.class), Loading Loading @@ -357,9 +357,9 @@ public class CallLogActivityTests String number = getPhoneNumberForListEntry(i); if (CallerInfo.PRIVATE_NUMBER.equals(number) || CallerInfo.UNKNOWN_NUMBER.equals(number)) { assertFalse(View.VISIBLE == mItem.callView.getVisibility()); assertFalse(View.VISIBLE == mItem.secondaryActionView.getVisibility()); } else { assertEquals(View.VISIBLE, mItem.callView.getVisibility()); assertEquals(View.VISIBLE, mItem.secondaryActionView.getVisibility()); } } } Loading