From b1d222e9a76cc733cead3343a4b7c1e39daa190c Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Tue, 30 Jan 2018 20:52:27 -0800 Subject: [PATCH] Removing support for app prediction from Launcher3 Derivative projects can extend the FloatingHeader to add support to custom content in all-apps screen. Change-Id: I4e29221a72e5a077a756713a6774cda7ecde8f1b --- res/values/attrs.xml | 2 - res/values/dimens.xml | 1 - res/xml/device_profiles.xml | 11 -- .../launcher3/InvariantDeviceProfile.java | 13 +- .../allapps/AllAppsContainerView.java | 77 +------- .../launcher3/allapps/AllAppsGridAdapter.java | 71 ++------ .../allapps/AllAppsRecyclerView.java | 32 +--- .../launcher3/allapps/AllAppsStore.java | 5 - .../allapps/AlphabeticalAppsList.java | 166 +----------------- .../android/launcher3/config/BaseFlags.java | 2 - .../launcher3/util/ComponentKeyMapper.java | 48 ----- 11 files changed, 29 insertions(+), 399 deletions(-) delete mode 100644 src/com/android/launcher3/util/ComponentKeyMapper.java diff --git a/res/values/attrs.xml b/res/values/attrs.xml index 2033d4639d..1351dfa847 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -101,8 +101,6 @@ - - diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 2aff936183..1f468445c9 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -87,7 +87,6 @@ 50dp 2dp 36dp - 17dp 16dp 20dp 12dp diff --git a/res/xml/device_profiles.xml b/res/xml/device_profiles.xml index 30c1c54c0b..a34f225155 100644 --- a/res/xml/device_profiles.xml +++ b/res/xml/device_profiles.xml @@ -25,7 +25,6 @@ launcher:numColumns="3" launcher:numFolderRows="2" launcher:numFolderColumns="3" - launcher:minAllAppsPredictionColumns="3" launcher:iconSize="48" launcher:iconTextSize="13.0" launcher:numHotseatIcons="3" @@ -40,7 +39,6 @@ launcher:numColumns="3" launcher:numFolderRows="3" launcher:numFolderColumns="3" - launcher:minAllAppsPredictionColumns="3" launcher:iconSize="48" launcher:iconTextSize="13.0" launcher:numHotseatIcons="3" @@ -55,7 +53,6 @@ launcher:numColumns="4" launcher:numFolderRows="3" launcher:numFolderColumns="4" - launcher:minAllAppsPredictionColumns="4" launcher:iconSize="48" launcher:iconTextSize="13.0" launcher:numHotseatIcons="5" @@ -70,7 +67,6 @@ launcher:numColumns="4" launcher:numFolderRows="3" launcher:numFolderColumns="4" - launcher:minAllAppsPredictionColumns="4" launcher:iconSize="48" launcher:iconTextSize="13.0" launcher:numHotseatIcons="5" @@ -85,7 +81,6 @@ launcher:numColumns="4" launcher:numFolderRows="4" launcher:numFolderColumns="4" - launcher:minAllAppsPredictionColumns="4" launcher:iconSize="48" launcher:iconTextSize="13.0" launcher:numHotseatIcons="5" @@ -100,7 +95,6 @@ launcher:numColumns="4" launcher:numFolderRows="4" launcher:numFolderColumns="4" - launcher:minAllAppsPredictionColumns="4" launcher:iconSize="54" launcher:iconTextSize="13.0" launcher:numHotseatIcons="5" @@ -115,7 +109,6 @@ launcher:numColumns="4" launcher:numFolderRows="4" launcher:numFolderColumns="4" - launcher:minAllAppsPredictionColumns="4" launcher:iconSize="54" launcher:iconTextSize="13.0" launcher:numHotseatIcons="5" @@ -130,7 +123,6 @@ launcher:numColumns="5" launcher:numFolderRows="4" launcher:numFolderColumns="4" - launcher:minAllAppsPredictionColumns="4" launcher:iconSize="56" launcher:iconTextSize="14.4" launcher:numHotseatIcons="5" @@ -145,7 +137,6 @@ launcher:numColumns="6" launcher:numFolderRows="4" launcher:numFolderColumns="5" - launcher:minAllAppsPredictionColumns="4" launcher:iconSize="64" launcher:iconTextSize="14.4" launcher:numHotseatIcons="7" @@ -160,7 +151,6 @@ launcher:numColumns="6" launcher:numFolderRows="4" launcher:numFolderColumns="5" - launcher:minAllAppsPredictionColumns="4" launcher:iconSize="76" launcher:iconTextSize="14.4" launcher:numHotseatIcons="7" @@ -175,7 +165,6 @@ launcher:numColumns="7" launcher:numFolderRows="6" launcher:numFolderColumns="6" - launcher:minAllAppsPredictionColumns="4" launcher:iconSize="100" launcher:iconTextSize="20.0" launcher:numHotseatIcons="7" diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java index 7a431986da..246fa74b9c 100644 --- a/src/com/android/launcher3/InvariantDeviceProfile.java +++ b/src/com/android/launcher3/InvariantDeviceProfile.java @@ -64,12 +64,6 @@ public class InvariantDeviceProfile { public int numRows; public int numColumns; - /** - * The minimum number of predicted apps in all apps. - */ - @Deprecated - int minAllAppsPredictionColumns; - /** * Number of icons per row and column in the folder. */ @@ -99,12 +93,12 @@ public class InvariantDeviceProfile { public InvariantDeviceProfile(InvariantDeviceProfile p) { this(p.name, p.minWidthDps, p.minHeightDps, p.numRows, p.numColumns, - p.numFolderRows, p.numFolderColumns, p.minAllAppsPredictionColumns, + p.numFolderRows, p.numFolderColumns, p.iconSize, p.landscapeIconSize, p.iconTextSize, p.numHotseatIcons, p.defaultLayoutId, p.demoModeLayoutId); } - InvariantDeviceProfile(String n, float w, float h, int r, int c, int fr, int fc, int maapc, + InvariantDeviceProfile(String n, float w, float h, int r, int c, int fr, int fc, float is, float lis, float its, int hs, int dlId, int dmlId) { name = n; minWidthDps = w; @@ -113,7 +107,6 @@ public class InvariantDeviceProfile { numColumns = c; numFolderRows = fr; numFolderColumns = fc; - minAllAppsPredictionColumns = maapc; iconSize = is; landscapeIconSize = lis; iconTextSize = its; @@ -150,7 +143,6 @@ public class InvariantDeviceProfile { demoModeLayoutId = closestProfile.demoModeLayoutId; numFolderRows = closestProfile.numFolderRows; numFolderColumns = closestProfile.numFolderColumns; - minAllAppsPredictionColumns = closestProfile.minAllAppsPredictionColumns; iconSize = interpolatedDeviceProfileOut.iconSize; landscapeIconSize = interpolatedDeviceProfileOut.landscapeIconSize; @@ -207,7 +199,6 @@ public class InvariantDeviceProfile { numColumns, a.getInt(R.styleable.InvariantDeviceProfile_numFolderRows, numRows), a.getInt(R.styleable.InvariantDeviceProfile_numFolderColumns, numColumns), - a.getInt(R.styleable.InvariantDeviceProfile_minAllAppsPredictionColumns, numColumns), iconSize, a.getFloat(R.styleable.InvariantDeviceProfile_landscapeIconSize, iconSize), a.getFloat(R.styleable.InvariantDeviceProfile_iconTextSize, 0), diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index dc3de18d58..4b08bb278e 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -55,7 +55,6 @@ import com.android.launcher3.dragndrop.DragController; import com.android.launcher3.dragndrop.DragOptions; import com.android.launcher3.keyboard.FocusedItemDecorator; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; -import com.android.launcher3.util.ComponentKeyMapper; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.PackageUserKey; import com.android.launcher3.views.BottomUserEducationView; @@ -84,11 +83,7 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, private SpannableStringBuilder mSearchQueryBuilder = null; - private int mNumAppsPerRow; - private int mNumPredictedAppsPerRow; - private boolean mUsingTabs; - private boolean mHasPredictions = false; private boolean mSearchModeWhileUsingTabs = false; public AllAppsContainerView(Context context) { @@ -236,21 +231,6 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, return mSearchUiManager; } - @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - DeviceProfile grid = mLauncher.getDeviceProfile(); - - if (mNumAppsPerRow != grid.inv.numColumns || - mNumPredictedAppsPerRow != grid.inv.numColumns) { - mNumAppsPerRow = grid.inv.numColumns; - mNumPredictedAppsPerRow = grid.inv.numColumns; - for (int i = 0; i < mAH.length; i++) { - mAH[i].applyNumsPerRow(); - } - } - super.onMeasure(widthMeasureSpec, heightMeasureSpec); - } - @Override public boolean dispatchKeyEvent(KeyEvent event) { mSearchUiManager.preDispatchKeyEvent(event); @@ -357,17 +337,12 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, mAH[AdapterHolder.MAIN].setup(mViewPager.getChildAt(0), mPersonalMatcher); mAH[AdapterHolder.WORK].setup(mViewPager.getChildAt(1), mWorkMatcher); setupWorkProfileTabs(); - setupHeader(); } else { mTabsPagerAdapter = null; mAH[AdapterHolder.MAIN].setup(findViewById(R.id.apps_list_view), null); mAH[AdapterHolder.WORK].recyclerView = null; - if (FeatureFlags.ALL_APPS_PREDICTION_ROW_VIEW) { - setupHeader(); - } else { - mHeader.setVisibility(View.GONE); - } } + setupHeader(); mAllAppsStore.registerIconContainer(mAH[AdapterHolder.MAIN].recyclerView); mAllAppsStore.registerIconContainer(mAH[AdapterHolder.WORK].recyclerView); @@ -444,46 +419,21 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, .setOnClickListener((View view) -> mViewPager.setCurrentItem(1)); } - public void setPredictedApps(List> apps) { - mAH[AdapterHolder.MAIN].appsList.setPredictedApps(apps); - boolean hasPredictions = !apps.isEmpty(); - if (mHasPredictions != hasPredictions) { - mHasPredictions = hasPredictions; - if (FeatureFlags.ALL_APPS_PREDICTION_ROW_VIEW) { - setupHeader(); - } - } - } - - public AppInfo findApp(ComponentKeyMapper mapper) { - return mAllAppsStore.getApp(mapper); - } - public AlphabeticalAppsList getApps() { return mAH[AdapterHolder.MAIN].appsList; } - public boolean isUsingTabs() { - return mUsingTabs; - } - public FloatingHeaderView getFloatingHeaderView() { return mHeader; } public void setupHeader() { - if (mHeader == null) { - return; - } mHeader.setVisibility(View.VISIBLE); mHeader.setup(mAH, mAH[AllAppsContainerView.AdapterHolder.WORK].recyclerView == null); int padding = mHeader.getMaxTranslation(); - if (mHasPredictions && !mUsingTabs) { - padding += mHeader.getPaddingTop() + mHeader.getPaddingBottom(); - } for (int i = 0; i < mAH.length; i++) { - mAH[i].paddingTopForTabs = padding; + mAH[i].padding.top = padding; mAH[i].applyPadding(); } } @@ -513,13 +463,6 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, } } - public void setRecyclerViewPaddingTop(int top) { - for (int i = 0; i < mAH.length; i++) { - mAH[i].padding.top = top; - mAH[i].applyPadding(); - } - } - public void setRecyclerViewVerticalFadingEdgeEnabled(boolean enabled) { for (int i = 0; i < mAH.length; i++) { mAH[i].applyVerticalFadingEdgeEnabled(enabled); @@ -551,7 +494,6 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, final SpringAnimationHandler animationHandler; final AlphabeticalAppsList appsList; final Rect padding = new Rect(); - int paddingTopForTabs; AllAppsRecyclerView recyclerView; boolean verticalFadingEdge; @@ -582,24 +524,11 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, adapter.setIconFocusListener(focusedItemDecorator.getFocusListener()); applyVerticalFadingEdgeEnabled(verticalFadingEdge); applyPadding(); - applyNumsPerRow(); } void applyPadding() { if (recyclerView != null) { - int paddingTop = mUsingTabs || FeatureFlags.ALL_APPS_PREDICTION_ROW_VIEW - ? paddingTopForTabs : padding.top; - recyclerView.setPadding(padding.left, paddingTop, padding.right, padding.bottom); - } - } - - void applyNumsPerRow() { - if (mNumAppsPerRow > 0) { - if (recyclerView != null) { - recyclerView.setNumAppsPerRow(mLauncher.getDeviceProfile(), mNumAppsPerRow); - } - adapter.setNumAppsPerRow(mNumAppsPerRow); - appsList.setNumAppsPerRow(mNumAppsPerRow, mNumPredictedAppsPerRow); + recyclerView.setPadding(padding.left, padding.top, padding.right, padding.bottom); } } diff --git a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java index 2103106f2b..a61521c769 100644 --- a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java +++ b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java @@ -56,29 +56,22 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter items = mApps.getAdapterItems(); - AlphabeticalAppsList.AdapterItem item = items.get(position); - if (item.viewType == AllAppsGridAdapter.VIEW_TYPE_PREDICTION_ICON) { - targetParent.containerType = ContainerType.PREDICTION; - target.predictedRank = item.rowAppIndex; - return; - } - } - } targetParent.containerType = ContainerType.ALLAPPS; } } diff --git a/src/com/android/launcher3/allapps/AllAppsStore.java b/src/com/android/launcher3/allapps/AllAppsStore.java index 17f1c89102..846b6a99c8 100644 --- a/src/com/android/launcher3/allapps/AllAppsStore.java +++ b/src/com/android/launcher3/allapps/AllAppsStore.java @@ -21,7 +21,6 @@ import android.view.ViewGroup; import com.android.launcher3.AppInfo; import com.android.launcher3.BubbleTextView; import com.android.launcher3.util.ComponentKey; -import com.android.launcher3.util.ComponentKeyMapper; import java.util.ArrayList; import java.util.Collection; @@ -53,10 +52,6 @@ public class AllAppsStore { return mComponentToAppMap.get(key); } - public AppInfo getApp(ComponentKeyMapper mapper) { - return mapper.getItem(mComponentToAppMap); - } - /** * Adds or updates existing apps in the list */ diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java index 29b32b06c8..434918d2a7 100644 --- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java +++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java @@ -17,19 +17,13 @@ package com.android.launcher3.allapps; import android.content.Context; import android.content.pm.PackageManager; -import android.os.Process; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.util.Log; import com.android.launcher3.AppInfo; import com.android.launcher3.Launcher; import com.android.launcher3.Utilities; import com.android.launcher3.compat.AlphabeticIndexCompat; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.shortcuts.DeepShortcutManager; import com.android.launcher3.util.ComponentKey; -import com.android.launcher3.util.ComponentKeyMapper; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.LabelComparator; @@ -47,8 +41,6 @@ import java.util.TreeMap; public class AlphabeticalAppsList implements AllAppsStore.OnUpdateListener { public static final String TAG = "AlphabeticalAppsList"; - private static final boolean DEBUG = false; - private static final boolean DEBUG_PREDICTIONS = false; private static final int FAST_SCROLL_FRACTION_DISTRIBUTE_BY_ROWS_FRACTION = 0; private static final int FAST_SCROLL_FRACTION_DISTRIBUTE_BY_NUM_SECTIONS = 1; @@ -95,13 +87,6 @@ public class AlphabeticalAppsList implements AllAppsStore.OnUpdateListener { // The index of this app not including sections public int appIndex = -1; - public static AdapterItem asPredictedApp(int pos, String sectionName, AppInfo appInfo, - int appIndex) { - AdapterItem item = asApp(pos, sectionName, appInfo, appIndex); - item.viewType = AllAppsGridAdapter.VIEW_TYPE_PREDICTION_ICON; - return item; - } - public static AdapterItem asApp(int pos, String sectionName, AppInfo appInfo, int appIndex) { AdapterItem item = new AdapterItem(); @@ -120,13 +105,6 @@ public class AlphabeticalAppsList implements AllAppsStore.OnUpdateListener { return item; } - public static AdapterItem asPredictionDivider(int pos) { - AdapterItem item = new AdapterItem(); - item.viewType = AllAppsGridAdapter.VIEW_TYPE_PREDICTION_DIVIDER; - item.position = pos; - return item; - } - public static AdapterItem asAllAppsDivider(int pos) { AdapterItem item = new AdapterItem(); item.viewType = AllAppsGridAdapter.VIEW_TYPE_ALL_APPS_DIVIDER; @@ -151,7 +129,7 @@ public class AlphabeticalAppsList implements AllAppsStore.OnUpdateListener { private final Launcher mLauncher; - // The set of apps from the system not including predictions + // The set of apps from the system private final List mApps = new ArrayList<>(); private final AllAppsStore mAllAppsStore; @@ -161,10 +139,6 @@ public class AlphabeticalAppsList implements AllAppsStore.OnUpdateListener { private final ArrayList mAdapterItems = new ArrayList<>(); // The set of sections that we allow fast-scrolling to (includes non-merged sections) private final List mFastScrollerSections = new ArrayList<>(); - // The set of predicted app component names - private final List> mPredictedAppComponents = new ArrayList<>(); - // The set of predicted apps resolved from the component names and the current set of apps - private final List mPredictedApps = new ArrayList<>(); // Is it the work profile app list. private final boolean mIsWork; @@ -174,8 +148,7 @@ public class AlphabeticalAppsList implements AllAppsStore.OnUpdateListener { private AllAppsGridAdapter mAdapter; private AlphabeticIndexCompat mIndexer; private AppInfoComparator mAppNameComparator; - private int mNumAppsPerRow; - private int mNumPredictedAppsPerRow; + private final int mNumAppsPerRow; private int mNumAppRowsInAdapter; private ItemInfoMatcher mItemFilter; @@ -185,6 +158,7 @@ public class AlphabeticalAppsList implements AllAppsStore.OnUpdateListener { mIndexer = new AlphabeticIndexCompat(context); mAppNameComparator = new AppInfoComparator(context); mIsWork = isWork; + mNumAppsPerRow = mLauncher.getDeviceProfile().inv.numColumns; mAllAppsStore.addUpdateListener(this); } @@ -193,16 +167,6 @@ public class AlphabeticalAppsList implements AllAppsStore.OnUpdateListener { onAppsUpdated(); } - /** - * Sets the number of apps per row. - */ - public void setNumAppsPerRow(int numAppsPerRow, int numPredictedAppsPerRow) { - mNumAppsPerRow = numAppsPerRow; - mNumPredictedAppsPerRow = numPredictedAppsPerRow; - - updateAdapterItems(); - } - /** * Sets the adapter to notify when this dataset changes. */ @@ -217,13 +181,6 @@ public class AlphabeticalAppsList implements AllAppsStore.OnUpdateListener { return mApps; } - /** - * Returns the predicted apps. - */ - public List getPredictedApps() { - return mPredictedApps; - } - /** * Returns fast scroller sections of all the current filtered applications. */ @@ -239,7 +196,7 @@ public class AlphabeticalAppsList implements AllAppsStore.OnUpdateListener { } /** - * Returns the number of rows of applications (not including predictions) + * Returns the number of rows of applications */ public int getNumAppRows() { return mNumAppRowsInAdapter; @@ -279,80 +236,6 @@ public class AlphabeticalAppsList implements AllAppsStore.OnUpdateListener { return false; } - private List processPredictedAppComponents(List> components) { - if (mAllAppsStore.getApps().isEmpty()) { - // Apps have not been bound yet. - return Collections.emptyList(); - } - - List predictedApps = new ArrayList<>(); - for (ComponentKeyMapper mapper : components) { - AppInfo info = mAllAppsStore.getApp(mapper); - if (info != null) { - predictedApps.add(info); - } else { - if (FeatureFlags.IS_DOGFOOD_BUILD) { - Log.e(TAG, "Predicted app not found: " + mapper); - } - } - // Stop at the number of predicted apps - if (predictedApps.size() == mNumPredictedAppsPerRow) { - break; - } - } - return predictedApps; - } - - /** - * Sets the current set of predicted apps. - * - * This can be called before we get the full set of applications, we should merge the results - * only in onAppsUpdated() which is idempotent. - * - * If the number of predicted apps is the same as the previous list of predicted apps, - * we can optimize by swapping them in place. - */ - public void setPredictedApps(List> apps) { - mPredictedAppComponents.clear(); - mPredictedAppComponents.addAll(apps); - - List newPredictedApps = processPredictedAppComponents(apps); - // We only need to do work if any of the visible predicted apps have changed. - if (!newPredictedApps.equals(mPredictedApps)) { - if (newPredictedApps.size() == mPredictedApps.size()) { - swapInNewPredictedApps(newPredictedApps); - } else { - // We need to update the appIndex of all the items. - onAppsUpdated(); - } - } - } - - /** - * Swaps out the old predicted apps with the new predicted apps, in place. This optimization - * allows us to skip an entire relayout that would otherwise be called by notifyDataSetChanged. - * - * Note: This should only be called if the # of predicted apps is the same. - * This method assumes that predicted apps are the first items in the adapter. - */ - private void swapInNewPredictedApps(List apps) { - mPredictedApps.clear(); - mPredictedApps.addAll(apps); - - int size = apps.size(); - for (int i = 0; i < size; ++i) { - AppInfo info = apps.get(i); - AdapterItem orgItem = mAdapterItems.get(i); - AdapterItem newItem = AdapterItem.asPredictedApp(orgItem.position, "", info, - orgItem.appIndex); - newItem.rowAppIndex = orgItem.rowAppIndex; - - mAdapterItems.set(i, newItem); - mFilteredApps.set(i, info); - mAdapter.notifyItemChanged(i); - } - } - /** * Updates internals when the set of apps are updated. */ @@ -433,47 +316,6 @@ public class AlphabeticalAppsList implements AllAppsStore.OnUpdateListener { mFastScrollerSections.clear(); mAdapterItems.clear(); - if (!FeatureFlags.ALL_APPS_PREDICTION_ROW_VIEW) { - if (DEBUG_PREDICTIONS) { - if (mPredictedAppComponents.isEmpty() && !mApps.isEmpty()) { - mPredictedAppComponents.add(new ComponentKeyMapper(new ComponentKey(mApps.get(0).componentName, - Process.myUserHandle()))); - mPredictedAppComponents.add(new ComponentKeyMapper(new ComponentKey(mApps.get(0).componentName, - Process.myUserHandle()))); - mPredictedAppComponents.add(new ComponentKeyMapper(new ComponentKey(mApps.get(0).componentName, - Process.myUserHandle()))); - mPredictedAppComponents.add(new ComponentKeyMapper(new ComponentKey(mApps.get(0).componentName, - Process.myUserHandle()))); - } - } - - // Process the predicted app components - mPredictedApps.clear(); - if (mPredictedAppComponents != null && !mPredictedAppComponents.isEmpty() && !hasFilter()) { - mPredictedApps.addAll(processPredictedAppComponents(mPredictedAppComponents)); - - if (!mPredictedApps.isEmpty()) { - // Add a section for the predictions - lastFastScrollerSectionInfo = new FastScrollSectionInfo(""); - mFastScrollerSections.add(lastFastScrollerSectionInfo); - - // Add the predicted app items - for (AppInfo info : mPredictedApps) { - AdapterItem appItem = AdapterItem.asPredictedApp(position++, "", info, - appIndex++); - if (lastFastScrollerSectionInfo.fastScrollToItem == null) { - lastFastScrollerSectionInfo.fastScrollToItem = appItem; - } - mAdapterItems.add(appItem); - mFilteredApps.add(info); - } - - mAdapterItems.add(AdapterItem.asPredictionDivider(position++)); - } - } - - } - // Recreate the filtered and sectioned apps (for convenience for the grid layout) from the // ordered set of sections for (AppInfo info : getFiltersAppInfos()) { diff --git a/src/com/android/launcher3/config/BaseFlags.java b/src/com/android/launcher3/config/BaseFlags.java index 059b04e27a..e494beacd2 100644 --- a/src/com/android/launcher3/config/BaseFlags.java +++ b/src/com/android/launcher3/config/BaseFlags.java @@ -53,8 +53,6 @@ abstract class BaseFlags { // When enabled shows a work profile tab in all apps public static final boolean ALL_APPS_TABS_ENABLED = true; - // When enabled prediction row is rendered as it's own custom view - public static final boolean ALL_APPS_PREDICTION_ROW_VIEW = true; public static final boolean ENABLE_TWO_SWIPE_TARGETS = true; } diff --git a/src/com/android/launcher3/util/ComponentKeyMapper.java b/src/com/android/launcher3/util/ComponentKeyMapper.java deleted file mode 100644 index a7f0d764e4..0000000000 --- a/src/com/android/launcher3/util/ComponentKeyMapper.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.android.launcher3.util; - -/** - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import android.support.annotation.Nullable; - -import java.util.Map; - -public class ComponentKeyMapper { - - protected final ComponentKey mComponentKey; - - public ComponentKeyMapper(ComponentKey key) { - this.mComponentKey = key; - } - - public @Nullable T getItem(Map map) { - return map.get(mComponentKey); - } - - public String getPackage() { - return mComponentKey.componentName.getPackageName(); - } - - public String getComponentClass() { - return mComponentKey.componentName.getClassName(); - } - - @Override - public String toString() { - return mComponentKey.toString(); - } - -}