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

Commit 9e4c3590 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Adding utility method to temporarily hide scrollbar

Bug: 37616877
Change-Id: I286493746c44ace8958ffd8df24317125b445cf7
parent f6add46e
Loading
Loading
Loading
Loading
+14 −2
Original line number Original line Diff line number Diff line
@@ -48,6 +48,8 @@ public abstract class BaseRecyclerView extends RecyclerView
    private int mDownY;
    private int mDownY;
    private int mLastY;
    private int mLastY;


    private boolean mScrollBarVisible = true;

    public BaseRecyclerView(Context context) {
    public BaseRecyclerView(Context context) {
        this(context, null);
        this(context, null);
    }
    }
@@ -199,9 +201,19 @@ public abstract class BaseRecyclerView extends RecyclerView
    @Override
    @Override
    protected void dispatchDraw(Canvas canvas) {
    protected void dispatchDraw(Canvas canvas) {
        super.dispatchDraw(canvas);
        super.dispatchDraw(canvas);
        if (mScrollBarVisible) {
            onUpdateScrollbar(0);
            onUpdateScrollbar(0);
            mScrollbar.draw(canvas);
            mScrollbar.draw(canvas);
        }
        }
    }

    /**
     * Sets the scrollbar visibility. The call does not refresh the UI, its the responsibility
     * of the caller to call {@link #invalidate()}.
     */
    public void setScrollBarVisible(boolean visible) {
        mScrollBarVisible = visible;
    }


    /**
    /**
     * Updates the scrollbar thumb offset to match the visible scroll of the recycler view.  It does
     * Updates the scrollbar thumb offset to match the visible scroll of the recycler view.  It does
+4 −0
Original line number Original line Diff line number Diff line
@@ -97,6 +97,10 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
        mFastScrollHelper = new AllAppsFastScrollHelper(this, apps);
        mFastScrollHelper = new AllAppsFastScrollHelper(this, apps);
    }
    }


    public AlphabeticalAppsList getApps() {
        return mApps;
    }

    /**
    /**
     * Sets the number of apps per row in this recycler view.
     * Sets the number of apps per row in this recycler view.
     */
     */