Skip to content

Commit

Permalink
[新增] 隐藏运营商名称
Browse files Browse the repository at this point in the history
Signed-off-by: HChenX <[email protected]>
  • Loading branch information
HChenX committed Nov 22, 2023
1 parent 4b64fb5 commit db36015
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public void handleLoadPackage() {

// 控制中心
// initHook(new SmartHome(), false);
initHook(new HideDelimiter(), mPrefsMap.getBoolean("system_ui_control_center_hide_delimiter"));
initHook(new HideDelimiter(), mPrefsMap.getStringAsInt("system_ui_control_center_hide_operator", 0) != 0);
initHook(new QSDetailBackGround(), mPrefsMap.getInt("system_control_center_qs_detail_bg", 0) > 0);
initHook(new GmsTile(), mPrefsMap.getBoolean("security_center_gms_open"));
initHook(new FiveGTile(), mPrefsMap.getStringAsInt("system_control_center_5g_new_tile", 0) != 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import com.sevtinge.hyperceiler.module.base.BaseHook;

public class HideDelimiter extends BaseHook {

boolean operator = mPrefsMap.getStringAsInt("system_ui_control_center_hide_operator", 0) == 1;

@Override
public void init() {
findAndHookMethod("com.android.systemui.statusbar.policy.MiuiCarrierTextController",
Expand All @@ -11,7 +14,7 @@ public void init() {
@Override
protected void before(MethodHookParam param) {
String mCurrentCarrier = (String) param.args[0];
param.args[0] = mCurrentCarrier.replace(" | ", "");
param.args[0] = operator ? mCurrentCarrier.replace(" | ", "") : "";
}
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void doRestart(String[] packageName, boolean isRestartSystem) {
" [[ $pid != \"\" ]] && { pkill -l 9 -f \"" + packageGet + "\";" +
" { [[ $? != 0 ]] && { killall -s 9 \"" + packageGet + "\" &>/dev/null;};}" +
" || { { for i in $pid; do kill -s 9 \"$i\" &>/dev/null;done;};}" +
" || { echo \"kill error\"; };};}" +
" || { echo \"kill error\";};};}" +
" || { echo \"kill error\";}",
true, true);
if (commandResult.result == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private MultipleChoiceView createMultipleChoiceView(Context context) {
" [[ $pid != \"\" ]] && { pkill -l 9 -f \"" + packageGet + "\";" +
" { [[ $? != 0 ]] && { killall -s 9 \"" + packageGet + "\" &>/dev/null;};}" +
" || { { for i in $pid; do kill -s 9 \"$i\" &>/dev/null;done;};}" +
" || { echo \"kill error\"; };};}" +
" || { echo \"kill error\";};};}" +
" || { echo \"kill error\";}",
true, false);
}
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,9 @@
<string name="system_ui_control_center_mute_visible_notice_desc">亮屏时弹出通知不播放提示音</string>
<string name="system_ui_control_center_rounded_rect">圆角矩形磁贴</string>
<string name="system_ui_control_center_switch_cc_and_notification_title">对调控制中心与通知抽屉</string>
<string name="system_ui_control_center_hide_delimiter">隐藏运营商名称之间的分隔线</string>
<string name="system_ui_control_center_hide_operator">运营商名称自定义</string>
<string name="system_ui_control_center_hide_delimiter">只隐藏分隔线</string>
<string name="system_ui_control_center_hide_name">隐藏全部名称</string>
<string name="system_ui_control_center_cc_bluetooth_tile_style_title">蓝牙磁贴样式</string>
<string name="system_ui_control_center_cc_bluetooth_tile_style_sum">蓝牙磁贴移至网络磁贴区域</string>
<string name="system_ui_control_center_notifrowmenu">扩展通知菜单</string>
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@
<item>@string/control_center_5g_v2</item>
</string-array>

<string-array name="system_ui_control_center_hide_operator">
<item>@string/control_center_5g_off</item>
<item>@string/system_ui_control_center_hide_delimiter</item>
<item>@string/system_ui_control_center_hide_name</item>
</string-array>

<string-array name="status_bar_icon_mode_value">
<item>0</item>
<item>1</item>
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,9 @@
<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>
<string name="system_ui_control_center_switch_cc_and_notification_title">Switch control center and notification drawer</string>
<string name="system_ui_control_center_hide_delimiter">Hide delimiter between carrier name</string>
<string name="system_ui_control_center_hide_operator">Carrier name customization</string>
<string name="system_ui_control_center_hide_delimiter">Only dividers are hidden</string>
<string name="system_ui_control_center_hide_name">Hide all names</string>
<string name="system_ui_controlcenter_new_title">New control center</string>
<string name="system_ui_controlcenter_old_title">Legacy control center</string>
<string name="system_ui_controlcenter_unlock_old_title">Unlock control center styles</string>
Expand Down
10 changes: 6 additions & 4 deletions app/src/main/res/xml/system_ui_control_center.xml
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,12 @@
android:key="prefs_key_system_ui_control_center_switch_cc_and_notification"
android:title="@string/system_ui_control_center_switch_cc_and_notification_title" />

<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_system_ui_control_center_hide_delimiter"
android:title="@string/system_ui_control_center_hide_delimiter" />
<DropDownPreference
android:defaultValue="0"
android:key="prefs_key_system_ui_control_center_hide_operator"
android:title="@string/system_ui_control_center_hide_operator"
app:entries="@array/system_ui_control_center_hide_operator"
app:entryValues="@array/status_bar_icon_mode_value" />

<DropDownPreference
android:defaultValue="1"
Expand Down

0 comments on commit db36015

Please sign in to comment.