From 73bc910eee877d8f3f7f547e4fce809465f02805 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Fri, 2 Oct 2015 23:50:23 +0000 Subject: Revert "Prepatory CallDetailActivity tweaks." This reverts commit 11a7350843ec13c7ca4d27523e9ba146911d2767. Change-Id: Idf62da51c934ee598c1bbc1b5052e6cea2929feb --- src/com/android/dialer/CallDetailActivity.java | 42 ++++++++++++-------------- 1 file changed, 20 insertions(+), 22 deletions(-) (limited to 'src/com/android/dialer/CallDetailActivity.java') diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index 7cb517bbd..d95b55ecb 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -321,24 +321,23 @@ public class CallDetailActivity extends AppCompatActivity @Override public boolean onCreateOptionsMenu(Menu menu) { - final MenuItem deleteMenuItem = menu.add( - Menu.NONE, - R.id.call_detail_delete_menu_item, - Menu.NONE, - R.string.call_details_delete); - deleteMenuItem.setIcon(R.drawable.ic_delete_24dp); - deleteMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - deleteMenuItem.setOnMenuItemClickListener(this); - getMenuInflater().inflate(R.menu.call_details_options, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onPrepareOptionsMenu(Menu menu) { + // This action deletes all elements in the group from the call log. + // We don't have this action for voicemails, because you can just use the trash button. + menu.findItem(R.id.menu_remove_from_call_log) + .setVisible(!hasVoicemail()) + .setOnMenuItemClickListener(this); menu.findItem(R.id.menu_edit_number_before_call) .setVisible(mHasEditNumberBeforeCallOption) .setOnMenuItemClickListener(this); + menu.findItem(R.id.menu_trash) + .setVisible(hasVoicemail()) + .setOnMenuItemClickListener(this); menu.findItem(R.id.menu_report) .setVisible(mHasReportMenuOption) .setOnMenuItemClickListener(this); @@ -348,25 +347,24 @@ public class CallDetailActivity extends AppCompatActivity @Override public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { - case R.id.call_detail_delete_menu_item: - if (hasVoicemail()) { - CallLogAsyncTaskUtil.deleteVoicemail( - this, mVoicemailUri, mCallLogAsyncTaskListener); - } else { - final StringBuilder callIds = new StringBuilder(); - for (Uri callUri : getCallLogEntryUris()) { - if (callIds.length() != 0) { - callIds.append(","); - } - callIds.append(ContentUris.parseId(callUri)); + case R.id.menu_remove_from_call_log: + final StringBuilder callIds = new StringBuilder(); + for (Uri callUri : getCallLogEntryUris()) { + if (callIds.length() != 0) { + callIds.append(","); } - CallLogAsyncTaskUtil.deleteCalls( - this, callIds.toString(), mCallLogAsyncTaskListener); + callIds.append(ContentUris.parseId(callUri)); } + CallLogAsyncTaskUtil.deleteCalls( + this, callIds.toString(), mCallLogAsyncTaskListener); break; case R.id.menu_edit_number_before_call: startActivity(new Intent(Intent.ACTION_DIAL, CallUtil.getCallUri(mNumber))); break; + case R.id.menu_trash: + CallLogAsyncTaskUtil.deleteVoicemail( + this, mVoicemailUri, mCallLogAsyncTaskListener); + break; } return true; } -- cgit v1.2.3