summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2015-04-24 17:16:06 -0700
committerYorke Lee <yorkelee@google.com>2015-05-21 16:17:17 -0700
commit71cd19439ef7664b39833da69ce038185ae9ee26 (patch)
tree1ddbc4a7dba9bf4fe9f3947c819b9be3aff23f2d /src
parent5a194cd1f573d6c94a6b0e3e14cfabd69e42b856 (diff)
Allow dialing SIP calls directly from search
Bug: 20554942 Change-Id: I47daa3491223aed7e988e7d81501a281f1566f1c
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/list/RegularSearchListAdapter.java16
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()));