summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--java/com/android/dialer/searchfragment/list/NewSearchFragment.java4
-rw-r--r--java/com/android/dialer/searchfragment/list/SearchActionViewHolder.java31
-rw-r--r--java/com/android/dialer/searchfragment/list/SearchAdapter.java13
3 files changed, 14 insertions, 34 deletions
diff --git a/java/com/android/dialer/searchfragment/list/NewSearchFragment.java b/java/com/android/dialer/searchfragment/list/NewSearchFragment.java
index 64c8b1091..505f1c6b1 100644
--- a/java/com/android/dialer/searchfragment/list/NewSearchFragment.java
+++ b/java/com/android/dialer/searchfragment/list/NewSearchFragment.java
@@ -148,7 +148,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, callInitiationType);
+ adapter.setQuery(query, rawNumber);
adapter.setSearchActions(getActions());
adapter.setZeroSuggestVisible(getArguments().getBoolean(KEY_SHOW_ZERO_SUGGEST));
emptyContentView = view.findViewById(R.id.empty_view);
@@ -263,7 +263,7 @@ public final class NewSearchFragment extends Fragment
this.query = query;
this.callInitiationType = callInitiationType;
if (adapter != null) {
- adapter.setQuery(query, rawNumber, callInitiationType);
+ adapter.setQuery(query, rawNumber);
adapter.setSearchActions(getActions());
adapter.setZeroSuggestVisible(isRegularSearch());
loadCp2ContactsCursor();
diff --git a/java/com/android/dialer/searchfragment/list/SearchActionViewHolder.java b/java/com/android/dialer/searchfragment/list/SearchActionViewHolder.java
index 76c71d6ac..7315e8999 100644
--- a/java/com/android/dialer/searchfragment/list/SearchActionViewHolder.java
+++ b/java/com/android/dialer/searchfragment/list/SearchActionViewHolder.java
@@ -26,13 +26,10 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;
-import com.android.dialer.callintent.CallInitiationType;
-import com.android.dialer.callintent.CallIntentBuilder;
-import com.android.dialer.callintent.CallSpecificAppData;
import com.android.dialer.common.Assert;
import com.android.dialer.logging.DialerImpression;
import com.android.dialer.logging.Logger;
-import com.android.dialer.precall.PreCall;
+import com.android.dialer.searchfragment.common.RowClickListener;
import com.android.dialer.util.DialerUtils;
import com.android.dialer.util.IntentUtil;
import java.lang.annotation.Retention;
@@ -70,25 +67,25 @@ final class SearchActionViewHolder extends RecyclerView.ViewHolder implements On
private final Context context;
private final ImageView actionImage;
private final TextView actionText;
+ private final RowClickListener listener;
private @Action int action;
private int position;
private String query;
- private CallInitiationType.Type callInitiationType;
- SearchActionViewHolder(View view) {
+ SearchActionViewHolder(View view, RowClickListener listener) {
super(view);
context = view.getContext();
actionImage = view.findViewById(R.id.search_action_image);
actionText = view.findViewById(R.id.search_action_text);
+ this.listener = listener;
view.setOnClickListener(this);
}
- void setAction(@Action int action, int position, String query, CallInitiationType.Type type) {
+ void setAction(@Action int action, int position, String query) {
this.action = action;
this.position = position;
this.query = query;
- this.callInitiationType = type;
switch (action) {
case Action.ADD_TO_CONTACT:
actionText.setText(R.string.search_shortcut_add_to_contact);
@@ -113,7 +110,6 @@ final class SearchActionViewHolder extends RecyclerView.ViewHolder implements On
case Action.INVALID:
default:
throw Assert.createIllegalStateFailException("Invalid action: " + action);
-
}
}
@@ -140,14 +136,7 @@ final class SearchActionViewHolder extends RecyclerView.ViewHolder implements On
break;
case Action.MAKE_VILTE_CALL:
- CallSpecificAppData videoCallSpecificAppData =
- CallSpecificAppData.newBuilder()
- .setCallInitiationType(callInitiationType)
- .setPositionOfSelectedSearchResult(position)
- .setCharactersInSearchString(query.length())
- .build();
- PreCall.start(
- context, new CallIntentBuilder(query, videoCallSpecificAppData).setIsVideoCall(true));
+ listener.placeVideoCall(query, position);
break;
case Action.SEND_SMS:
@@ -156,13 +145,7 @@ final class SearchActionViewHolder extends RecyclerView.ViewHolder implements On
break;
case Action.MAKE_VOICE_CALL:
- CallSpecificAppData voiceCallSpecificAppData =
- CallSpecificAppData.newBuilder()
- .setCallInitiationType(callInitiationType)
- .setPositionOfSelectedSearchResult(position)
- .setCharactersInSearchString(query.length())
- .build();
- PreCall.start(context, new CallIntentBuilder(query, voiceCallSpecificAppData));
+ listener.placeVoiceCall(query, position);
break;
case Action.INVALID:
diff --git a/java/com/android/dialer/searchfragment/list/SearchAdapter.java b/java/com/android/dialer/searchfragment/list/SearchAdapter.java
index c5f36e902..805eaf524 100644
--- a/java/com/android/dialer/searchfragment/list/SearchAdapter.java
+++ b/java/com/android/dialer/searchfragment/list/SearchAdapter.java
@@ -26,7 +26,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
-import com.android.dialer.callintent.CallInitiationType;
import com.android.dialer.common.Assert;
import com.android.dialer.searchfragment.common.RowClickListener;
import com.android.dialer.searchfragment.common.SearchCursor;
@@ -48,7 +47,6 @@ public final class SearchAdapter extends RecyclerView.Adapter<ViewHolder> {
// Raw query number from dialpad, which may contain special character such as "+". This is used
// for actions to add contact or send sms.
private String rawNumber;
- private CallInitiationType.Type callInitiationType;
private OnClickListener allowClickListener;
private OnClickListener dismissClickListener;
private RowClickListener rowClickListener;
@@ -83,7 +81,8 @@ public final class SearchAdapter extends RecyclerView.Adapter<ViewHolder> {
rowClickListener);
case RowType.SEARCH_ACTION:
return new SearchActionViewHolder(
- LayoutInflater.from(context).inflate(R.layout.search_action_layout, root, false));
+ LayoutInflater.from(context).inflate(R.layout.search_action_layout, root, false),
+ rowClickListener);
case RowType.LOCATION_REQUEST:
return new LocationPermissionViewHolder(
LayoutInflater.from(context).inflate(R.layout.location_permission_row, root, false),
@@ -117,8 +116,7 @@ public final class SearchAdapter extends RecyclerView.Adapter<ViewHolder> {
.setAction(
searchCursorManager.getSearchAction(position),
position,
- TextUtils.isEmpty(rawNumber) ? query : rawNumber,
- callInitiationType);
+ TextUtils.isEmpty(rawNumber) ? query : rawNumber);
} else if (holder instanceof LocationPermissionViewHolder) {
// No-op
} else {
@@ -148,17 +146,16 @@ public final class SearchAdapter extends RecyclerView.Adapter<ViewHolder> {
/**
* @param visible If true and query is empty, the adapter won't show any list elements.
- * @see #setQuery(String, String, CallInitiationType.Type)
+ * @see #setQuery(String, String)
* @see #getItemCount()
*/
public void setZeroSuggestVisible(boolean visible) {
showZeroSuggest = visible;
}
- public void setQuery(String query, @Nullable String rawNumber, CallInitiationType.Type type) {
+ public void setQuery(String query, @Nullable String rawNumber) {
this.query = query;
this.rawNumber = rawNumber;
- this.callInitiationType = type;
if (searchCursorManager.setQuery(query)) {
notifyDataSetChanged();
}