summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-05-13 15:38:10 -0700
committerYorke Lee <yorkelee@google.com>2014-05-13 15:39:18 -0700
commit4e28c1d175a1a9e565b974c85a54709f41ee925b (patch)
treeb58b22e9980116b9553fb21378e01156fdb52cea /src
parent7ff97a0c24daa15738d26c16367e122dfa6f7591 (diff)
Simplify PhoneNumberPickerActionListener logic in DialtactsActivity
Change-Id: Idea95bfc4a8c4fa3a451eaae677cd5150037f1b0
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/DialtactsActivity.java54
1 files changed, 13 insertions, 41 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index 7f9200eb4..b7272d748 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;
@@ -235,39 +236,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() {
@@ -430,15 +398,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);
}
@@ -984,22 +950,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() {