diff options
author | Anne Rong <annerong@google.com> | 2015-07-20 18:03:38 -0700 |
---|---|---|
committer | Anne Rong <annerong@google.com> | 2015-07-21 14:21:14 -0700 |
commit | 664b2018c038fa4626dd06741f117ed3296c11ea (patch) | |
tree | a18519f4b3280027aaa20e2fee8d5283f5e8c06b /src | |
parent | 59c4dfdf471ee72d9e7994853daa6344a555a9e8 (diff) |
Allow copying the voicemail transcription
Added item to context menu that allows copying the voicemail transcript.
Removed the select-on-double-tap from previous commit.
Bug: 22451484
Change-Id: I518680afda74c4c15c5fb16b02a55cae64ed131d
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/calllog/CallLogAdapter.java | 70 |
1 files changed, 48 insertions, 22 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index 458c90bdc..67eaf6a6c 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -44,6 +44,7 @@ import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.ContextMenu.ContextMenuInfo; import android.view.accessibility.AccessibilityEvent; +import android.widget.TextView; import com.android.contacts.common.CallUtil; import com.android.contacts.common.ClipboardUtils; @@ -206,13 +207,17 @@ public class CallLogAdapter extends GroupingListAdapter return; } - menu.setHeaderTitle(vh.number); + if (vh.callType == CallLog.Calls.VOICEMAIL_TYPE) { + menu.setHeaderTitle(mContext.getResources().getText(R.string.voicemail)); + } else { + menu.setHeaderTitle(vh.number); + } final MenuItem copyItem = menu.add( ContextMenu.NONE, R.id.context_menu_copy_to_clipboard, ContextMenu.NONE, - R.string.copy_text); + R.string.copy_number_text); copyItem.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override @@ -228,28 +233,49 @@ public class CallLogAdapter extends GroupingListAdapter // 2) Number is the voicemail number // 3) Number is a SIP address - if (!PhoneNumberUtil.canPlaceCallsTo(vh.number, vh.numberPresentation) - || mTelecomCallLogCache.isVoicemailNumber(vh.accountHandle, vh.number) - || PhoneNumberUtil.isSipNumber(vh.number)) { - return; + if (PhoneNumberUtil.canPlaceCallsTo(vh.number, vh.numberPresentation) + && !mTelecomCallLogCache.isVoicemailNumber(vh.accountHandle, vh.number) + && !PhoneNumberUtil.isSipNumber(vh.number)) { + final MenuItem editItem = menu.add( + ContextMenu.NONE, + R.id.context_menu_edit_before_call, + ContextMenu.NONE, + R.string.recentCalls_editNumberBeforeCall); + + editItem.setOnMenuItemClickListener(new OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem item) { + final Intent intent = new Intent(Intent.ACTION_DIAL, + CallUtil.getCallUri(vh.number)); + intent.setClass(mContext, DialtactsActivity.class); + DialerUtils.startActivityWithErrorToast(mContext, intent); + return true; + } + }); } - final MenuItem editItem = menu.add( - ContextMenu.NONE, - R.id.context_menu_edit_before_call, - ContextMenu.NONE, - R.string.recentCalls_editNumberBeforeCall); - - editItem.setOnMenuItemClickListener(new OnMenuItemClickListener() { - @Override - public boolean onMenuItemClick(MenuItem item) { - final Intent intent = new Intent(Intent.ACTION_DIAL, - CallUtil.getCallUri(vh.number)); - intent.setClass(mContext, DialtactsActivity.class); - DialerUtils.startActivityWithErrorToast(mContext, intent); - return true; - } - }); + if (vh.callType == CallLog.Calls.VOICEMAIL_TYPE) { + final MenuItem copyTranscriptItem = menu.add( + ContextMenu.NONE, + R.id.context_menu_copy_transcript_to_clipboard, + ContextMenu.NONE, + R.string.copy_transcript_text + ); + copyTranscriptItem.setOnMenuItemClickListener( + new OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem item) { + final TextView view = vh.phoneCallDetailsViews. + voicemailTranscriptionView; + ClipboardUtils.copyText( + CallLogAdapter.this.mContext, + null, + view.getText(), + true); + return true; + } + }); + } } }; |