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 | |
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
-rw-r--r-- | res/layout/call_log_list_item.xml | 1 | ||||
-rw-r--r-- | res/values/ids.xml | 1 | ||||
-rw-r--r-- | res/values/strings.xml | 6 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/CallLogAdapter.java | 70 |
4 files changed, 55 insertions, 23 deletions
diff --git a/res/layout/call_log_list_item.xml b/res/layout/call_log_list_item.xml index f5c0f369e..ec512b67f 100644 --- a/res/layout/call_log_list_item.xml +++ b/res/layout/call_log_list_item.xml @@ -96,7 +96,6 @@ android:textSize="@dimen/call_log_secondary_text_size" android:singleLine="true" android:ellipsize="marquee" - android:textIsSelectable="true" android:visibility="gone" /> <LinearLayout diff --git a/res/values/ids.xml b/res/values/ids.xml index e2f0ff593..5c00924a8 100644 --- a/res/values/ids.xml +++ b/res/values/ids.xml @@ -16,5 +16,6 @@ <resources> <item type="id" name="context_menu_copy_to_clipboard" /> + <item type="id" name="context_menu_copy_transcript_to_clipboard" /> <item type="id" name="context_menu_edit_before_call" /> </resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index eec9b0ca7..adf0456da 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -51,6 +51,12 @@ [CHAR LIMIT=30] --> <string name="call_detail_menu_report">Report inaccurate number</string> + <!-- Option displayed in context menu to copy long pressed phone number to clipboard [CHAR LIMIT=64] --> + <string name="copy_number_text">Copy number to clipboard</string> + + <!-- Option displayed in context menu to copy long pressed voicemail transcription to clipboard [CHAR LIMIT=64] --> + <string name="copy_transcript_text">Copy transcription to clipboard</string> + <!-- Menu item used to copy a number from the call log to the dialer so it can be edited before calling it --> <string name="recentCalls_editNumberBeforeCall">Edit number before call</string> 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; + } + }); + } } }; |