Skip to content

Commit

Permalink
CHANGELOG: Added the ability to hide Launcher Pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
DHD2280 committed Apr 25, 2024
1 parent ad6ae51 commit 77e2dd3
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,20 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.provider.Settings;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;

import androidx.core.graphics.ColorUtils;

import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
Expand All @@ -32,7 +40,9 @@ public class Launcher extends XposedMods {
private static final String listenPackage = Constants.Packages.LAUNCHER;

private int mFolderRows, mFolderColumns, mDrawerColumns;
private boolean mFolderRearrange, mFolderPreview, mDrawerRearrange, mOpenAppDetails;
private boolean mFolderRearrange = false, mFolderPreview = false, mDrawerRearrange = false, mOpenAppDetails;
private boolean mRemoveShortcut = false, mRemoveClone = false;
private boolean mRemoveFolderPagination = false, mRemoveHomePagination = false;

public Launcher(Context context) {
super(context);
Expand All @@ -49,17 +59,10 @@ public void updatePrefs(String... Key) {
mFolderPreview = Xprefs.getBoolean("rearrange_preview", true);
mDrawerRearrange = Xprefs.getBoolean("rearrange_drawer", true);
mOpenAppDetails = Xprefs.getBoolean("launcher_open_app_details", false);

if (Key.length > 0 &&(
Key[0].equals("folder_rows") ||
Key[0].equals("folder_columns") ||
Key[0].equals("drawer_columns") ||
Key[0].equals("rearrange_folder") ||
Key[0].equals("rearrange_preview") ||
Key[0].equals("rearrange_drawer")
)) {
//onConfigChanged();
}
mRemoveShortcut = Xprefs.getBoolean("remove_shortcut_badge_title", false);
mRemoveClone = Xprefs.getBoolean("remove_clone_badge", false);
mRemoveFolderPagination = Xprefs.getBoolean("remove_folder_pagination", false);
mRemoveHomePagination = Xprefs.getBoolean("remove_home_pagination", false);

}

Expand Down Expand Up @@ -118,6 +121,34 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
}
});

Class<?> OplusPageIndicator = findClass("com.android.launcher.pageindicators.OplusPageIndicator", lpparam.classLoader);
findAndHookMethod(OplusPageIndicator, "onDraw", Canvas.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
View v = (View) param.thisObject;
switch (v.getParent().getClass().getCanonicalName()) {
case "com.android.launcher3.OplusDragLayer":
v.setVisibility(View.GONE);
if (mRemoveHomePagination) param.setResult(null);
break;
case "android.widget.FrameLayout":
v.setVisibility(View.GONE);
if (mRemoveFolderPagination) param.setResult(null);
break;
}
}
});

try {
Class<?> PageIndicatorTouchHelper = findClass("com.android.launcher.pageindicators.PageIndicatorTouchHelper", lpparam.classLoader);
findAndHookMethod(PageIndicatorTouchHelper, "dispatchTouchEvent", MotionEvent.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (mRemoveHomePagination) param.setResult(false);
}
});
} catch (Throwable ignored) {}

}

class ClickListener implements View.OnLongClickListener {
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -447,13 +447,14 @@
<string name="launcher_folder_columns">Columns</string>
<string name="launcher_folder_rows">Rows</string>
<string name="launcher_folder_update_preview">Update preview</string>
<string name="remove_folder_pagination_title">Remove Folder Pagination</string>
<string name="drawer">Drawer</string>
<string name="launcher_drawer_edit_columns">Edit columns</string>
<string name="drawer_columns">Columns</string>
<string name="launcher_recents">Recents</string>
<string name="launcher_app_details_title">Open App Details</string>
<string name="launcher_app_details_summary">Tap on the app icon to open app details in Settings.</string>

<string name="remove_home_pagination">Remove Home Pagination</string>

<!-- NavBar Strings -->
<string name="navbar_title">Navigation Bar</string>
Expand Down
22 changes: 22 additions & 0 deletions app/src/main/res/xml/launcher_mods.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@
android:summaryOff="@string/general_off"
android:summaryOn="@string/general_on"
android:defaultValue="false"/>

<SwitchPreferenceCompat
android:key="remove_folder_pagination"
app:iconSpaceReserved="false"
android:title="@string/remove_folder_pagination_title"
android:summaryOff="@string/general_off"
android:summaryOn="@string/general_on"
android:defaultValue="false"/>
</PreferenceCategory>

<PreferenceCategory
Expand Down Expand Up @@ -85,4 +93,18 @@
android:defaultValue="false" />
</PreferenceCategory>

<PreferenceCategory
android:title="@string/misc_category"
app:iconSpaceReserved="false">

<SwitchPreferenceCompat
android:key="remove_home_pagination"
app:iconSpaceReserved="false"
android:title="@string/remove_home_pagination"
android:summaryOff="@string/general_off"
android:summaryOn="@string/general_on"
android:defaultValue="false"/>

</PreferenceCategory>

</PreferenceScreen>

0 comments on commit 77e2dd3

Please sign in to comment.