diff options
author | Yorke Lee <yorkelee@google.com> | 2015-05-21 23:26:02 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-21 23:26:02 +0000 |
commit | 8a545af14198083c946c4c08fca74dadf70369d0 (patch) | |
tree | 6d23d165a73d9952869de0a7f01c2db10b1d5de5 | |
parent | 2b00f73c9d9827d38c425942c8683e3c065848eb (diff) | |
parent | 71cd19439ef7664b39833da69ce038185ae9ee26 (diff) |
Merge "Allow dialing SIP calls directly from search" into mnc-dev
-rw-r--r-- | src/com/android/dialer/list/RegularSearchListAdapter.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/com/android/dialer/list/RegularSearchListAdapter.java b/src/com/android/dialer/list/RegularSearchListAdapter.java index 6c7045814..2be8a1dd7 100644 --- a/src/com/android/dialer/list/RegularSearchListAdapter.java +++ b/src/com/android/dialer/list/RegularSearchListAdapter.java @@ -22,6 +22,7 @@ import android.text.TextUtils; import com.android.contacts.common.CallUtil; import com.android.contacts.common.list.DirectoryPartition; +import com.android.contacts.common.util.PhoneNumberHelper; import com.android.dialer.calllog.ContactInfo; import com.android.dialer.service.CachedNumberLookupService; import com.android.dialer.service.CachedNumberLookupService.CachedContactInfo; @@ -30,6 +31,7 @@ import com.android.dialer.service.CachedNumberLookupService.CachedContactInfo; * List adapter to display regular search results. */ public class RegularSearchListAdapter extends DialerPhoneNumberListAdapter { + private boolean mIsQuerySipAddress; public RegularSearchListAdapter(Context context) { super(context); @@ -67,12 +69,24 @@ public class RegularSearchListAdapter extends DialerPhoneNumberListAdapter { } @Override + public String getFormattedQueryString() { + if (mIsQuerySipAddress) { + // Return unnormalized SIP address + return getQueryString(); + } + return super.getFormattedQueryString(); + } + + @Override public void setQueryString(String queryString) { // Don't show actions if the query string contains a letter. final boolean showNumberShortcuts = !TextUtils.isEmpty(getFormattedQueryString()) && hasDigitsInQueryString(); + // Email addresses that could be SIP addresses are an exception. + mIsQuerySipAddress = PhoneNumberHelper.isUriNumber(queryString); boolean changed = false; - changed |= setShortcutEnabled(SHORTCUT_DIRECT_CALL, showNumberShortcuts); + changed |= setShortcutEnabled(SHORTCUT_DIRECT_CALL, + showNumberShortcuts || mIsQuerySipAddress); changed |= setShortcutEnabled(SHORTCUT_SEND_SMS_MESSAGE, showNumberShortcuts); changed |= setShortcutEnabled(SHORTCUT_MAKE_VIDEO_CALL, showNumberShortcuts && CallUtil.isVideoEnabled(getContext())); |