Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
新增: 系统界面-通知与控制中心-禁止折叠为历史通知 (#494)
Browse files Browse the repository at this point in the history
  • Loading branch information
xing0meng authored Mar 27, 2024
1 parent 60c53b3 commit f090908
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import com.sevtinge.hyperceiler.module.hook.systemui.SquigglyProgress;
import com.sevtinge.hyperceiler.module.hook.systemui.StatusBarActions;
import com.sevtinge.hyperceiler.module.hook.systemui.UiLockApp;
import com.sevtinge.hyperceiler.module.hook.systemui.UnimportantNotification;
import com.sevtinge.hyperceiler.module.hook.systemui.UnlockClipboard;
import com.sevtinge.hyperceiler.module.hook.systemui.UnlockCustomActions;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.AddBlurEffectToNotificationView;
Expand Down Expand Up @@ -274,6 +275,7 @@ public void handleLoadPackage() {

// 控制中心
// initHook(new SmartHome(), false);
initHook(new UnimportantNotification(), mPrefsMap.getBoolean("system_ui_control_center_unimportant_notification"));
initHook(new BlurEnable(), mPrefsMap.getBoolean("system_ui_control_center_statusbar_blur"));
initHook(new ExpandNotification(), !mPrefsMap.getStringSet("system_ui_control_center_expand_notification").isEmpty());
initHook(new HideDelimiter(), mPrefsMap.getStringAsInt("system_ui_control_center_hide_operator", 0) != 0);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.sevtinge.hyperceiler.module.hook.systemui;

import com.sevtinge.hyperceiler.module.base.BaseHook;

import java.util.ArrayList;

import de.robv.android.xposed.XposedHelpers;

public class UnimportantNotification extends BaseHook {
@Override
public void init() throws NoSuchMethodException {
findAndHookMethod("com.android.systemui.statusbar.notification.collection.coordinator.FoldCoordinator$shadeExpansionListener$1",
"onPanelExpansionChanged", "com.android.systemui.shade.ShadeExpansionChangeEvent",
new MethodHook() {
@Override
protected void before(MethodHookParam param) {
Object FoldCoordinator = XposedHelpers.getObjectField(param.thisObject, "this$0");
XposedHelpers.setObjectField(FoldCoordinator, "mPendingNotifications", new ArrayList<>());
}
}
);

findAndHookMethod("com.android.systemui.statusbar.notification.collection.coordinator.FoldCoordinator",
"access$shouldIgnoreEntry",
"com.android.systemui.statusbar.notification.collection.coordinator.FoldCoordinator",
"com.android.systemui.statusbar.notification.collection.NotificationEntry",
new MethodHook() {
@Override
protected void after(MethodHookParam param) {
// Object mSbn = XposedHelpers.getObjectField(param.args[1], "mSbn");
// String getPackageName = (String) XposedHelpers.callMethod(mSbn, "getPackageName");
// logE(TAG, "after: " + param.getResult() + " pkg: " + getPackageName);
param.setResult(true);
}
}
);
}
}
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,7 @@
<string name="system_ui_control_center_show_weather">显示天气</string>
<string name="system_ui_control_center_show_weather_city">显示地区</string>
<string name="system_ui_control_center_disable_device_managed">隐藏网络监控提示</string>
<string name="system_ui_control_center_unimportant_notification">禁止折叠为历史通知</string>
<string name="system_ui_control_center_mute_visible_notice">亮屏时静音</string>
<string name="system_ui_control_center_expand_notification">展开通知</string>
<string name="system_ui_control_center_mute_visible_notice_desc">亮屏时弹出通知不播放提示音</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,7 @@
<string name="system_ui_control_center_show_weather_city">Show city</string>
<string name="system_ui_control_center_disable_device_managed">Hide network monitoring prompts</string>
<string name="system_ui_control_center_mute_visible_notice">Mute when screen is on</string>
<string name="system_ui_control_center_unimportant_notification">Collapse into history notifications is prohibited</string>
<string name="system_ui_control_center_expand_notification">Expand Notifications</string>
<string name="system_ui_control_center_mute_visible_notice_desc">When the screen is turned on, the pop-up notification does not play the prompt sound</string>
<string name="system_ui_control_center_rounded_rect">Rounded rectangle tile</string>
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/xml/system_ui_control_center.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
android:key="prefs_key_system_ui_control_center_expand_notification"
android:title="@string/system_ui_control_center_expand_notification" />

<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_system_ui_control_center_unimportant_notification"
android:title="@string/system_ui_control_center_unimportant_notification" />

<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_system_ui_control_center_mute_visible_notice"
Expand Down

1 comment on commit f090908

@SpeedPartner
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

哇,这个太好了!

Please sign in to comment.