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

Commit 2c4c58a1 authored by Steven Ng's avatar Steven Ng Committed by Android (Google) Code Review
Browse files

Merge "Fix RecyclerViewFastScroller scrolling in widgets full sheet" into sc-v2-dev

parents 5dded93a 0e8a2ce0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/collapse_handle"
            android:layout_marginHorizontal="@dimen/widget_list_horizontal_margin"
            android:paddingHorizontal="@dimen/widget_list_horizontal_margin"
            android:visibility="gone"
            android:clipToPadding="false" />

+2 −1
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@
        android:id="@+id/widgets_view_pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginHorizontal="@dimen/widget_list_horizontal_margin"
        android:clipToPadding="false"
        android:layout_below="@id/collapse_handle"
        android:descendantFocusability="afterDescendants"
@@ -30,12 +29,14 @@
            android:id="@+id/primary_widgets_list_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:paddingHorizontal="@dimen/widget_list_horizontal_margin"
            android:clipToPadding="false" />

        <com.android.launcher3.widget.picker.WidgetsRecyclerView
            android:id="@+id/work_widgets_list_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:paddingHorizontal="@dimen/widget_list_horizontal_margin"
            android:clipToPadding="false" />

    </com.android.launcher3.workprofile.PersonalWorkPagedView>
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@
        android:layout_below="@id/collapse_handle"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginHorizontal="@dimen/widget_list_horizontal_margin"
        android:paddingHorizontal="@dimen/widget_list_horizontal_margin"
        android:clipToPadding="false" />

    <!-- SearchAndRecommendationsView without the tab layout as well -->
+1 −8
Original line number Diff line number Diff line
@@ -113,7 +113,6 @@ public class RecyclerViewFastScroller extends View {
    private boolean mIsThumbDetached;
    private final boolean mCanThumbDetach;
    private boolean mIgnoreDragGesture;
    private boolean mIsRecyclerViewFirstChildInParent = true;
    private long mDownTimeStampMillis;

    // This is the offset from the top of the scrollbar when the user first starts touching.  To
@@ -438,9 +437,7 @@ public class RecyclerViewFastScroller extends View {
            return false;
        }
        getHitRect(sTempRect);
        if (mIsRecyclerViewFirstChildInParent) {
        sTempRect.top += mRv.getScrollBarTop();
        }
        if (outOffset != null) {
            outOffset.set(sTempRect.left, sTempRect.top);
        }
@@ -453,8 +450,4 @@ public class RecyclerViewFastScroller extends View {
        // alpha is so low, it does not matter.
        return false;
    }

    public void setIsRecyclerViewFirstChildInParent(boolean isRecyclerViewFirstChildInParent) {
        mIsRecyclerViewFirstChildInParent = isRecyclerViewFirstChildInParent;
    }
}
+13 −4
Original line number Diff line number Diff line
@@ -198,7 +198,6 @@ public class WidgetsFullSheet extends BaseWidgetSheet
                    .setOnClickListener((View view) -> mViewPager.snapToPage(0));
            findViewById(R.id.tab_work)
                    .setOnClickListener((View view) -> mViewPager.snapToPage(1));
            fastScroller.setIsRecyclerViewFirstChildInParent(false);
            mAdapters.get(AdapterHolder.WORK).setup(findViewById(R.id.work_widgets_list_view));
        } else {
            mViewPager = null;
@@ -334,13 +333,18 @@ public class WidgetsFullSheet extends BaseWidgetSheet
        setContentViewChildHorizontalMargin(mSearchScrollController.mContainer,
                contentHorizontalMarginInPx);
        if (mViewPager == null) {
            setContentViewChildHorizontalMargin(
            setContentViewChildHorizontalPadding(
                    mAdapters.get(AdapterHolder.PRIMARY).mWidgetsRecyclerView,
                    contentHorizontalMarginInPx);
        } else {
            setContentViewChildHorizontalMargin(mViewPager, contentHorizontalMarginInPx);
            setContentViewChildHorizontalPadding(
                    mAdapters.get(AdapterHolder.PRIMARY).mWidgetsRecyclerView,
                    contentHorizontalMarginInPx);
            setContentViewChildHorizontalPadding(
                    mAdapters.get(AdapterHolder.WORK).mWidgetsRecyclerView,
                    contentHorizontalMarginInPx);
        }
        setContentViewChildHorizontalMargin(
        setContentViewChildHorizontalPadding(
                mAdapters.get(AdapterHolder.SEARCH).mWidgetsRecyclerView,
                contentHorizontalMarginInPx);
    }
@@ -352,6 +356,11 @@ public class WidgetsFullSheet extends BaseWidgetSheet
        layoutParams.setMarginEnd(horizontalMarginInPx);
    }

    private static void setContentViewChildHorizontalPadding(View view, int horizontalPaddingInPx) {
        view.setPadding(horizontalPaddingInPx, view.getPaddingTop(), horizontalPaddingInPx,
                view.getPaddingBottom());
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        doMeasure(widthMeasureSpec, heightMeasureSpec);