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

Commit dc19a07a authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Adding support for top padding in BaseRecyclerView. The scrollbar is

drawn below the top padding.
Also adding callback for getting the all-apps vertical pull range
so that it can be controlled by SearchUiManager

Bug: 37616877
Change-Id: Ib4642073f3e92f6676caede3bddd652fda89c86f
parent b0b30d23
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -48,11 +48,6 @@
    <dimen name="resize_frame_background_padding">24dp</dimen>

<!-- Container -->
    <!-- Note: This needs to match the fixed insets for the search box. -->
    <dimen name="container_bounds_inset">8dp</dimen>
    <!-- Notes: container_bounds_inset - quantum_panel_outer_padding -->
    <dimen name="container_bounds_minus_quantum_panel_padding_inset">4dp</dimen>

    <dimen name="container_fastscroll_thumb_min_width">5dp</dimen>
    <dimen name="container_fastscroll_thumb_max_width">9dp</dimen>
    <dimen name="container_fastscroll_popup_margin">18dp</dimen>
@@ -65,9 +60,6 @@
    <dimen name="all_apps_button_scale_down">0dp</dimen>
    <dimen name="all_apps_search_bar_field_height">48dp</dimen>
    <dimen name="all_apps_search_bar_height">60dp</dimen>
    <dimen name="all_apps_search_bar_icon_margin_right">4dp</dimen>
    <dimen name="all_apps_search_bar_icon_margin_top">1dp</dimen>
    <dimen name="all_apps_list_bottom_padding">8dp</dimen>
    <dimen name="all_apps_empty_search_message_top_offset">40dp</dimen>
    <dimen name="all_apps_empty_search_bg_top_offset">144dp</dimen>
    <dimen name="all_apps_background_canvas_width">700dp</dimen>
@@ -146,7 +138,7 @@
    <dimen name="blur_size_medium_outline">2dp</dimen>
    <dimen name="blur_size_click_shadow">4dp</dimen>
    <dimen name="click_shadow_high_shift">2dp</dimen>
    <dimen name="drawable_shadow_size">2dp</dimen>
    <dimen name="drawable_shadow_size">4dp</dimen>

<!-- Pending widget -->
    <dimen name="pending_widget_min_padding">8dp</dimen>
+3 −1
Original line number Diff line number Diff line
@@ -113,6 +113,7 @@ public abstract class BaseRecyclerView extends RecyclerView
     * it is already showing).
     */
    private boolean handleTouchEvent(MotionEvent ev) {
        ev.offsetLocation(0, -getPaddingTop());
        int action = ev.getAction();
        int x = (int) ev.getX();
        int y = (int) ev.getY();
@@ -136,6 +137,7 @@ public abstract class BaseRecyclerView extends RecyclerView
                mScrollbar.handleTouchEvent(ev, mDownX, mDownY, mLastY);
                break;
        }
        ev.offsetLocation(0, getPaddingTop());
        return mScrollbar.isDraggingThumb();
    }

@@ -162,7 +164,7 @@ public abstract class BaseRecyclerView extends RecyclerView
     * Returns the height of the fast scroll bar
     */
    protected int getScrollbarTrackHeight() {
        return getHeight();
        return getHeight() - getPaddingTop() - getPaddingBottom();
    }

    /**
+4 −1
Original line number Diff line number Diff line
@@ -136,6 +136,7 @@ public class BaseRecyclerViewFastScrollBar {
        mTmpRect.set(drawLeft, mThumbOffsetY, drawLeft + mMaxWidth, mThumbOffsetY + mThumbHeight);
        mThumbOffsetY = y;
        mTmpRect.union(drawLeft, mThumbOffsetY, drawLeft + mMaxWidth, mThumbOffsetY + mThumbHeight);
        mTmpRect.offset(0, mRv.getPaddingTop());
        mRv.invalidate(mTmpRect);
    }

@@ -148,8 +149,9 @@ public class BaseRecyclerViewFastScrollBar {
            return;
        }
        int left = getDrawLeft();
        int top = mRv.getPaddingTop();
        // Invalidate the whole scroll bar area.
        mRv.invalidate(left, 0, left + mMaxWidth, mRv.getScrollbarTrackHeight());
        mRv.invalidate(left, top, left + mMaxWidth, top + mRv.getScrollbarTrackHeight());

        mWidth = width;
        updateThumbPath();
@@ -265,6 +267,7 @@ public class BaseRecyclerViewFastScrollBar {
        if (!mIsRtl) {
            canvas.translate(mRv.getWidth(), 0);
        }
        canvas.translate(0, mRv.getPaddingTop());
        // Draw the track
        int thumbWidth = mIsRtl ? mWidth : -mWidth;
        canvas.drawRect(0, 0, thumbWidth, mRv.getScrollbarTrackHeight(), mTrackPaint);
+8 −0
Original line number Diff line number Diff line
@@ -245,6 +245,10 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
        }
    }

    public SearchUiManager getSearchUiManager() {
        return mSearchUiManager;
    }

    @Override
    public View getTouchDelegateTargetView() {
        return mAppsRecyclerView;
@@ -366,6 +370,10 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
    @Override
    public void setInsets(Rect insets) {
        DeviceProfile grid = mLauncher.getDeviceProfile();
        mAppsRecyclerView.setPadding(
                mAppsRecyclerView.getPaddingLeft(), mAppsRecyclerView.getPaddingTop(),
                mAppsRecyclerView.getPaddingRight(), insets.bottom);

        if (grid.isVerticalBarLayout()) {
            ViewGroup.MarginLayoutParams mlp = (MarginLayoutParams) getLayoutParams();
            mlp.leftMargin = insets.left;
+0 −5
Original line number Diff line number Diff line
@@ -161,11 +161,6 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.
            }
            return extraRows;
        }

        @Override
        public int getPaddingBottom() {
            return mLauncher.getDragLayer().getInsets().bottom;
        }
    }

    /**
Loading