Skip to content

Commit

Permalink
adj: 调整功能排布
Browse files Browse the repository at this point in the history
  • Loading branch information
lingqiqi5211 committed Jan 27, 2025
1 parent 61610be commit 3d97cf4
Show file tree
Hide file tree
Showing 14 changed files with 110 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,26 @@
*/
package com.sevtinge.hyperceiler.module.hook.systemui.plugin

import android.content.*
import android.text.*
import android.content.ContextWrapper
import android.text.TextUtils
import com.github.kyuubiran.ezxhelper.ClassUtils.loadClass
import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createAfterHook
import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder
import com.sevtinge.hyperceiler.module.base.*
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.*
import com.sevtinge.hyperceiler.module.hook.systemui.other.*
import com.sevtinge.hyperceiler.module.hook.systemui.statusbar.icon.v.*
import com.sevtinge.hyperceiler.utils.api.*
import com.sevtinge.hyperceiler.utils.log.LogManager.*
import java.lang.ref.*
import com.sevtinge.hyperceiler.module.base.BaseHook
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.CCGridForHyperOSKt
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.CustomCardTiles
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.QSColor
import com.sevtinge.hyperceiler.module.hook.systemui.other.DefaultPluginTheme
import com.sevtinge.hyperceiler.module.hook.systemui.statusbar.icon.v.FocusNotifLyric
import com.sevtinge.hyperceiler.utils.api.PluginFactory
import com.sevtinge.hyperceiler.utils.log.LogManager.logLevel
import java.lang.ref.WeakReference

object NewPluginHelperKt : BaseHook() {
private val isStyle by lazy {
mPrefsMap.getStringAsInt("system_ui_others_pct_style", 0)
}

override fun init() {
// from hyperstar2.0
/*loadClass("com.android.systemui.shared.plugins.PluginActionManager\$PluginContextWrapper")
Expand Down Expand Up @@ -77,7 +83,7 @@ object NewPluginHelperKt : BaseHook() {
),
Triple(
"NewShowVolumePct",
mPrefsMap.getBoolean("system_cc_volume_showpct_title"),
(isStyle == 2) && mPrefsMap.getBoolean("system_cc_volume_showpct_title"),
NewShowVolumePct::initLoader
),
Triple(
Expand Down Expand Up @@ -112,7 +118,7 @@ object NewPluginHelperKt : BaseHook() {
val loaders = listOf(
Triple(
"VolumeOrQSBrightnessValue",
mPrefsMap.getBoolean("system_ui_control_center_qs_brightness_top_value_show") || mPrefsMap.getBoolean("system_ui_control_center_qs_volume_top_value_show"),
(isStyle == 1) && (mPrefsMap.getBoolean("system_ui_control_center_qs_brightness_top_value_show") || mPrefsMap.getBoolean("system_ui_control_center_qs_volume_top_value_show")),
VolumeOrQSBrightnessValue::initVolumeOrQSBrightnessValue
),
Triple(
Expand All @@ -138,7 +144,7 @@ object NewPluginHelperKt : BaseHook() {
),
Triple(
"NewBrightnessPct",
mPrefsMap.getBoolean("system_showpct_title"),
(isStyle == 2) && mPrefsMap.getBoolean("system_showpct_title"),
NewBrightnessPct::initLoaderHook
),
Triple(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import com.sevtinge.hyperceiler.ui.hooker.dashboard.DashboardFragment;
import com.sevtinge.hyperceiler.utils.log.AndroidLogUtils;

import fan.preference.DropDownPreference;
import fan.preference.SeekBarPreferenceCompat;

public class ControlCenterSettings extends DashboardFragment {
Expand All @@ -51,10 +50,6 @@ public class ControlCenterSettings extends DashboardFragment {
SwitchPreference mRedirectNotice;
SwitchPreference mShadeHeaderBlur;
RecommendPreference mRecommend;
SwitchPreference mBrightness;
DropDownPreference mBrightnessValue;
SwitchPreference mVolume;
DropDownPreference mVolumeValue;

@Override
public int getPreferenceScreenResId() {
Expand All @@ -71,10 +66,6 @@ public void initPrefs() {
mRedirectNotice = findPreference("prefs_key_system_ui_control_center_redirect_notice");
mSpotlightNotifColorMix = findPreference("prefs_key_system_ui_control_center_opt_notification_element_background_color");
mShadeHeaderBlur = findPreference("prefs_key_system_ui_shade_header_gradient_blur");
mBrightness = findPreference("prefs_key_system_ui_control_center_qs_brightness_top_value_show");
mBrightnessValue = findPreference("prefs_key_system_ui_control_center_qs_brightness_top_value_show_value");
mVolume = findPreference("prefs_key_system_ui_control_center_qs_volume_top_value_show");
mVolumeValue = findPreference("prefs_key_system_ui_control_center_qs_volume_top_value_show_value");

mExpandNotification.setOnPreferenceClickListener(
preference -> {
Expand All @@ -96,19 +87,11 @@ public void initPrefs() {
mSwitchCCAN.setVisible(false);
mSpotlightNotifColorMix.setVisible(isMoreAndroidVersion(35));
mShadeHeaderBlur.setVisible(isMoreAndroidVersion(35));
mBrightness.setVisible(true);
mBrightnessValue.setVisible(true);
mVolume.setVisible(true);
mVolumeValue.setVisible(true);
} else {
mOldCCGrid.setVisible(true);
mSwitchCCAN.setVisible(true);
mSpotlightNotifColorMix.setVisible(false);
mShadeHeaderBlur.setVisible(false);
mBrightness.setVisible(false);
mBrightnessValue.setVisible(false);
mVolume.setVisible(false);
mVolumeValue.setVisible(false);
}
mRedirectNotice.setVisible(!isMoreAndroidVersion(35));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package com.sevtinge.hyperceiler.ui.hooker.systemui;

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

import android.content.ComponentName;
Expand All @@ -31,14 +30,27 @@

import com.sevtinge.hyperceiler.R;
import com.sevtinge.hyperceiler.ui.hooker.dashboard.DashboardFragment;
import com.sevtinge.hyperceiler.utils.prefs.PrefsUtils;

public class SystemUIOtherSettings extends DashboardFragment {
import fan.preference.DropDownPreference;
import fan.preference.SeekBarPreferenceCompat;

public class SystemUIOtherSettings extends DashboardFragment
implements Preference.OnPreferenceChangeListener{
SwitchPreference mDisableInfinitymodeGesture;
SwitchPreference mVolume;
SwitchPreference mPower;
SwitchPreference mFuckSG;
SwitchPreference mTimer;
SwitchPreference mCollpasedColumnPress;
// 数据显示
DropDownPreference mPctStyle;
SwitchPreference mBrightness1;
SwitchPreference mVolume1;
SwitchPreference mBrightness2;
SwitchPreference mVolume2;
SeekBarPreferenceCompat mShowPctTop;
SwitchPreference mShowPctBlur;

@Override
public int getPreferenceScreenResId() {
Expand All @@ -47,17 +59,41 @@ public int getPreferenceScreenResId() {

@Override
public void initPrefs() {
int mPct = Integer.parseInt(PrefsUtils.getSharedStringPrefs(getContext(), "prefs_key_system_ui_others_pct_style", "0"));;

mDisableInfinitymodeGesture = findPreference("prefs_key_system_ui_disable_infinitymode_gesture");
mVolume = findPreference("prefs_key_system_ui_disable_volume");
mPower = findPreference("prefs_key_system_ui_disable_power");
mFuckSG = findPreference("prefs_key_system_ui_move_log_to_miui");
mTimer = findPreference("prefs_key_system_ui_volume_timer");
mCollpasedColumnPress = findPreference("prefs_key_system_ui_volume_collpased_column_press");

mPctStyle = findPreference("prefs_key_system_ui_others_pct_style");
mBrightness1 = findPreference("prefs_key_system_ui_control_center_qs_brightness_top_value_show");
mVolume1 = findPreference("prefs_key_system_ui_control_center_qs_volume_top_value_show");
mBrightness2 = findPreference("prefs_key_system_cc_volume_showpct_title");
mVolume2 = findPreference("prefs_key_system_showpct_title");
mShowPctTop = findPreference("prefs_key_system_ui_others_showpct_top");
mShowPctBlur = findPreference("prefs_key_system_showpct_use_blur");

mDisableInfinitymodeGesture.setVisible(isPad());
mFuckSG.setVisible(isMoreHyperOSVersion(2f));
mTimer.setVisible(!isMoreAndroidVersion(35));
mCollpasedColumnPress.setVisible(isMoreHyperOSVersion(2f));

if (isMoreHyperOSVersion(2f)) {
mFuckSG.setVisible(true);
mTimer.setVisible(false);
mCollpasedColumnPress.setVisible(true);

setStyleMode(mPct);
mPctStyle.setOnPreferenceChangeListener(this);
} else {
mFuckSG.setVisible(false);
mTimer.setVisible(true);
mCollpasedColumnPress.setVisible(false);

mPctStyle.setVisible(false);
mBrightness1.setVisible(false);
mVolume1.setVisible(false);
}

mVolume.setOnPreferenceChangeListener(
(preference, o) -> {
Expand Down Expand Up @@ -96,4 +132,21 @@ public boolean onPreferenceChange(@NonNull Preference preference, Object o) {
}
});
}

@Override
public boolean onPreferenceChange(@NonNull Preference preference, Object o) {
if (preference == mPctStyle) {
setStyleMode(Integer.parseInt((String) o));
}
return true;
}

private void setStyleMode(int mode) {
mBrightness1.setVisible(mode == 1);
mVolume1.setVisible(mode == 1);
mBrightness2.setVisible(mode == 2);
mVolume2.setVisible(mode == 2);
mShowPctTop.setVisible(mode == 2);
mShowPctBlur.setVisible(mode == 2);
}
}
3 changes: 0 additions & 3 deletions app/src/main/res/values-ar-rSA/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -886,9 +886,6 @@
<string name="system_ui_control_center_opt_notification_element_background_color_desc">العودة إلى نمط الإشعارات العادي وخلط الألوان</string>
<string name="system_ui_control_center_qs_brightness_top_value_show_title">قيمة سطوع العرض</string>
<string name="system_ui_control_center_qs_volume_top_value_show_title">عرض قيمة مستوى الصوت</string>
<string name="system_ui_control_center_qs_top_value_title">المحتوى</string>
<string name="system_ui_control_center_qs_top_value_per">النسبة المئوية</string>
<string name="system_ui_control_center_qs_top_value_original">القيمة الأصلية</string>
<string name="system_ui_other_title">أخرى</string>
<string name="system_ui_disable_volume">شريط الصوت الأصلي</string>
<string name="system_ui_disable_power">قائمة إيقاف التشغيل الأصلية</string>
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/values-es-rES/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -780,9 +780,6 @@ aplicaciones del sistema</string>
<string name="system_ui_control_center_card_tiles_customization_not_add">No añadido</string>
<string name="system_ui_control_center_unlock_blur_supported">Eliminar restricciones de notificación de burbaja</string>
<string name="system_ui_control_center_unlock_blur_supported_desc">No hay restricciones en el desenfoque de fondo para materiales prémium de Xiaomi solo para la eliminación en temas no oficiales</string>
<string name="system_ui_control_center_qs_top_value_title">Contenido</string>
<string name="system_ui_control_center_qs_top_value_per">Porcentaje</string>
<string name="system_ui_control_center_qs_top_value_original">Valor de origen</string>
<string name="system_ui_other_title">Otros</string>
<string name="system_ui_disable_volume">Barra de volumen de AOSP</string>
<string name="system_ui_disable_power">Menú de apagado nativo</string>
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/values-pl-rPL/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -886,9 +886,6 @@
<string name="system_ui_control_center_opt_notification_element_background_color_desc">Przywróć standardowe mieszanie kolorów powiadomień</string>
<string name="system_ui_control_center_qs_brightness_top_value_show_title">Wyświetl wartość jasności</string>
<string name="system_ui_control_center_qs_volume_top_value_show_title">Wyświetl wartość głośności</string>
<string name="system_ui_control_center_qs_top_value_title">Treść</string>
<string name="system_ui_control_center_qs_top_value_per">Procent</string>
<string name="system_ui_control_center_qs_top_value_original">Wartość początkowa</string>
<string name="system_ui_other_title">Pozostałe</string>
<string name="system_ui_disable_volume">Natywny pasek głośności</string>
<string name="system_ui_disable_power">Natywne menu wyłączenia</string>
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -884,9 +884,6 @@
<string name="system_ui_control_center_opt_notification_element_background_color_desc">Reverte para a mistura normal de cores do estilo de notificação</string>
<string name="system_ui_control_center_qs_brightness_top_value_show_title">Exibir valor do brilho</string>
<string name="system_ui_control_center_qs_volume_top_value_show_title">Exibir valor do volume</string>
<string name="system_ui_control_center_qs_top_value_title">Conteúdo</string>
<string name="system_ui_control_center_qs_top_value_per">Percentagem</string>
<string name="system_ui_control_center_qs_top_value_original">Valor de origem</string>
<string name="system_ui_other_title">Outros</string>
<string name="system_ui_disable_volume">Barra de volume nativa</string>
<string name="system_ui_disable_power">Menu de energia nativo</string>
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/values-ru-rRU/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -886,9 +886,6 @@
<string name="system_ui_control_center_opt_notification_element_background_color_desc">Вернуться к обычному стилю смешивания цветов уведомлений</string>
<string name="system_ui_control_center_qs_brightness_top_value_show_title">Значение яркости дисплея</string>
<string name="system_ui_control_center_qs_volume_top_value_show_title">Отображать значение громкости</string>
<string name="system_ui_control_center_qs_top_value_title">Содержание</string>
<string name="system_ui_control_center_qs_top_value_per">Проценты</string>
<string name="system_ui_control_center_qs_top_value_original">Оригинальное значение</string>
<string name="system_ui_other_title">Прочее</string>
<string name="system_ui_disable_volume">Встроенная панель громкости</string>
<string name="system_ui_disable_power">Меню выключения от AOSP</string>
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/values-vi-rVN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -888,9 +888,6 @@ Chức năng này là chức năng thử nghiệm có độ ổn định cao</st
<string name="system_ui_control_center_opt_notification_element_background_color_desc">Quay lại kiểu trộn màu thông báo bình thường</string>
<string name="system_ui_control_center_qs_brightness_top_value_show_title">Hiện giá trị độ sáng</string>
<string name="system_ui_control_center_qs_volume_top_value_show_title">Hiện giá trị âm lượng</string>
<string name="system_ui_control_center_qs_top_value_title">Nội dung</string>
<string name="system_ui_control_center_qs_top_value_per">Phần trăm</string>
<string name="system_ui_control_center_qs_top_value_original">Giá trị gốc</string>
<string name="system_ui_other_title">Khác</string>
<string name="system_ui_disable_volume">Thanh âm lượng gốc</string>
<string name="system_ui_disable_power">Menu tắt nguồn mặc định</string>
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,8 @@
<string name="tiles_snow_leopard_mode">雪豹模式</string>
<string name="dashboard_5g">使用 5G 网络</string>

<string name="system_cc_showpct_style_1">内联</string>
<string name="system_cc_showpct_style_2">外显</string>
<!--系统框架-->
<string name="system_framework">系统框架</string>
<string name="system_framework_volume_title">音量</string>
Expand Down Expand Up @@ -943,9 +945,6 @@
<string name="system_ui_control_center_opt_notification_element_background_color_desc">恢复为普通通知混色样式</string>
<string name="system_ui_control_center_qs_brightness_top_value_show_title">亮度值显示</string>
<string name="system_ui_control_center_qs_volume_top_value_show_title">音量值显示</string>
<string name="system_ui_control_center_qs_top_value_title">显示内容</string>
<string name="system_ui_control_center_qs_top_value_per">百分比</string>
<string name="system_ui_control_center_qs_top_value_original">原始数据</string>

<string name="system_ui_controlcenter_new_title">新控制中心</string>
<string name="system_ui_controlcenter_old_title">经典控制中心</string>
Expand Down Expand Up @@ -973,6 +972,7 @@
<string name="system_ui_disable_bottombar">隐藏小窗的手势提示线</string>
<string name="system_ui_notification_freeform">更多应用通知栏下拉打开小窗</string>
<string name="system_ui_others_pct_title">数据显示</string>
<string name="system_cc_showpct_style">数据百分比显示样式</string>
<string name="system_showpct_title">显示亮度百分比</string>
<string name="system_cc_volume_showpct_title">显示声音百分比</string>
<string name="system_ui_others_showpct_top">顶部边距</string>
Expand Down
22 changes: 12 additions & 10 deletions app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -864,16 +864,6 @@
<item>2</item>
</string-array>

<string-array name="system_ui_control_center_qs_top">
<item>@string/system_ui_control_center_qs_top_value_per</item>
<item>@string/system_ui_control_center_qs_top_value_original</item>
</string-array>

<string-array name="system_ui_control_center_qs_top_value">
<item>0</item>
<item>1</item>
</string-array>

<string-array name="blur_switch">
<item>@string/no_blur</item>
<item>@string/miui_blur</item>
Expand Down Expand Up @@ -1012,6 +1002,18 @@
<item>2</item>
</string-array>

<string-array name="others_pct_switch_style">
<item>@string/array_close</item>
<item>@string/system_cc_showpct_style_1</item>
<item>@string/system_cc_showpct_style_2</item>
</string-array>

<string-array name="others_pct_switch_style_value">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>

<string-array name="gallery_backup_server_entries">
<item>@string/array_default</item>
<item>@string/gallery_backup_server_xiaomi</item>
Expand Down
Loading

0 comments on commit 3d97cf4

Please sign in to comment.