From cf5e001120916deb770ea65ae55730e456f92137 Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Fri, 16 May 2014 08:02:55 -0700 Subject: Adding call details affordance to call log. Bug: 14876142 Change-Id: Ic4e806153156489473aeff91dbb9380302431ace --- res/layout/call_log_list_item.xml | 1 + res/layout/call_log_list_item_actions.xml | 25 +++++++++++++++-- res/values/strings.xml | 19 ++++++++----- src/com/android/dialer/calllog/CallLogAdapter.java | 23 ++++++++++++---- .../dialer/calllog/CallLogListItemHelper.java | 3 ++ .../dialer/calllog/CallLogListItemViews.java | 3 ++ src/com/android/dialer/calllog/IntentProvider.java | 32 ++++++++-------------- 7 files changed, 70 insertions(+), 36 deletions(-) diff --git a/res/layout/call_log_list_item.xml b/res/layout/call_log_list_item.xml index b36101e55..ff6b7ba86 100644 --- a/res/layout/call_log_list_item.xml +++ b/res/layout/call_log_list_item.xml @@ -21,6 +21,7 @@ android:layout_height="wrap_content" android:id="@+id/call_log_list_item" android:orientation="vertical" + android:clipChildren="false" > diff --git a/res/layout/call_log_list_item_actions.xml b/res/layout/call_log_list_item_actions.xml index eb4aea282..d4e98d0c0 100644 --- a/res/layout/call_log_list_item_actions.xml +++ b/res/layout/call_log_list_item_actions.xml @@ -42,7 +42,8 @@ android:textSize="@dimen/call_log_secondary_text_size" android:nextFocusLeft="@+id/primary_action_view" android:nextFocusRight="@+id/voicemail_action" - android:focusable="true"/> + android:focusable="true" + android:singleLine="true"/> + android:focusable="true" + android:singleLine="true"/> + + android:focusable="true" + android:singleLine="true"/> diff --git a/res/values/strings.xml b/res/values/strings.xml index 4215f5367..04c951b98 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -429,13 +429,6 @@ --> Contact details for %1$s - - Call details - LISTEN + + DETAILS + @@ -718,6 +717,12 @@ [CHAR LIMIT=NONE] --> Delete call log entry for %1$s + + Call details for %1$s + Call log entry deleted. diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index c4389ad49..e1c0acfd8 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -641,7 +641,7 @@ public class CallLogAdapter extends GroupingListAdapter views.callType = callType; views.voicemailUri = c.getString(CallLogQuery.VOICEMAIL_URI); // Stash away the Ids of the calls so that we can support deleting a row in the call log. - views.callIds = getCallIds(c, rowId, count); + views.callIds = getCallIds(c, count); final ContactInfo cachedContactInfo = getContactInfoFromCallLog(c); @@ -857,7 +857,8 @@ public class CallLogAdapter extends GroupingListAdapter // block and block further attempts to set focus. boolean focused = views.callBackButtonView.requestAccessibilityFocus() || views.voicemailButtonView.requestAccessibilityFocus() || - views.deleteButtonView.requestAccessibilityFocus(); + views.deleteButtonView.requestAccessibilityFocus() || + views.detailsButtonView.requestAccessibilityFocus(); } else { // When recycling a view, it is possible the actionsView ViewStub was previously // inflated so we should hide it in this case. @@ -894,10 +895,14 @@ public class CallLogAdapter extends GroupingListAdapter views.voicemailButtonView = (TextView)views.actionsView.findViewById(R.id.voicemail_action); } - if ( views.deleteButtonView == null) { + if (views.deleteButtonView == null) { views.deleteButtonView = (TextView)views.actionsView.findViewById(R.id.delete_action); } + if (views.detailsButtonView == null) { + views.detailsButtonView = (TextView)views.actionsView.findViewById(R.id.details_action); + } + bindActionButtons(views); } @@ -927,9 +932,18 @@ public class CallLogAdapter extends GroupingListAdapter IntentProvider.getPlayVoicemailIntentProvider( views.rowId, views.voicemailUri)); views.voicemailButtonView.setVisibility(View.VISIBLE); + + views.detailsButtonView.setVisibility(View.GONE); } else { views.voicemailButtonView.setTag(null); views.voicemailButtonView.setVisibility(View.GONE); + + views.detailsButtonView.setOnClickListener(mActionListener); + views.detailsButtonView.setTag( + IntentProvider.getCallDetailIntentProvider( + views.rowId, views.callIds, null) + ); + } views.deleteButtonView.setOnClickListener(this.mDeleteListener); @@ -1268,11 +1282,10 @@ public class CallLogAdapter extends GroupingListAdapter * Retrieves the call Ids represented by the current call log row. * * @param cursor Call log cursor to retrieve call Ids from. - * @param id Id of the first call of the grouping. * @param groupSize Number of calls associated with the current call log row. * @return Array of call Ids. */ - private long[] getCallIds(final Cursor cursor, final long id, final int groupSize) { + private long[] getCallIds(final Cursor cursor, final int groupSize) { // We want to restore the position in the cursor at the end. int startingPosition = cursor.getPosition(); long[] ids = new long[groupSize]; diff --git a/src/com/android/dialer/calllog/CallLogListItemHelper.java b/src/com/android/dialer/calllog/CallLogListItemHelper.java index 976726d28..baeb38241 100644 --- a/src/com/android/dialer/calllog/CallLogListItemHelper.java +++ b/src/com/android/dialer/calllog/CallLogListItemHelper.java @@ -82,6 +82,9 @@ import com.android.dialer.R; views.deleteButtonView.setContentDescription( mResources.getString(R.string.description_delete_action, views.nameOrNumber)); + + views.detailsButtonView.setContentDescription( + mResources.getString(R.string.description_details_action, views.nameOrNumber)); } /** diff --git a/src/com/android/dialer/calllog/CallLogListItemViews.java b/src/com/android/dialer/calllog/CallLogListItemViews.java index 648362e09..474b47895 100644 --- a/src/com/android/dialer/calllog/CallLogListItemViews.java +++ b/src/com/android/dialer/calllog/CallLogListItemViews.java @@ -48,6 +48,8 @@ public final class CallLogListItemViews { public TextView deleteButtonView; /** The "voicemail" action button - assigned only when the action section is expanded. */ public TextView voicemailButtonView; + /** The "details" action button - assigned only when the action section is expanded. */ + public TextView detailsButtonView; /** * The row Id for the first call associated with the call log entry. Used as a key for the @@ -122,6 +124,7 @@ public final class CallLogListItemViews { views.callBackButtonView = new TextView(context); views.deleteButtonView = new TextView(context); views.voicemailButtonView = new TextView(context); + views.detailsButtonView = new TextView(context); views.actionsView = new View(context); return views; } diff --git a/src/com/android/dialer/calllog/IntentProvider.java b/src/com/android/dialer/calllog/IntentProvider.java index da0c69de5..96020be74 100644 --- a/src/com/android/dialer/calllog/IntentProvider.java +++ b/src/com/android/dialer/calllog/IntentProvider.java @@ -65,39 +65,29 @@ public abstract class IntentProvider { }; } + /** + * Retrieves the call details intent provider for an entry in the call log. + * + * @param id The call ID of the first call in the call group. + * @param extraIds The call ID of the other calls grouped together with the call. + * @param voicemailUri If call log entry is for a voicemail, the voicemail URI. + * @return The call details intent provider. + */ public static IntentProvider getCallDetailIntentProvider( - final Cursor cursor, final int position, final long id, final int groupSize) { + final long id, final long[] extraIds, final String voicemailUri) { return new IntentProvider() { @Override public Intent getIntent(Context context) { - if (cursor.isClosed()) { - // There are reported instances where the cursor is already closed. - // b/10937133 - // When causes a crash when it's accessed here. - Log.e(TAG, "getCallDetailIntentProvider() cursor is already closed."); - return null; - } - - cursor.moveToPosition(position); - Intent intent = new Intent(context, CallDetailActivity.class); // Check if the first item is a voicemail. - String voicemailUri = cursor.getString(CallLogQuery.VOICEMAIL_URI); if (voicemailUri != null) { intent.putExtra(CallDetailActivity.EXTRA_VOICEMAIL_URI, Uri.parse(voicemailUri)); } intent.putExtra(CallDetailActivity.EXTRA_VOICEMAIL_START_PLAYBACK, false); - if (groupSize > 1) { - // We want to restore the position in the cursor at the end. - long[] ids = new long[groupSize]; - // Copy the ids of the rows in the group. - for (int index = 0; index < groupSize; ++index) { - ids[index] = cursor.getLong(CallLogQuery.ID); - cursor.moveToNext(); - } - intent.putExtra(CallDetailActivity.EXTRA_CALL_LOG_IDS, ids); + if (extraIds != null && extraIds.length > 0) { + intent.putExtra(CallDetailActivity.EXTRA_CALL_LOG_IDS, extraIds); } else { // If there is a single item, use the direct URI for it. intent.setData(ContentUris.withAppendedId( -- cgit v1.2.3