summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-08-26 17:53:58 -0700
committerAndrew Lee <anwlee@google.com>2015-08-27 10:55:07 -0700
commitfe791b7f8f30eb5bd540da221e530a46804da636 (patch)
treee2361af3cfdfe9aeeef989528d3eec77c953d5e2
parentee11620e21080fdf30868ec45877124d2b66a81d (diff)
Don't allow copying VM transcript if empty.
Bug: 23557301 Change-Id: I4faf58a9df9a3391c35e5cb4db7cc727b6842585
-rw-r--r--src/com/android/dialer/calllog/CallLogAdapter.java42
1 files changed, 19 insertions, 23 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index 477e449b3..aa307b6c6 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -202,10 +202,9 @@ public class CallLogAdapter extends GroupingListAdapter
private final View.OnCreateContextMenuListener mOnCreateContextMenuListener =
new View.OnCreateContextMenuListener() {
@Override
- public void onCreateContextMenu(ContextMenu menu, View v,
- ContextMenuInfo menuInfo) {
- final CallLogListItemViewHolder vh =
- (CallLogListItemViewHolder) v.getTag();
+ public void onCreateContextMenu(
+ ContextMenu menu, View v, ContextMenuInfo menuInfo) {
+ final CallLogListItemViewHolder vh = (CallLogListItemViewHolder) v.getTag();
if (TextUtils.isEmpty(vh.number)) {
return;
}
@@ -225,8 +224,7 @@ public class CallLogAdapter extends GroupingListAdapter
copyItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
- ClipboardUtils.copyText(CallLogAdapter.this.mContext, null,
- vh.number, true);
+ ClipboardUtils.copyText(mContext, null, vh.number, true);
return true;
}
});
@@ -248,8 +246,8 @@ public class CallLogAdapter extends GroupingListAdapter
editItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
- final Intent intent = new Intent(Intent.ACTION_DIAL,
- CallUtil.getCallUri(vh.number));
+ final Intent intent = new Intent(
+ Intent.ACTION_DIAL, CallUtil.getCallUri(vh.number));
intent.setClass(mContext, DialtactsActivity.class);
DialerUtils.startActivityWithErrorToast(mContext, intent);
return true;
@@ -257,27 +255,25 @@ public class CallLogAdapter extends GroupingListAdapter
});
}
- if (vh.callType == CallLog.Calls.VOICEMAIL_TYPE) {
+ final TextView transcriptView =
+ vh.phoneCallDetailsViews.voicemailTranscriptionView;
+ if (vh.callType == CallLog.Calls.VOICEMAIL_TYPE
+ && transcriptView.length() > 0) {
final MenuItem copyTranscriptItem = menu.add(
ContextMenu.NONE,
R.id.context_menu_copy_transcript_to_clipboard,
ContextMenu.NONE,
- R.string.copy_transcript_text
- );
+ 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;
- }
- });
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ ClipboardUtils.copyText(
+ mContext, null, transcriptView.getText(), true);
+ return true;
+ }
+ });
}
}
};