diff options
author | Andrew Lee <anwlee@google.com> | 2015-03-18 12:08:33 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2015-03-18 14:31:23 -0700 |
commit | ad3d871e15e615b0dc36045606452c54e94b93f8 (patch) | |
tree | 01cac6763653dabc1634fe66878ca25cad244257 /src | |
parent | f7cef1a00e194ba3ed5b00a6640ea300dd6f97d4 (diff) |
Add "Send SMS" shortcut to Dialer.
Bug: 19372539
Change-Id: I8135a7e6fb7d5becdafcb0ecfb64d6f6c73aeb88
Diffstat (limited to 'src')
3 files changed, 15 insertions, 2 deletions
diff --git a/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java b/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java index da4f4a4c9..86e852846 100644 --- a/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java +++ b/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java @@ -28,9 +28,10 @@ public class DialerPhoneNumberListAdapter extends PhoneNumberListAdapter { public final static int SHORTCUT_INVALID = -1; public final static int SHORTCUT_DIRECT_CALL = 0; public final static int SHORTCUT_ADD_NUMBER_TO_CONTACTS = 1; - public final static int SHORTCUT_MAKE_VIDEO_CALL = 2; + public final static int SHORTCUT_SEND_SMS_MESSAGE = 2; + public final static int SHORTCUT_MAKE_VIDEO_CALL = 3; - public final static int SHORTCUT_COUNT = 3; + public final static int SHORTCUT_COUNT = 4; private final boolean[] mShortcutEnabled = new boolean[SHORTCUT_COUNT]; @@ -146,6 +147,10 @@ public class DialerPhoneNumberListAdapter extends PhoneNumberListAdapter { text = resources.getString(R.string.search_shortcut_add_to_contacts); drawableId = R.drawable.ic_search_add_contact; break; + case SHORTCUT_SEND_SMS_MESSAGE: + text = resources.getString(R.string.search_shortcut_send_sms_message); + drawableId = R.drawable.ic_textsms_24dp; + break; case SHORTCUT_MAKE_VIDEO_CALL: text = resources.getString(R.string.search_shortcut_make_video_call); drawableId = R.drawable.ic_videocam; diff --git a/src/com/android/dialer/list/SearchFragment.java b/src/com/android/dialer/list/SearchFragment.java index e50d0d89e..ba014380c 100644 --- a/src/com/android/dialer/list/SearchFragment.java +++ b/src/com/android/dialer/list/SearchFragment.java @@ -18,6 +18,7 @@ package com.android.dialer.list; import android.app.Activity; import android.content.Intent; import android.content.res.Resources; +import android.net.Uri; import android.os.Bundle; import android.text.TextUtils; import android.view.View; @@ -38,6 +39,7 @@ import com.android.dialer.util.DialerUtils; import com.android.phone.common.animation.AnimUtils; public class SearchFragment extends PhoneNumberPickerFragment { + private static final String SMS_URI_PREFIX = "sms:"; private OnListFragmentScrolledListener mActivityScrollListener; @@ -168,6 +170,11 @@ public class SearchFragment extends PhoneNumberPickerFragment { DialerUtils.startActivityWithErrorToast(getActivity(), intent, R.string.add_contact_not_available); break; + case DialerPhoneNumberListAdapter.SHORTCUT_SEND_SMS_MESSAGE: + final Intent sendSmsIntent = new Intent( + Intent.ACTION_VIEW, Uri.parse(SMS_URI_PREFIX + getQueryString())); + DialerUtils.startActivityWithErrorToast(getActivity(), sendSmsIntent); + break; case DialerPhoneNumberListAdapter.SHORTCUT_MAKE_VIDEO_CALL: listener = getOnPhoneNumberPickerListener(); if (listener != null) { diff --git a/src/com/android/dialer/list/SmartDialNumberListAdapter.java b/src/com/android/dialer/list/SmartDialNumberListAdapter.java index db9668267..3696fb900 100644 --- a/src/com/android/dialer/list/SmartDialNumberListAdapter.java +++ b/src/com/android/dialer/list/SmartDialNumberListAdapter.java @@ -117,6 +117,7 @@ public class SmartDialNumberListAdapter extends DialerPhoneNumberListAdapter { final boolean showNumberShortcuts = !TextUtils.isEmpty(getFormattedQueryString()); boolean changed = false; changed |= setShortcutEnabled(SHORTCUT_ADD_NUMBER_TO_CONTACTS, showNumberShortcuts); + changed |= setShortcutEnabled(SHORTCUT_SEND_SMS_MESSAGE, showNumberShortcuts); changed |= setShortcutEnabled(SHORTCUT_MAKE_VIDEO_CALL, showNumberShortcuts && CallUtil.isVideoEnabled(getContext())); if (changed) { |