diff options
Diffstat (limited to 'src')
4 files changed, 35 insertions, 26 deletions
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( |