Skip to content

Commit

Permalink
Added option to hide scroller in app drawer #67
Browse files Browse the repository at this point in the history
Signed-off-by: DHD2280 <[email protected]>
  • Loading branch information
DHD2280 committed Dec 25, 2024
1 parent 131021d commit 6c551cb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package it.dhd.oxygencustomizer.xposed.hooks.launcher;

import static de.robv.android.xposed.XposedBridge.hookAllConstructors;
import static de.robv.android.xposed.XposedBridge.hookAllMethods;
import static de.robv.android.xposed.XposedHelpers.callMethod;
import static de.robv.android.xposed.XposedHelpers.findAndHookConstructor;
Expand Down Expand Up @@ -33,6 +34,9 @@ public class Launcher extends XposedMods {
private boolean mRearrangeHome = false, mFolderRearrange = false, mFolderPreview = false, mDrawerRearrange = false, mOpenAppDetails;
private boolean mRemoveFolderPagination = false, mRemoveHomePagination = false;
private int mMaxRows = 6, mMaxColumns = 4;
private boolean mHideScroller = false;

private View OplusFastScroll;

public Launcher(Context context) {
super(context);
Expand All @@ -54,6 +58,11 @@ public void updatePrefs(String... Key) {
mOpenAppDetails = Xprefs.getBoolean("launcher_open_app_details", false);
mRemoveFolderPagination = Xprefs.getBoolean("remove_folder_pagination", false);
mRemoveHomePagination = Xprefs.getBoolean("remove_home_pagination", false);
mHideScroller = Xprefs.getBoolean("hide_scroller", false);

if (Key.length > 0 && Key[0].equals("hide_scroller")) {
updateFastScroll();
}

}

Expand Down Expand Up @@ -171,6 +180,20 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
log("Error in Launcher Layout " + t);
}

Class<?> OplusFastScrollLayoutClass = findClass("com.android.launcher3.allapps.OplusFastScrollLayout", lpparam.classLoader);
hookAllConstructors(OplusFastScrollLayoutClass, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
OplusFastScroll = (View) param.thisObject;
updateFastScroll();
}
});

}

private void updateFastScroll() {
if (OplusFastScroll == null) return;
OplusFastScroll.setVisibility(mHideScroller ? View.GONE : View.VISIBLE);
}

@Override
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/xml/launcher_mods.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@
android:title="@string/force_themed_launcher_icons"
app:iconSpaceReserved="false" />

<it.dhd.oneplusui.preference.OplusSwitchPreference
android:defaultValue="false"
android:key="hide_scroller"
android:summary="@string/hide_scroller_summary"
android:title="@string/hide_scroller"
app:iconSpaceReserved="false" />

</it.dhd.oneplusui.preference.OplusPreferenceCategory>

</PreferenceScreen>

0 comments on commit 6c551cb

Please sign in to comment.