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

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

Merge "Fixes for fast-scrollbar when using work profile tabs in all apps." into ub-launcher3-master

parents 7d6b4fa4 2d3157a0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@
        android:id="@+id/fast_scroller_popup"
        style="@style/FastScrollerPopup"
        android:layout_alignParentEnd="true"
        android:layout_alignTop="@+id/apps_list_view"
        android:layout_below="@+id/search_container_all_apps"
        android:layout_marginTop="-5dp"
        android:layout_marginEnd="-45dp" />

@@ -31,7 +31,7 @@
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentEnd="true"
        android:layout_alignParentTop="@+id/apps_list_view"
        android:layout_below="@+id/search_container_all_apps"
        android:layout_marginEnd="-88dp"
        android:layout_marginTop="14dp"
        launcher:canThumbDetach="true" />
+2 −2
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@
        android:id="@+id/fast_scroller_popup"
        style="@style/FastScrollerPopup"
        android:layout_alignParentEnd="true"
        android:layout_alignTop="@+id/apps_list_view"
        android:layout_below="@+id/search_container_all_apps"
        android:layout_marginEnd="@dimen/fastscroll_popup_margin" />

    <com.android.launcher3.views.RecyclerViewFastScroller
@@ -30,7 +30,7 @@
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentEnd="true"
        android:layout_alignTop="@+id/apps_list_view"
        android:layout_below="@+id/search_container_all_apps"
        android:layout_marginEnd="@dimen/fastscroll_end_margin"
        launcher:canThumbDetach="true" />

+2 −2
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@
        android:id="@+id/fast_scroller_popup"
        style="@style/FastScrollerPopup"
        android:layout_alignParentEnd="true"
        android:layout_alignTop="@+id/apps_list_view"
        android:layout_below="@+id/search_container_all_apps"
        android:layout_marginEnd="@dimen/fastscroll_popup_margin" />

    <com.android.launcher3.views.RecyclerViewFastScroller
@@ -30,7 +30,7 @@
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentEnd="true"
        android:layout_alignTop="@+id/apps_list_view"
        android:layout_below="@+id/search_container_all_apps"
        android:layout_marginEnd="@dimen/fastscroll_end_margin"
        launcher:canThumbDetach="true" />

+2 −7
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ public abstract class BaseRecyclerView extends RecyclerView
        ViewGroup parent = (ViewGroup) getParent().getParent();
        mScrollbar = parent.findViewById(R.id.fast_scroller);
        mScrollbar.setRecyclerView(this, parent.findViewById(R.id.fast_scroller_popup));
        onUpdateScrollbar(0);
    }

    /**
@@ -112,7 +113,7 @@ public abstract class BaseRecyclerView extends RecyclerView
     * Returns the height of the fast scroll bar
     */
    public int getScrollbarTrackHeight() {
        return getHeight() - getScrollBarTop() - getPaddingBottom();
        return mScrollbar.getHeight() - getScrollBarTop() - getPaddingBottom();
    }

    /**
@@ -130,12 +131,6 @@ public abstract class BaseRecyclerView extends RecyclerView
        return availableScrollBarHeight;
    }

    @Override
    protected void dispatchDraw(Canvas canvas) {
        onUpdateScrollbar(0);
        super.dispatchDraw(canvas);
    }

    /**
     * Updates the scrollbar thumb offset to match the visible scroll of the recycler view.  It does
     * this by mapping the available scroll area of the recycler view to the available space for the
+3 −12
Original line number Diff line number Diff line
@@ -493,19 +493,9 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource,
        mViewPager.setAdapter(mTabsPagerAdapter = new TabsPagerAdapter());
        mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {

            boolean mVisible = true;

            @Override
            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
                tabs.updateIndicatorPosition(position, positionOffset);
                if (positionOffset == 0 && !mVisible || positionOffset > 0 && mVisible) {
                    mVisible = positionOffset == 0;
                    for (int i = 0; i < mAH.length; i++) {
                        if (mAH[i].recyclerView != null) {
                            mAH[i].recyclerView.getScrollbar().setAlpha(mVisible ? 1 : 0);
                        }
                    }
                }
            }

            @Override
@@ -525,6 +515,7 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource,
            public void onPageScrollStateChanged(int state) {
            }
        });
        mAH[AdapterHolder.MAIN].recyclerView.bindFastScrollbar();

        findViewById(R.id.tab_personal)
                .setOnClickListener((View view) -> mViewPager.setCurrentItem(0));
@@ -572,8 +563,8 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource,
            contentHeight += getResources()
                    .getDimensionPixelSize(R.dimen.all_apps_prediction_row_divider_height);
        }
        RecyclerView mainRV = mAH[AdapterHolder.MAIN].recyclerView;
        RecyclerView workRV = mAH[AdapterHolder.WORK].recyclerView;
        AllAppsRecyclerView mainRV = mAH[AdapterHolder.MAIN].recyclerView;
        AllAppsRecyclerView workRV = mAH[AdapterHolder.WORK].recyclerView;
        mFloatingHeaderHandler.setup(mainRV, workRV, contentHeight);
        mFloatingHeaderHandler.getContentView().setup(mAH[AdapterHolder.MAIN].adapter,
                mComponentToAppMap, mNumPredictedAppsPerRow);
Loading