diff options
author | calderwoodra <calderwoodra@google.com> | 2017-11-17 18:17:53 -0800 |
---|---|---|
committer | Zachary Heidepriem <zachh@google.com> | 2017-11-18 08:32:12 -0800 |
commit | 5a2b1b2e7cbe8fd5c402ffe0386920b3a63340fa (patch) | |
tree | 2e00a0a7ba6e87cdbed46d3f4137597d7ee236fb /java/com/android/dialer/searchfragment/list/NewSearchFragment.java | |
parent | f8785b93d38b0e65b5a49500231dc26457792cc9 (diff) |
Added place voice call search action to regular search.
When a user types a phone number into the search bar, there isn't an intuitive
way for them to place a call when the number doesn't match any existing
contacts in the new search UI. This change adds the option to place a voice
call from regular search, like the old UI.
Bug: 69385190
Test: NSFT
PiperOrigin-RevId: 176189153
Change-Id: I6c1561bcce104c56855d996570a79b34da7230ff
Diffstat (limited to 'java/com/android/dialer/searchfragment/list/NewSearchFragment.java')
-rw-r--r-- | java/com/android/dialer/searchfragment/list/NewSearchFragment.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/java/com/android/dialer/searchfragment/list/NewSearchFragment.java b/java/com/android/dialer/searchfragment/list/NewSearchFragment.java index 93263ceb2..df2714690 100644 --- a/java/com/android/dialer/searchfragment/list/NewSearchFragment.java +++ b/java/com/android/dialer/searchfragment/list/NewSearchFragment.java @@ -142,7 +142,7 @@ public final class NewSearchFragment extends Fragment LayoutInflater inflater, @Nullable ViewGroup parent, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_search, parent, false); adapter = new SearchAdapter(getContext(), new SearchCursorManager(), this); - adapter.setQuery(query, rawNumber); + adapter.setQuery(query, rawNumber, callInitiationType); adapter.setSearchActions(getActions()); adapter.setZeroSuggestVisible(getArguments().getBoolean(KEY_SHOW_ZERO_SUGGEST)); emptyContentView = view.findViewById(R.id.empty_view); @@ -260,7 +260,7 @@ public final class NewSearchFragment extends Fragment this.query = query; this.callInitiationType = callInitiationType; if (adapter != null) { - adapter.setQuery(query, rawNumber); + adapter.setQuery(query, rawNumber, callInitiationType); adapter.setSearchActions(getActions()); adapter.setZeroSuggestVisible(isRegularSearch()); loadNearbyPlacesCursor(); @@ -445,19 +445,27 @@ public final class NewSearchFragment extends Fragment * the list of supported actions, see {@link SearchActionViewHolder.Action}. */ private List<Integer> getActions() { - boolean nonDialableQueryInRegularSearch = - isRegularSearch() && !PhoneNumberUtils.isGlobalPhoneNumber(query); + boolean isDialableNumber = PhoneNumberUtils.isGlobalPhoneNumber(query); + boolean nonDialableQueryInRegularSearch = isRegularSearch() && !isDialableNumber; if (TextUtils.isEmpty(query) || query.length() == 1 || nonDialableQueryInRegularSearch) { return Collections.emptyList(); } List<Integer> actions = new ArrayList<>(); - actions.add(Action.CREATE_NEW_CONTACT); - actions.add(Action.ADD_TO_CONTACT); + if (!isRegularSearch()) { + actions.add(Action.CREATE_NEW_CONTACT); + actions.add(Action.ADD_TO_CONTACT); + } + + if (isRegularSearch() && isDialableNumber) { + actions.add(Action.MAKE_VOICE_CALL); + } + actions.add(Action.SEND_SMS); if (CallUtil.isVideoEnabled(getContext())) { actions.add(Action.MAKE_VILTE_CALL); } + return actions; } |