diff options
author | Andrew Lee <anwlee@google.com> | 2015-06-05 23:55:12 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-05 23:55:20 +0000 |
commit | 6406d98f10d6e74492e7cc47bd6f5c6c5fbb6fdf (patch) | |
tree | 78b4a2c81cc0f67b7455f4c0cf15a60c38cc6c4f /src | |
parent | 3ba851c3df0429bb4c5a0a376ea669f8ea5be9e0 (diff) | |
parent | e177fe610d3f9725d6b7c66bfe25823efcd15fe6 (diff) |
Merge "Add call button to details, increase hit area." into mnc-dev
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/CallDetailActivity.java | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index 6da7c798c..87ec774a8 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -97,11 +97,9 @@ public class CallDetailActivity extends Activity { @Override public void onGetCallDetails(PhoneCallDetails[] details) { - Context context = CallDetailActivity.this; - if (details == null) { // Somewhere went wrong: we're going to bail out and show error to users. - Toast.makeText(context, R.string.toast_call_detail_error, + Toast.makeText(mContext, R.string.toast_call_detail_error, Toast.LENGTH_SHORT).show(); finish(); return; @@ -119,9 +117,9 @@ public class CallDetailActivity extends Activity { // Cache the details about the phone number. final boolean canPlaceCallsTo = - PhoneNumberUtilsWrapper.canPlaceCallsTo(mNumber, numberPresentation); - final PhoneNumberUtilsWrapper phoneUtils = new PhoneNumberUtilsWrapper(context); - final boolean isVoicemailNumber = + PhoneNumberUtilsWrapper.canPlaceCallsTo(mNumber, numberPresentation); + final PhoneNumberUtilsWrapper phoneUtils = new PhoneNumberUtilsWrapper(mContext); + mIsVoicemailNumber = phoneUtils.isVoicemailNumber(accountHandle, mNumber); final boolean isSipNumber = PhoneNumberUtilsWrapper.isSipNumber(mNumber); @@ -144,7 +142,9 @@ public class CallDetailActivity extends Activity { } } - String accountLabel = PhoneAccountUtils.getAccountLabel(context, accountHandle); + mCallButton.setVisibility(canPlaceCallsTo ? View.VISIBLE : View.GONE); + + String accountLabel = PhoneAccountUtils.getAccountLabel(mContext, accountHandle); if (!TextUtils.isEmpty(accountLabel)) { mAccountLabel.setText(accountLabel); mAccountLabel.setVisibility(View.VISIBLE); @@ -153,14 +153,14 @@ public class CallDetailActivity extends Activity { } mHasEditNumberBeforeCallOption = - canPlaceCallsTo && !isSipNumber && !isVoicemailNumber; + canPlaceCallsTo && !isSipNumber && !mIsVoicemailNumber; mHasTrashOption = hasVoicemail(); mHasRemoveFromCallLogOption = !hasVoicemail(); invalidateOptionsMenu(); ListView historyList = (ListView) findViewById(R.id.history); historyList.setAdapter( - new CallDetailHistoryAdapter(context, mInflater, mCallTypeHelper, details)); + new CallDetailHistoryAdapter(mContext, mInflater, mCallTypeHelper, details)); String lookupKey = contactUri == null ? null : ContactInfoHelper.getLookupKeyFromUri(contactUri); @@ -168,7 +168,7 @@ public class CallDetailActivity extends Activity { final boolean isBusiness = mContactInfoHelper.isBusiness(firstDetails.sourceType); final int contactType = - isVoicemailNumber ? ContactPhotoManager.TYPE_VOICEMAIL : + mIsVoicemailNumber ? ContactPhotoManager.TYPE_VOICEMAIL : isBusiness ? ContactPhotoManager.TYPE_BUSINESS : ContactPhotoManager.TYPE_DEFAULT; @@ -201,14 +201,17 @@ public class CallDetailActivity extends Activity { } }; + private Context mContext; private CallTypeHelper mCallTypeHelper; private QuickContactBadge mQuickContactBadge; private TextView mCallerName; private TextView mCallerNumber; private TextView mAccountLabel; + private View mCallButton; private ContactInfoHelper mContactInfoHelper; - private String mNumber = null; + private String mNumber; + private boolean mIsVoicemailNumber; private String mDefaultCountryIso; /* package */ LayoutInflater mInflater; @@ -230,6 +233,8 @@ public class CallDetailActivity extends Activity { protected void onCreate(Bundle icicle) { super.onCreate(icicle); + mContext = this; + setContentView(R.layout.call_detail); mInflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); @@ -248,6 +253,14 @@ public class CallDetailActivity extends Activity { mDefaultCountryIso = GeoUtil.getCurrentCountryIso(this); mContactPhotoManager = ContactPhotoManager.getInstance(this); + mCallButton = (View) findViewById(R.id.call_back_button); + mCallButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + mContext.startActivity(IntentUtil.getCallIntent(mNumber)); + } + }); + mContactInfoHelper = new ContactInfoHelper(this, GeoUtil.getCurrentCountryIso(this)); getActionBar().setDisplayHomeAsUpEnabled(true); |