diff options
author | Yorke Lee <yorkelee@google.com> | 2014-05-13 22:43:57 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-05-13 22:43:57 +0000 |
commit | bf6591fc87b9955778f75686ef6b96e9a05ff9cc (patch) | |
tree | b3f23e3bd668d2fb371caf3e6aac25395707d138 /src | |
parent | 64b8e8af3f24b07baff1942f4723af4269d56b9d (diff) | |
parent | 4e28c1d175a1a9e565b974c85a54709f41ee925b (diff) |
Merge "Simplify PhoneNumberPickerActionListener logic in DialtactsActivity"
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/DialtactsActivity.java | 54 |
1 files changed, 13 insertions, 41 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index a90f0c8d3..8d14f015c 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -40,6 +40,7 @@ import android.telephony.TelephonyManager; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; +import android.util.AttributeSet; import android.util.Log; import android.view.DragEvent; import android.view.Menu; @@ -236,39 +237,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O } /** - * Listener used when one of phone numbers in search UI is selected. This will initiate a - * phone call using the phone number. - */ - private final OnPhoneNumberPickerActionListener mPhoneNumberPickerActionListener = - new OnPhoneNumberPickerActionListener() { - @Override - public void onPickPhoneNumberAction(Uri dataUri) { - // Specify call-origin so that users will see the previous tab instead of - // CallLog screen (search UI will be automatically exited). - PhoneNumberInteraction.startInteractionForPhoneCall( - DialtactsActivity.this, dataUri, getCallOrigin()); - mClearSearchOnPause = true; - } - - @Override - public void onCallNumberDirectly(String phoneNumber) { - Intent intent = CallUtil.getCallIntent(phoneNumber, getCallOrigin()); - startActivity(intent); - mClearSearchOnPause = true; - } - - @Override - public void onShortcutIntentCreated(Intent intent) { - Log.w(TAG, "Unsupported intent has come (" + intent + "). Ignoring."); - } - - @Override - public void onHomeInActionBarSelected() { - exitSearchUi(); - } - }; - - /** * Listener used to send search queries to the phone search fragment. */ private final TextWatcher mPhoneSearchQueryTextListener = new TextWatcher() { @@ -429,15 +397,13 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O transaction.commit(); } else if (fragment instanceof SmartDialSearchFragment) { mSmartDialSearchFragment = (SmartDialSearchFragment) fragment; - mSmartDialSearchFragment.setOnPhoneNumberPickerActionListener( - mPhoneNumberPickerActionListener); + mSmartDialSearchFragment.setOnPhoneNumberPickerActionListener(this); if (mFragmentsFrame != null) { mFragmentsFrame.setAlpha(1.0f); } } else if (fragment instanceof SearchFragment) { mRegularSearchFragment = (RegularSearchFragment) fragment; - mRegularSearchFragment.setOnPhoneNumberPickerActionListener( - mPhoneNumberPickerActionListener); + mRegularSearchFragment.setOnPhoneNumberPickerActionListener(this); if (mFragmentsFrame != null) { mFragmentsFrame.setAlpha(1.0f); } @@ -977,22 +943,28 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override public void onPickPhoneNumberAction(Uri dataUri) { - mPhoneNumberPickerActionListener.onPickPhoneNumberAction(dataUri); + // Specify call-origin so that users will see the previous tab instead of + // CallLog screen (search UI will be automatically exited). + PhoneNumberInteraction.startInteractionForPhoneCall( + DialtactsActivity.this, dataUri, getCallOrigin()); + mClearSearchOnPause = true; } @Override public void onCallNumberDirectly(String phoneNumber) { - mPhoneNumberPickerActionListener.onCallNumberDirectly(phoneNumber); + Intent intent = CallUtil.getCallIntent(phoneNumber, getCallOrigin()); + startActivity(intent); + mClearSearchOnPause = true; } @Override public void onShortcutIntentCreated(Intent intent) { - mPhoneNumberPickerActionListener.onShortcutIntentCreated(intent); + Log.w(TAG, "Unsupported intent has come (" + intent + "). Ignoring."); } @Override public void onHomeInActionBarSelected() { - mPhoneNumberPickerActionListener.onHomeInActionBarSelected(); + exitSearchUi(); } public int getActionBarHeight() { |