Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ad5131d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Removing support for app prediction from Launcher3" into ub-launcher3-master

parents 2eb7f0a3 b1d222e9
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -101,8 +101,6 @@
        <!-- numFolderRows & numFolderColumns defaults to numRows & numColumns, if not specified -->
        <attr name="numFolderRows" format="integer" />
        <attr name="numFolderColumns" format="integer" />
        <!-- minAllAppsPredictionColumns defaults to numColumns, if not specified -->
        <attr name="minAllAppsPredictionColumns" format="integer" />
        <!-- numHotseatIcons defaults to numColumns, if not specified -->
        <attr name="numHotseatIcons" format="integer" />

+0 −1
Original line number Diff line number Diff line
@@ -87,7 +87,6 @@
    <dimen name="all_apps_header_tab_height">50dp</dimen>
    <dimen name="all_apps_tabs_indicator_height">2dp</dimen>
    <dimen name="all_apps_header_top_padding">36dp</dimen>
    <dimen name="all_apps_prediction_row_divider_height">17dp</dimen>
    <dimen name="all_apps_work_profile_tab_footer_top_padding">16dp</dimen>
    <dimen name="all_apps_work_profile_tab_footer_bottom_padding">20dp</dimen>
    <dimen name="all_apps_tabs_side_padding">12dp</dimen>
+0 −11
Original line number Diff line number Diff line
@@ -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"
+2 −11
Original line number Diff line number Diff line
@@ -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),
+3 −74
Original line number Diff line number Diff line
@@ -58,7 +58,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;
@@ -87,11 +86,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) {
@@ -252,21 +247,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);
@@ -378,17 +358,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);
@@ -465,46 +440,21 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource,
                .setOnClickListener((View view) -> mViewPager.setCurrentItem(1));
    }

    public void setPredictedApps(List<ComponentKeyMapper<AppInfo>> 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<AppInfo> 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();
        }
    }
@@ -534,13 +484,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);
@@ -572,7 +515,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;

@@ -603,24 +545,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);
            }
        }

Loading