summaryrefslogtreecommitdiff
path: root/src/com/android/dialer/CallDetailActivity.java
diff options
context:
space:
mode:
authorSailesh Nepal <sail@google.com>2016-02-21 11:41:28 -0800
committerSailesh Nepal <sail@google.com>2016-02-22 12:39:47 -0800
commit68d86c656e5522dec1b04e85ebc0e0f78e436c3d (patch)
treedf963055f99ac682ef56c1e17d8265ac5808d663 /src/com/android/dialer/CallDetailActivity.java
parent7c5959bfe138a20701ae57f67b0f9cc5813bebee (diff)
[Gradle] Allow dialer to be compiled as a library
This CL adds a new build-library.gradle file for AOSP dialer. This allows the dialer to be built as a library that can be included from GoogleDialer. Switching to a library project meant making two other changes: - changed all switch statements that used resources to if statements. This was required because resource IDs are not final in library projects. - changed InCalUI code to import com.android.dialer.R instead of com.android.incallui.R. See http://b.android.com/82743 for more info on why this is required. src-N isn't supported yet. Also, this isn't the ideal project layout. In the future we should consider switching to the following layout: - dialer/incallui/ <- incall UI as an independent library project - dialer/dialerlib/ <- dialer code as an independent library project - dialer/app <- skelent app that builds a standalone dialer AOSP app Bug: 26676586 Change-Id: I07fbee4d33cc683539e4f8b3953c93f1427af9d7
Diffstat (limited to 'src/com/android/dialer/CallDetailActivity.java')
-rw-r--r--src/com/android/dialer/CallDetailActivity.java68
1 files changed, 31 insertions, 37 deletions
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java
index 56e29a9d7..e6a29fbe2 100644
--- a/src/com/android/dialer/CallDetailActivity.java
+++ b/src/com/android/dialer/CallDetailActivity.java
@@ -349,51 +349,45 @@ 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));
+ if (item.getItemId() == 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(",");
}
- CallLogAsyncTaskUtil.deleteCalls(
- this, callIds.toString(), mCallLogAsyncTaskListener);
+ callIds.append(ContentUris.parseId(callUri));
}
- break;
+ CallLogAsyncTaskUtil.deleteCalls(
+ this, callIds.toString(), mCallLogAsyncTaskListener);
+ }
}
return true;
}
@Override
public void onClick(View view) {
- switch(view.getId()) {
- case R.id.call_detail_action_block:
- BlockNumberDialogFragment.show(
- mBlockedNumberId,
- mNumber,
- mDetails.countryIso,
- mDisplayNumber,
- R.id.call_detail,
- getFragmentManager(),
- this);
- break;
- case R.id.call_detail_action_copy:
- ClipboardUtils.copyText(mContext, null, mNumber, true);
- break;
- case R.id.call_detail_action_edit_before_call:
- Intent dialIntent = new Intent(Intent.ACTION_DIAL,
- CallUtil.getCallUri(getDialableNumber()));
- DialerUtils.startActivityWithErrorToast(mContext, dialIntent);
- break;
- default:
- Log.wtf(TAG, "Unexpected onClick event from " + view);
- break;
+ int resId = view.getId();
+ if (resId == R.id.call_detail_action_block) {
+ BlockNumberDialogFragment.show(
+ mBlockedNumberId,
+ mNumber,
+ mDetails.countryIso,
+ mDisplayNumber,
+ R.id.call_detail,
+ getFragmentManager(),
+ this);
+ } else if (resId == R.id.call_detail_action_copy) {
+ ClipboardUtils.copyText(mContext, null, mNumber, true);
+ } else if (resId == R.id.call_detail_action_edit_before_call) {
+ Intent dialIntent = new Intent(Intent.ACTION_DIAL,
+ CallUtil.getCallUri(getDialableNumber()));
+ DialerUtils.startActivityWithErrorToast(mContext, dialIntent);
+ } else {
+ Log.wtf(TAG, "Unexpected onClick event from " + view);
}
}