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

Commit 52f4c16a authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Revert^2 "Removing some unused code from All-Apps"

13ae6784

Change-Id: I06a4c9cc6beba4fc87b4a9375872c68e71e1c5f6
parent 59939e9e
Loading
Loading
Loading
Loading
+9 −18
Original line number Diff line number Diff line
@@ -96,7 +96,6 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
    private static final int MAX_SEARCH_LOOP_COUNT = 20;

    private static final int[] STATE_PRESSED = new int[]{android.R.attr.state_pressed};
    private static final float HIGHLIGHT_SCALE = 1.16f;

    private final PointF mTranslationForReorderBounce = new PointF(0, 0);
    private final PointF mTranslationForReorderPreview = new PointF(0, 0);
@@ -259,6 +258,12 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
        mDotParams.scale = 0f;
        mForceHideDot = false;
        setBackground(null);

        setTag(null);
        if (mIconLoadRequest != null) {
            mIconLoadRequest.cancel();
            mIconLoadRequest = null;
        }
    }

    private void cancelDotScaleAnim() {
@@ -363,8 +368,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
        }
    }

    public void setBubbleTextHolder(
            BubbleTextHolder bubbleTextHolder) {
    public void setBubbleTextHolder(BubbleTextHolder bubbleTextHolder) {
        mBubbleTextHolder = bubbleTextHolder;
    }

@@ -1020,19 +1024,6 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
        getIconBounds(mIconSize, bounds);
    }

    private int getIconSizeForDisplay(int display) {
        DeviceProfile grid = mActivity.getDeviceProfile();
        switch (display) {
            case DISPLAY_ALL_APPS:
                return grid.allAppsIconSizePx;
            case DISPLAY_FOLDER:
                return grid.folderChildIconSizePx;
            case DISPLAY_WORKSPACE:
            default:
                return grid.iconSizePx;
        }
    }

    public void getSourceVisualDragBounds(Rect bounds) {
        getIconBounds(mIconSize, bounds);
    }
@@ -1045,8 +1036,8 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
    }

    private void resetIconScale() {
        if (mIcon instanceof FastBitmapDrawable) {
            ((FastBitmapDrawable) mIcon).resetScale();
        if (mIcon != null) {
            mIcon.resetScale();
        }
    }

+11 −34
Original line number Diff line number Diff line
@@ -45,10 +45,6 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement

    public static final String TAG = "AlphabeticalAppsList";

    private static final int FAST_SCROLL_FRACTION_DISTRIBUTE_BY_ROWS_FRACTION = 0;
    private static final int FAST_SCROLL_FRACTION_DISTRIBUTE_BY_NUM_SECTIONS = 1;

    private final int mFastScrollDistributionMode = FAST_SCROLL_FRACTION_DISTRIBUTE_BY_NUM_SECTIONS;
    private final WorkAdapterProvider mWorkAdapterProvider;

    /**
@@ -334,8 +330,7 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
                }

                // Create an app item
                AdapterItem appItem = AdapterItem.asApp(position++, sectionName, info,
                        appIndex++);
                AdapterItem appItem = AdapterItem.asApp(position++, info);
                if (lastFastScrollerSectionInfo.fastScrollToItem == null) {
                    lastFastScrollerSectionInfo.fastScrollToItem = appItem;
                }
@@ -367,22 +362,6 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
            mNumAppRowsInAdapter = rowIndex + 1;

            // Pre-calculate all the fast scroller fractions
            switch (mFastScrollDistributionMode) {
                case FAST_SCROLL_FRACTION_DISTRIBUTE_BY_ROWS_FRACTION:
                    float rowFraction = 1f / mNumAppRowsInAdapter;
                    for (FastScrollSectionInfo info : mFastScrollerSections) {
                        AdapterItem item = info.fastScrollToItem;
                        if (!BaseAllAppsAdapter.isIconViewType(item.viewType)) {
                            info.touchFraction = 0f;
                            continue;
                        }

                        float subRowFraction =
                                item.rowAppIndex * (rowFraction / mNumAppsPerRowAllApps);
                        info.touchFraction = item.rowIndex * rowFraction + subRowFraction;
                    }
                    break;
                case FAST_SCROLL_FRACTION_DISTRIBUTE_BY_NUM_SECTIONS:
            float perSectionTouchFraction = 1f / mFastScrollerSections.size();
            float cumulativeTouchFraction = 0f;
            for (FastScrollSectionInfo info : mFastScrollerSections) {
@@ -394,8 +373,6 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
                info.touchFraction = cumulativeTouchFraction;
                cumulativeTouchFraction += perSectionTouchFraction;
            }
                    break;
            }
        }
    }
}
+3 −18
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ import com.android.launcher3.BubbleTextView;
import com.android.launcher3.R;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.views.ActivityContext;

import java.util.Arrays;
@@ -94,31 +93,21 @@ public abstract class BaseAllAppsAdapter<T extends Context & ActivityContext> ex
        // The type of this item
        public int viewType;

        // The section name of this item.  Note that there can be multiple items with different
        // sectionNames in the same section
        public String sectionName = null;
        // The row that this item shows up on
        public int rowIndex;
        // The index of this app in the row
        public int rowAppIndex;
        // The associated ItemInfoWithIcon for the item
        public ItemInfoWithIcon itemInfo = null;
        // The index of this app not including sections
        public int appIndex = -1;
        // Search section associated to result
        public DecorationInfo decorationInfo = null;
        public AppInfo itemInfo = null;

        /**
         * Factory method for AppIcon AdapterItem
         */
        public static AdapterItem asApp(int pos, String sectionName, AppInfo appInfo,
                int appIndex) {
        public static AdapterItem asApp(int pos, AppInfo appInfo) {
            AdapterItem item = new AdapterItem();
            item.viewType = VIEW_TYPE_ICON;
            item.position = pos;
            item.sectionName = sectionName;
            item.itemInfo = appInfo;
            item.appIndex = appIndex;
            return item;
        }

@@ -267,11 +256,7 @@ public abstract class BaseAllAppsAdapter<T extends Context & ActivityContext> ex
                AdapterItem adapterItem = mApps.getAdapterItems().get(position);
                BubbleTextView icon = (BubbleTextView) holder.itemView;
                icon.reset();
                if (adapterItem.itemInfo instanceof AppInfo) {
                    icon.applyFromApplicationInfo((AppInfo) adapterItem.itemInfo);
                } else {
                    icon.applyFromItemInfoWithIcon(adapterItem.itemInfo);
                }
                icon.applyFromApplicationInfo(adapterItem.itemInfo);
                break;
            case VIEW_TYPE_EMPTY_SEARCH:
                TextView emptyViewText = (TextView) holder.itemView;
+0 −19
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 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.
 */
package com.android.launcher3.allapps;

public class DecorationInfo {
}
+1 −1
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ public class DefaultAppSearchAlgorithm implements SearchAlgorithm<AdapterItem> {
        for (int i = 0; i < total && resultCount < MAX_RESULTS_COUNT; i++) {
            AppInfo info = apps.get(i);
            if (StringMatcherUtility.matches(queryTextLower, info.title.toString(), matcher)) {
                AdapterItem appItem = AdapterItem.asApp(resultCount, "", info, resultCount);
                AdapterItem appItem = AdapterItem.asApp(resultCount, info);
                result.add(appItem);
                resultCount++;
            }
Loading