diff options
author | calderwoodra <calderwoodra@google.com> | 2018-03-15 18:00:49 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-03-15 18:29:58 -0700 |
commit | ae3bc3d8da092970c07802531dfea781d9eaff08 (patch) | |
tree | d66e4aab330e58b314943850f194ecbad050abf5 | |
parent | 2baf7636d8a6bb15aa41c16cfecddb9f09684cde (diff) |
Close keyboard when placing a call to nearby places and remote contacts.
Bug: 74784637
Test: manual
PiperOrigin-RevId: 189276349
Change-Id: I27b0f911ab5165f902bef017e8c09276441a9dee
4 files changed, 23 insertions, 18 deletions
diff --git a/java/com/android/dialer/searchfragment/directories/DirectoryContactViewHolder.java b/java/com/android/dialer/searchfragment/directories/DirectoryContactViewHolder.java index aef1e9ece..f6cdc4fc6 100644 --- a/java/com/android/dialer/searchfragment/directories/DirectoryContactViewHolder.java +++ b/java/com/android/dialer/searchfragment/directories/DirectoryContactViewHolder.java @@ -29,15 +29,13 @@ import android.view.View; import android.widget.ImageView; import android.widget.QuickContactBadge; import android.widget.TextView; -import com.android.dialer.callintent.CallInitiationType; -import com.android.dialer.callintent.CallIntentBuilder; import com.android.dialer.common.cp2.DirectoryCompat; import com.android.dialer.contactphoto.ContactPhotoManager; import com.android.dialer.lettertile.LetterTileDrawable; -import com.android.dialer.precall.PreCall; import com.android.dialer.searchfragment.common.Projections; import com.android.dialer.searchfragment.common.QueryBoldingUtil; import com.android.dialer.searchfragment.common.R; +import com.android.dialer.searchfragment.common.RowClickListener; import com.android.dialer.searchfragment.common.SearchCursor; /** ViewHolder for a directory contact row. */ @@ -49,10 +47,12 @@ public final class DirectoryContactViewHolder extends RecyclerView.ViewHolder private final TextView numberView; private final QuickContactBadge photo; private final ImageView workBadge; + private final RowClickListener listener; private String number; + private int position; - public DirectoryContactViewHolder(View view) { + public DirectoryContactViewHolder(View view, RowClickListener listener) { super(view); view.setOnClickListener(this); photo = view.findViewById(R.id.photo); @@ -60,6 +60,7 @@ public final class DirectoryContactViewHolder extends RecyclerView.ViewHolder numberView = view.findViewById(R.id.secondary); workBadge = view.findViewById(R.id.work_icon); context = view.getContext(); + this.listener = listener; } /** @@ -68,6 +69,7 @@ public final class DirectoryContactViewHolder extends RecyclerView.ViewHolder */ public void bind(SearchCursor cursor, String query) { number = cursor.getString(Projections.PHONE_NUMBER); + position = cursor.getPosition(); String name = cursor.getString(Projections.DISPLAY_NAME); String label = getLabel(context.getResources(), cursor); String secondaryInfo = @@ -139,6 +141,6 @@ public final class DirectoryContactViewHolder extends RecyclerView.ViewHolder @Override public void onClick(View v) { - PreCall.start(context, new CallIntentBuilder(number, CallInitiationType.Type.REGULAR_SEARCH)); + listener.placeVoiceCall(number, position); } } diff --git a/java/com/android/dialer/searchfragment/list/NewSearchFragment.java b/java/com/android/dialer/searchfragment/list/NewSearchFragment.java index 6a60598a7..64c8b1091 100644 --- a/java/com/android/dialer/searchfragment/list/NewSearchFragment.java +++ b/java/com/android/dialer/searchfragment/list/NewSearchFragment.java @@ -509,28 +509,27 @@ public final class NewSearchFragment extends Fragment @Override public void placeVoiceCall(String phoneNumber, int ranking) { - placeCall(phoneNumber, ranking, false, true); + placeCall(phoneNumber, ranking, false); } @Override public void placeVideoCall(String phoneNumber, int ranking) { - placeCall(phoneNumber, ranking, true, false); + placeCall(phoneNumber, ranking, true); } - private void placeCall( - String phoneNumber, int position, boolean isVideoCall, boolean allowAssistedDial) { + private void placeCall(String phoneNumber, int position, boolean isVideoCall) { CallSpecificAppData callSpecificAppData = CallSpecificAppData.newBuilder() .setCallInitiationType(callInitiationType) .setPositionOfSelectedSearchResult(position) .setCharactersInSearchString(query == null ? 0 : query.length()) - .setAllowAssistedDialing(allowAssistedDial) + .setAllowAssistedDialing(true) .build(); PreCall.start( getContext(), new CallIntentBuilder(phoneNumber, callSpecificAppData) .setIsVideoCall(isVideoCall) - .setAllowAssistedDial(allowAssistedDial)); + .setAllowAssistedDial(true)); FragmentUtils.getParentUnsafe(this, SearchFragmentListener.class).onCallPlacedFromSearch(); } diff --git a/java/com/android/dialer/searchfragment/list/SearchAdapter.java b/java/com/android/dialer/searchfragment/list/SearchAdapter.java index 462426943..c5f36e902 100644 --- a/java/com/android/dialer/searchfragment/list/SearchAdapter.java +++ b/java/com/android/dialer/searchfragment/list/SearchAdapter.java @@ -70,7 +70,8 @@ public final class SearchAdapter extends RecyclerView.Adapter<ViewHolder> { rowClickListener); case RowType.NEARBY_PLACES_ROW: return new NearbyPlaceViewHolder( - LayoutInflater.from(context).inflate(R.layout.search_contact_row, root, false)); + LayoutInflater.from(context).inflate(R.layout.search_contact_row, root, false), + rowClickListener); case RowType.CONTACT_HEADER: case RowType.DIRECTORY_HEADER: case RowType.NEARBY_PLACES_HEADER: @@ -78,7 +79,8 @@ public final class SearchAdapter extends RecyclerView.Adapter<ViewHolder> { LayoutInflater.from(context).inflate(R.layout.header_layout, root, false)); case RowType.DIRECTORY_ROW: return new DirectoryContactViewHolder( - LayoutInflater.from(context).inflate(R.layout.search_contact_row, root, false)); + LayoutInflater.from(context).inflate(R.layout.search_contact_row, root, false), + rowClickListener); case RowType.SEARCH_ACTION: return new SearchActionViewHolder( LayoutInflater.from(context).inflate(R.layout.search_action_layout, root, false)); diff --git a/java/com/android/dialer/searchfragment/nearbyplaces/NearbyPlaceViewHolder.java b/java/com/android/dialer/searchfragment/nearbyplaces/NearbyPlaceViewHolder.java index f15b236dd..968c1957f 100644 --- a/java/com/android/dialer/searchfragment/nearbyplaces/NearbyPlaceViewHolder.java +++ b/java/com/android/dialer/searchfragment/nearbyplaces/NearbyPlaceViewHolder.java @@ -25,14 +25,12 @@ import android.view.View; import android.widget.QuickContactBadge; import android.widget.TextView; import com.android.contacts.common.util.Constants; -import com.android.dialer.callintent.CallInitiationType; -import com.android.dialer.callintent.CallIntentBuilder; import com.android.dialer.contactphoto.ContactPhotoManager; import com.android.dialer.lettertile.LetterTileDrawable; -import com.android.dialer.precall.PreCall; import com.android.dialer.searchfragment.common.Projections; import com.android.dialer.searchfragment.common.QueryBoldingUtil; import com.android.dialer.searchfragment.common.R; +import com.android.dialer.searchfragment.common.RowClickListener; import com.android.dialer.searchfragment.common.SearchCursor; /** ViewHolder for a nearby place row. */ @@ -43,16 +41,19 @@ public final class NearbyPlaceViewHolder extends RecyclerView.ViewHolder private final TextView placeName; private final TextView placeAddress; private final QuickContactBadge photo; + private final RowClickListener listener; private String number; + private int position; - public NearbyPlaceViewHolder(View view) { + public NearbyPlaceViewHolder(View view, RowClickListener listener) { super(view); view.setOnClickListener(this); photo = view.findViewById(R.id.photo); placeName = view.findViewById(R.id.primary); placeAddress = view.findViewById(R.id.secondary); context = view.getContext(); + this.listener = listener; } /** @@ -61,6 +62,7 @@ public final class NearbyPlaceViewHolder extends RecyclerView.ViewHolder */ public void bind(SearchCursor cursor, String query) { number = cursor.getString(Projections.PHONE_NUMBER); + position = cursor.getPosition(); String name = cursor.getString(Projections.DISPLAY_NAME); String address = cursor.getString(Projections.PHONE_LABEL); @@ -93,6 +95,6 @@ public final class NearbyPlaceViewHolder extends RecyclerView.ViewHolder @Override public void onClick(View v) { - PreCall.start(context, new CallIntentBuilder(number, CallInitiationType.Type.REGULAR_SEARCH)); + listener.placeVoiceCall(number, position); } } |