feat: Add option to clear home screen in settings (#6125)

Signed-off-by: abhixv <abhi.sharma1@hotmail.com>
This commit is contained in:
Abhishek Sharma authored and Pun Butrach committed 2026-01-10 20:51:01 +07:00
1 parent 9898749619
commit 5f3a03f4fb
1577 files changed
+112559 -80244

No files matched your search

@@ -25,23 +25,24 @@ import android.view.View;
import android.view.accessibility.AccessibilityNodeInfo;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.RecyclerView;
import com.android.app.animation.Interpolators;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.views.RecyclerViewFastScroller;
import com.patrykmichalik.opto.core.PreferenceExtensionsKt;
import app.lawnchair.preferences2.PreferenceManager2;
/**
* A base {@link RecyclerView}, which does the following:
* <ul>
* <li> NOT intercept a touch unless the scrolling velocity is below a predefined threshold.
* <li> Enable fast scroller.
* <li>NOT intercept a touch unless the scrolling velocity is below a predefined
* threshold.
* <li>Enable fast scroller.
* </ul>
*/
public abstract class FastScrollRecyclerView extends RecyclerView {
public abstract class FastScrollRecyclerView extends RecyclerView {
protected RecyclerViewFastScroller mScrollbar;
@@ -62,12 +63,9 @@ public abstract class FastScrollRecyclerView extends RecyclerView {
pref2 = PreferenceManager2.getInstance(context);
}
public void bindFastScrollbar(RecyclerViewFastScroller scrollbar,
RecyclerViewFastScroller.FastScrollerLocation location) {
public void bindFastScrollbar(RecyclerViewFastScroller scrollbar) {
mScrollbar = scrollbar;
mScrollbar.setRecyclerView(this);
mScrollbar.setFastScrollerLocation(location);
scrollToTop();
onUpdateScrollbar(0);
}
@@ -115,7 +113,7 @@ public abstract class FastScrollRecyclerView extends RecyclerView {
/**
* Returns the available scroll height:
* AvailableScrollHeight = Total height of the all items - last page height
* AvailableScrollHeight = Total height of the all items - last page height
*/
protected int getAvailableScrollHeight() {
// AvailableScrollHeight = Total height of the all items - first page height
@@ -126,15 +124,17 @@ public abstract class FastScrollRecyclerView extends RecyclerView {
/**
* Returns the available scroll bar height:
* AvailableScrollBarHeight = Total height of the visible view - thumb height
* AvailableScrollBarHeight = Total height of the visible view - thumb height
*/
protected int getAvailableScrollBarHeight() {
return getScrollbarTrackHeight() - mScrollbar.getThumbHeight();
}
/**
* 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
* 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
* scroll bar.
*
* @param scrollY the current scroll y
@@ -147,11 +147,12 @@ public abstract class FastScrollRecyclerView extends RecyclerView {
return;
}
// Calculate the current scroll position, the scrollY of the recycler view accounts for the
// view padding, while the scrollBarY is drawn right up to the background padding (ignoring
// Calculate the current scroll position, the scrollY of the recycler view
// accounts for the
// view padding, while the scrollBarY is drawn right up to the background
// padding (ignoring
// padding)
int scrollBarY =
(int) (((float) scrollY / availableScrollHeight) * getAvailableScrollBarHeight());
int scrollBarY = (int) (((float) scrollY / availableScrollHeight) * getAvailableScrollBarHeight());
// Calculate the position and size of the scroll bar
mScrollbar.setThumbOffsetY(scrollBarY);
@@ -159,6 +160,7 @@ public abstract class FastScrollRecyclerView extends RecyclerView {
/**
* Returns whether the view itself will handle the touch event or not.
*
* @param ev MotionEvent in {@param eventSource}
*/
public boolean shouldContainerScroll(MotionEvent ev, View eventSource) {
@@ -171,7 +173,8 @@ public abstract class FastScrollRecyclerView extends RecyclerView {
return false;
}
// IF scroller is at the very top OR there is no scroll bar because there is probably not
// IF scroller is at the very top OR there is no scroll bar because there is
// probably not
// enough items to scroll, THEN it's okay for the container to be pulled down.
return computeVerticalScrollOffset() == 0;
}
@@ -185,28 +188,25 @@ public abstract class FastScrollRecyclerView extends RecyclerView {
/**
* Maps the touch (from 0..1) to the adapter position that should be visible.
* <p>Override in each subclass of this base class.
* <p>
* Override in each subclass of this base class.
*/
public abstract CharSequence scrollToPositionAtProgress(float touchFraction);
/**
* Updates the bounds for the scrollbar.
* <p>Override in each subclass of this base class.
* <p>
* Override in each subclass of this base class.
*/
public abstract void onUpdateScrollbar(int dy);
/**
* Return the fast scroll letter list view in the A-Z list.
* <p>
* Override in each subclass of this base class.
*/
public ConstraintLayout getLetterList() {
return null;
public void onFastScrollCompleted() {
}
/**
* <p>Override in each subclass of this base class.
*/
public void onFastScrollCompleted() {}
@Override
public void onScrollStateChanged(int state) {
super.onScrollStateChanged(state);
@@ -221,7 +221,8 @@ public abstract class FastScrollRecyclerView extends RecyclerView {
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
if (isLayoutSuppressed()) info.setScrollable(false);
if (isLayoutSuppressed())
info.setScrollable(false);
}
/**