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

Commit 7b3bdcd6 authored by Hyunyoung Song's avatar Hyunyoung Song Committed by Android (Google) Code Review
Browse files

Merge "Consistent scrolling experience for All apps and widget tray" into ub-launcher3-burnaby

parents 53d7ee42 ec84728b
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/quantum_panel_dark"
            android:scrollbars="vertical"
            android:elevation="15dp"
            android:visibility="gone" />

+0 −1
Original line number Diff line number Diff line
@@ -61,7 +61,6 @@
    <dimen name="all_apps_prediction_icon_top_bottom_padding">12dp</dimen>

    <dimen name="all_apps_fast_scroll_bar_width">4dp</dimen>
    <dimen name="all_apps_fast_scroll_bar_min_height">64dp</dimen>
    <dimen name="all_apps_fast_scroll_scrubber_touch_inset">-16dp</dimen>
    <dimen name="all_apps_fast_scroll_popup_size">72dp</dimen>
    <dimen name="all_apps_fast_scroll_text_size">48dp</dimen>
+1 −6
Original line number Diff line number Diff line
@@ -86,10 +86,8 @@ public class BaseRecyclerView extends RecyclerView

    private int mDownX;
    private int mDownY;
    private int mLastX;
    private int mLastY;
    private int mScrollbarWidth;
    private int mScrollbarMinHeight;
    private int mScrollbarInset;
    private Rect mBackgroundPadding = new Rect();

@@ -121,8 +119,6 @@ public class BaseRecyclerView extends RecyclerView
        mFastScrollTextPaint.setTextSize(res.getDimensionPixelSize(
                R.dimen.all_apps_fast_scroll_text_size));
        mScrollbarWidth = res.getDimensionPixelSize(R.dimen.all_apps_fast_scroll_bar_width);
        mScrollbarMinHeight =
                res.getDimensionPixelSize(R.dimen.all_apps_fast_scroll_bar_min_height);
        mScrollbarInset =
                res.getDimensionPixelSize(R.dimen.all_apps_fast_scroll_scrubber_touch_inset);
        setFastScrollerAlpha(mFastScrollAlpha);
@@ -173,7 +169,7 @@ public class BaseRecyclerView extends RecyclerView
        switch (action) {
            case MotionEvent.ACTION_DOWN:
                // Keep track of the down positions
                mDownX = mLastX = x;
                mDownX = x;
                mDownY = mLastY = y;
                if (shouldStopScroll(ev)) {
                    stopScroll();
@@ -188,7 +184,6 @@ public class BaseRecyclerView extends RecyclerView
                    animateFastScrollerVisibility(true);
                }
                if (mDraggingFastScroller) {
                    mLastX = x;
                    mLastY = y;

                    // Scroll to the right position, and update the section name
+10 −3
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.launcher3.model;

import android.content.ComponentName;
import android.graphics.Bitmap;

import com.android.launcher3.ItemInfo;
@@ -27,7 +26,6 @@ import java.util.Arrays;
 * Represents a {@link Package} in the widget tray section.
 */
public class PackageItemInfo extends ItemInfo {
    private static final String TAG = "PackageInfo";

    /**
     * A bitmap version of the application icon.
@@ -35,12 +33,21 @@ public class PackageItemInfo extends ItemInfo {
    public Bitmap iconBitmap;

    /**
     * Indicates whether we're using a low res icon
     * Indicates whether we're using a low res icon.
     */
    public boolean usingLowResIcon;

    /**
     * Package name of the {@link ItemInfo}.
     */
    public String packageName;

    /**
     * Character that is used as a section name for the {@link ItemInfo#title}.
     * (e.g., "G" will be stored if title is "Google")
     */
    public String titleSectionName;

    int flags = 0;

    PackageItemInfo(String packageName) {
+7 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherAppWidgetProviderInfo;

import com.android.launcher3.Utilities;
import com.android.launcher3.compat.AlphabeticIndexCompat;
import com.android.launcher3.compat.UserHandleCompat;

import java.util.ArrayList;
@@ -39,11 +40,13 @@ public class WidgetsModel {
    private final Comparator mWidgetAndShortcutNameComparator;
    private final Comparator mAppNameComparator;
    private final IconCache mIconCache;
    private AlphabeticIndexCompat mIndexer;

    public WidgetsModel(Context context) {
        mWidgetAndShortcutNameComparator = new WidgetsAndShortcutNameComparator(context);
        mAppNameComparator = (new AppNameComparator(context)).getAppInfoComparator();
        mIconCache = LauncherAppState.getInstance().getIconCache();
        mIndexer = new AlphabeticIndexCompat(context);
    }

    private WidgetsModel(WidgetsModel model) {
@@ -62,6 +65,9 @@ public class WidgetsModel {

    // Access methods that may be deleted if the private fields are made package-private.
    public PackageItemInfo getPackageItemInfo(int pos) {
        if (pos >= mPackageItemInfos.size() || pos < 0) {
            return null;
        }
        return mPackageItemInfos.get(pos);
    }

@@ -112,6 +118,7 @@ public class WidgetsModel {
                pInfo = new PackageItemInfo(packageName);
                mIconCache.getTitleAndIconForApp(packageName, UserHandleCompat.myUserHandle(),
                        true /* userLowResIcon */, pInfo);
                pInfo.titleSectionName = mIndexer.computeSectionName(pInfo.title);
                mWidgetsList.put(pInfo, widgetsShortcutsList);
                tmpPackageItemInfos.put(packageName,  pInfo);
                mPackageItemInfos.add(pInfo);
Loading