Skip to content

Commit

Permalink
fix: Issue that NotificationIconColumns does not take effect in Andro…
Browse files Browse the repository at this point in the history
…id 13 HyperOS && Clean up the code (issue #556 #560)
  • Loading branch information
lingqiqi5211 committed Apr 18, 2024
1 parent 5922586 commit e0762ae
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ package com.sevtinge.hyperceiler.module.hook.systemui.lockscreen
import com.github.kyuubiran.ezxhelper.ClassUtils.loadClass
import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook
import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder
import com.sevtinge.hyperceiler.module.base.BaseHook
import com.sevtinge.hyperceiler.module.base.*

object NoPassword : BaseHook() {
override fun init() {
loadClass("com.android.internal.widget.LockPatternUtils\$StrongAuthTracker").methodFinder()
.filterByName("isBiometricAllowedForUser")
.single().createHook {
.first().createHook {
returnConstant(true)
}

loadClass("com.android.internal.widget.LockPatternUtils").methodFinder()
.filterByName("isBiometricAllowedForUser")
.single().createHook {
.first().createHook {
returnConstant(true)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package com.sevtinge.hyperceiler.module.hook.systemui.statusbar;

import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isAndroidVersion;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreAndroidVersion;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreHyperOSVersion;

Expand All @@ -44,20 +43,18 @@ public class NotificationIconColumns extends BaseHook {
@Override
public void init() {
int maxIconsNum;
if (!isAndroidVersion(30)) {
int maxDotsNum = mPrefsMap.getInt("system_ui_status_bar_notification_dots_maximum", 3);
if (isMoreHyperOSVersion(1f)) {
maxIconsNum = mPrefsMap.getInt("system_ui_status_bar_notification_icon_maximum", 1);
} else {
maxIconsNum = mPrefsMap.getInt("system_ui_status_bar_notification_icon_maximum", 3);
}
if (isMoreHyperOSVersion(1f)) {
mHyperOsNew(maxIconsNum);
} else if (isMoreAndroidVersion(34)) {
mAndroidU(maxIconsNum, maxDotsNum);
} else {
mAndroidS(maxIconsNum, maxDotsNum);
}
int maxDotsNum = mPrefsMap.getInt("system_ui_status_bar_notification_dots_maximum", 3);
if (isMoreHyperOSVersion(1f) && isMoreAndroidVersion(34)) {
maxIconsNum = mPrefsMap.getInt("system_ui_status_bar_notification_icon_maximum", 1);
} else {
maxIconsNum = mPrefsMap.getInt("system_ui_status_bar_notification_icon_maximum", 3);
}
if (isMoreHyperOSVersion(1f) && isMoreAndroidVersion(34)) {
mHyperOsNew(maxIconsNum);
} else if (isMoreAndroidVersion(34)) {
mAndroidU(maxIconsNum, maxDotsNum);
} else {
mAndroidS(maxIconsNum, maxDotsNum);
}
}

Expand Down Expand Up @@ -203,19 +200,11 @@ protected void before(MethodHookParam param) {
if ((boolean) param.args[0]) {
XposedHelpers.setObjectField(param.thisObject, "MAX_DOTS", maxDotsNum);
XposedHelpers.setObjectField(param.thisObject, "MAX_STATIC_ICONS", maxIconsNum);
if (isAndroidVersion(33)) {
XposedHelpers.setObjectField(param.thisObject, "MAX_ICONS_ON_LOCKSCREEN", maxIconsNum);
} else {
XposedHelpers.setObjectField(param.thisObject, "MAX_VISIBLE_ICONS_ON_LOCK", maxIconsNum);
}
XposedHelpers.setObjectField(param.thisObject, "MAX_ICONS_ON_LOCKSCREEN", maxIconsNum);
} else {
XposedHelpers.setObjectField(param.thisObject, "MAX_DOTS", 0);
XposedHelpers.setObjectField(param.thisObject, "MAX_STATIC_ICONS", 0);
if (isAndroidVersion(33)) {
XposedHelpers.setObjectField(param.thisObject, "MAX_ICONS_ON_LOCKSCREEN", 0);
} else {
XposedHelpers.setObjectField(param.thisObject, "MAX_VISIBLE_ICONS_ON_LOCK", 0);
}
XposedHelpers.setObjectField(param.thisObject, "MAX_ICONS_ON_LOCKSCREEN", 0);
}
XposedHelpers.callMethod(param.thisObject, "updateState");
param.setResult(null);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.sevtinge.hyperceiler.ui.fragment.systemui.statusbar;

import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreAndroidVersion;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreHyperOSVersion;

import android.view.View;
Expand Down Expand Up @@ -45,7 +46,7 @@ public void initPrefs() {
mBatteryPercentage = findPreference("prefs_key_system_ui_status_bar_battery_percent_mark");
mNotificationIconColumns = findPreference("prefs_key_system_ui_status_bar_notification_icon_maximum");

mNotificationIconColumns.setDefaultValue(isMoreHyperOSVersion(1f) ? 1 : 3);
mNotificationIconColumns.setDefaultValue((isMoreHyperOSVersion(1f) && isMoreAndroidVersion(34)) ? 1 : 3);

mAlarmClockIconN.setVisible(Integer.parseInt(PrefsUtils.mSharedPreferences.getString("prefs_key_system_ui_status_bar_icon_alarm_clock", "0")) == 3);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*/
package com.sevtinge.hyperceiler.ui.fragment.systemui.statusbar;

import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isAndroidVersion;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreAndroidVersion;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreHyperOSVersion;

import android.view.View;
Expand All @@ -30,14 +28,11 @@
import com.sevtinge.hyperceiler.utils.prefs.PrefsUtils;

import moralnorm.preference.DropDownPreference;
import moralnorm.preference.Preference;
import moralnorm.preference.SeekBarPreferenceEx;
import moralnorm.preference.SwitchPreference;

public class IconManageSettings extends SettingsPreferenceFragment {

Preference UseNewHD;
DropDownPreference IconNewHD;
DropDownPreference mAlarmClockIcon;
SeekBarPreferenceEx mAlarmClockIconN;
SeekBarPreferenceEx mNotificationIconMaximum;
Expand Down Expand Up @@ -68,11 +63,6 @@ public void initPrefs() {
mBatteryPercentage = findPreference("prefs_key_system_ui_status_bar_battery_percent_mark");
mNotificationIconColumns = findPreference("prefs_key_system_ui_status_bar_notification_icon_maximum");

UseNewHD = findPreference("prefs_key_system_ui_status_bar_use_new_hd");
IconNewHD = findPreference("prefs_key_system_ui_status_bar_icon_new_hd");
UseNewHD.setVisible(isAndroidVersion(33));
IconNewHD.setVisible(isMoreAndroidVersion(33));

mNotificationIconColumns.setDefaultValue(isMoreHyperOSVersion(1f) ? 1 : 3);

mAlarmClockIconN.setVisible(Integer.parseInt(PrefsUtils.mSharedPreferences.getString("prefs_key_system_ui_status_bar_icon_alarm_clock", "0")) == 3);
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/xml/system_ui_lock_screen.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
android:key="prefs_key_system_ui_lock_screen_password_free"
android:summary="@string/system_ui_lock_screen_password_free_desc"
android:title="@string/system_ui_lock_screen_password_free" />

</PreferenceCategory>

<PreferenceCategory android:title="@string/system_ui_other_title">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
android:title="@string/left_margin"
app:defaultValueText="@string/array_default"
app:format="%s dp"
app:maxValue="24"
app:maxValue="40"
app:minValue="0"
app:stepValue="1" />

Expand All @@ -32,7 +32,7 @@
android:title="@string/right_margin"
app:defaultValueText="@string/array_default"
app:format="%s dp"
app:maxValue="24"
app:maxValue="40"
app:minValue="0"
app:stepValue="1" />

Expand Down

0 comments on commit e0762ae

Please sign in to comment.