Consolidate Search result UIs
- Allow SearchAction to be represented by SearchResultIcon and SearchResultIconRow - Fix tap enter to launch regression - Remove Plugin Pipeline Bug: 177223401 Test: Manual Change-Id: Id1d445f6af3f80f840d567165051188c78230ed0
This commit is contained in:
1 parent
867b62a2d0
commit
c282018765
26 files changed
+365
-1106
No files matched your search
@@ -21,17 +21,16 @@ import static com.android.launcher3.allapps.AllAppsGridAdapter.VIEW_TYPE_ICON;
|
||||
import android.app.search.SearchTarget;
|
||||
import android.util.SparseIntArray;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.android.app.search.LayoutType;
|
||||
import com.android.app.search.ResultType;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.allapps.AllAppsContainerView;
|
||||
import com.android.launcher3.allapps.AllAppsGridAdapter;
|
||||
import com.android.launcher3.allapps.search.SearchAdapterProvider;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.systemui.plugins.shared.SearchTargetLegacy;
|
||||
|
||||
/**
|
||||
* Provides views for on-device search results
|
||||
@@ -39,14 +38,12 @@ import com.android.systemui.plugins.shared.SearchTargetLegacy;
|
||||
public class DeviceSearchAdapterProvider extends SearchAdapterProvider {
|
||||
|
||||
public static final int VIEW_TYPE_SEARCH_CORPUS_TITLE = 1 << 5;
|
||||
public static final int VIEW_TYPE_SEARCH_ROW_WITH_BUTTON = 1 << 7;
|
||||
public static final int VIEW_TYPE_SEARCH_ROW = 1 << 8;
|
||||
public static final int VIEW_TYPE_SEARCH_SLICE = 1 << 9;
|
||||
public static final int VIEW_TYPE_SEARCH_ICON_ROW = 1 << 10;
|
||||
public static final int VIEW_TYPE_SEARCH_SLICE = 1 << 7;
|
||||
public static final int VIEW_TYPE_SEARCH_ICON = (1 << 8) | VIEW_TYPE_ICON;
|
||||
public static final int VIEW_TYPE_SEARCH_ICON_ROW = (1 << 9);
|
||||
public static final int VIEW_TYPE_SEARCH_PEOPLE = 1 << 11;
|
||||
public static final int VIEW_TYPE_SEARCH_THUMBNAIL = 1 << 12;
|
||||
public static final int VIEW_TYPE_SEARCH_SUGGEST = 1 << 13;
|
||||
public static final int VIEW_TYPE_SEARCH_ICON = (1 << 14) | VIEW_TYPE_ICON;
|
||||
public static final int VIEW_TYPE_SEARCH_WIDGET_LIVE = 1 << 15;
|
||||
public static final int VIEW_TYPE_SEARCH_WIDGET_PREVIEW = 1 << 16;
|
||||
|
||||
@@ -58,13 +55,10 @@ public class DeviceSearchAdapterProvider extends SearchAdapterProvider {
|
||||
super(launcher);
|
||||
mAppsView = appsView;
|
||||
|
||||
mViewTypeToLayoutMap.put(VIEW_TYPE_SEARCH_ICON, R.layout.search_result_icon);
|
||||
mViewTypeToLayoutMap.put(VIEW_TYPE_SEARCH_CORPUS_TITLE, R.layout.search_section_title);
|
||||
mViewTypeToLayoutMap.put(VIEW_TYPE_SEARCH_ROW_WITH_BUTTON,
|
||||
R.layout.search_result_play_item);
|
||||
mViewTypeToLayoutMap.put(VIEW_TYPE_SEARCH_ROW, R.layout.search_result_settings_row);
|
||||
mViewTypeToLayoutMap.put(VIEW_TYPE_SEARCH_SLICE, R.layout.search_result_slice);
|
||||
mViewTypeToLayoutMap.put(VIEW_TYPE_SEARCH_ICON, R.layout.search_result_icon);
|
||||
mViewTypeToLayoutMap.put(VIEW_TYPE_SEARCH_ICON_ROW, R.layout.search_result_icon_row);
|
||||
mViewTypeToLayoutMap.put(VIEW_TYPE_SEARCH_SLICE, R.layout.search_result_slice);
|
||||
mViewTypeToLayoutMap.put(VIEW_TYPE_SEARCH_PEOPLE, R.layout.search_result_people_item);
|
||||
mViewTypeToLayoutMap.put(VIEW_TYPE_SEARCH_THUMBNAIL, R.layout.search_result_thumbnail);
|
||||
mViewTypeToLayoutMap.put(VIEW_TYPE_SEARCH_SUGGEST, R.layout.search_result_suggest);
|
||||
@@ -110,12 +104,9 @@ public class DeviceSearchAdapterProvider extends SearchAdapterProvider {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onAdapterItemSelected(AllAppsGridAdapter.AdapterItem focusedItem) {
|
||||
if (focusedItem instanceof SearchTargetHandler) {
|
||||
SearchTargetLegacy searchTarget = ((SearchAdapterItem) focusedItem)
|
||||
.getSearchTargetLegacy();
|
||||
SearchEventTracker.INSTANCE.get(mLauncher).quickSelect(searchTarget);
|
||||
return true;
|
||||
public boolean onAdapterItemSelected(AllAppsGridAdapter.AdapterItem adapterItem, View view) {
|
||||
if (view instanceof SearchTargetHandler) {
|
||||
return ((SearchTargetHandler) view).quickSelect();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -125,25 +116,20 @@ public class DeviceSearchAdapterProvider extends SearchAdapterProvider {
|
||||
* Returns -1 if viewType is not found
|
||||
*/
|
||||
public int getViewTypeForSearchTarget(SearchTarget t) {
|
||||
if (t.getLayoutType().equals(LayoutType.TEXT_HEADER)) {
|
||||
return VIEW_TYPE_SEARCH_CORPUS_TITLE;
|
||||
}
|
||||
switch (t.getResultType()) {
|
||||
case ResultType.APPLICATION:
|
||||
if (t.getLayoutType().equals(LayoutType.ICON_SINGLE_VERTICAL_TEXT)) {
|
||||
return VIEW_TYPE_SEARCH_ICON;
|
||||
}
|
||||
break;
|
||||
case ResultType.SETTING:
|
||||
if (t.getLayoutType().equals(LayoutType.ICON_SLICE)) {
|
||||
return VIEW_TYPE_SEARCH_SLICE;
|
||||
}
|
||||
return VIEW_TYPE_SEARCH_ROW;
|
||||
case ResultType.SHORTCUT:
|
||||
switch (t.getLayoutType()) {
|
||||
case LayoutType.TEXT_HEADER:
|
||||
return VIEW_TYPE_SEARCH_CORPUS_TITLE;
|
||||
case LayoutType.ICON_SINGLE_VERTICAL_TEXT:
|
||||
return VIEW_TYPE_SEARCH_ICON;
|
||||
case LayoutType.ICON_SLICE:
|
||||
return VIEW_TYPE_SEARCH_SLICE;
|
||||
case LayoutType.ICON_DOUBLE_HORIZONTAL_TEXT_BUTTON:
|
||||
case LayoutType.ICON_DOUBLE_HORIZONTAL_TEXT:
|
||||
case LayoutType.ICON_SINGLE_HORIZONTAL_TEXT:
|
||||
return VIEW_TYPE_SEARCH_ICON_ROW;
|
||||
case ResultType.PLAY:
|
||||
return VIEW_TYPE_SEARCH_ROW_WITH_BUTTON;
|
||||
default:
|
||||
return -1;
|
||||
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user