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

Commit

Permalink
feat: systemui-CtrlCenter-TimeViewTextSize
Browse files Browse the repository at this point in the history
  • Loading branch information
Sevtinge committed Mar 26, 2024
1 parent d01af8c commit 5ad15f1
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.GmsTile;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.HideDelimiter;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.MediaControlPanelBackgroundMix;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.MediaControlPanelTimeViewTextSize;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.MediaControlSeekbarCustom;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.MoreCardTiles;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.MuteVisibleNotifications;
Expand Down Expand Up @@ -136,6 +137,7 @@ public class SystemUI extends BaseModule {
public void handleLoadPackage() {
// PluginHelper
initHook(new PluginHelper());
initHook(new MediaControlPanelTimeViewTextSize(), mPrefsMap.getInt("system_ui_control_center_media_control_time_view_text_size", 13) == 13);
// 充电动画
initHook(new ChargeAnimationStyle(), mPrefsMap.getStringAsInt("system_ui_charge_animation_style", 0) > 0);
// initHook(DisableChargeAnimation.INSTANCE);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.sevtinge.hyperceiler.module.hook.systemui.controlcenter

import android.util.*
import android.widget.*
import com.github.kyuubiran.ezxhelper.*
import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createAfterHook
import com.github.kyuubiran.ezxhelper.ObjectHelper.Companion.objectHelper
import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder
import com.sevtinge.hyperceiler.module.base.*

class MediaControlPanelTimeViewTextSize : BaseHook() {

private val textSize by lazy {
mPrefsMap.getInt("system_ui_control_center_media_control_time_view_text_size", 13).toFloat()
}

//from https://github.com/YuKongA/MediaControl-BlurBg
override fun init() {
EzXHelper.initHandleLoadPackage(lpparam)
EzXHelper.setLogTag(TAG)
EzXHelper.setToastTag(TAG)

val miuiMediaControlPanel =
ClassUtils.loadClassOrNull("com.android.systemui.statusbar.notification.mediacontrol.MiuiMediaControlPanel")

miuiMediaControlPanel?.methodFinder()?.filterByName("bindPlayer")?.first()
?.createAfterHook {
val mMediaViewHolder =
it.thisObject.objectHelper().getObjectOrNullUntilSuperclass("mMediaViewHolder")
?: return@createAfterHook
val elapsedTimeView =
mMediaViewHolder.objectHelper().getObjectOrNullAs<TextView>("elapsedTimeView")
val totalTimeView =
mMediaViewHolder.objectHelper().getObjectOrNullAs<TextView>("totalTimeView")

elapsedTimeView?.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize)
totalTimeView?.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize)
}
}
}
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 @@ -813,6 +813,7 @@
<string name="system_ui_control_center_media_control_progress_wavy">波浪</string>
<string name="system_ui_control_center_media_control_progress_sleek">圆滑</string>
<string name="system_ui_control_center_media_control_progress_thickness">粗细</string>
<string name="system_ui_control_center_media_control_time_view_text_size">时间预览文本大小</string>
<string name="system_ui_control_center_media_control_panel_background_mix">优化音乐面板背景混色效果</string>
<string name="system_ui_control_center_remove_media_control_panel_background">移除卡片混色背景</string>
<string name="system_ui_control_center_media_control_panel_background_mix_blur_radius">背景模糊半径</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 @@ -796,6 +796,7 @@
<string name="system_ui_control_center_media_control_progress_wavy">Wavy</string>
<string name="system_ui_control_center_media_control_progress_sleek">Sleek</string>
<string name="system_ui_control_center_media_control_progress_thickness">Thickness</string>
<string name="system_ui_control_center_media_control_time_view_text_size">Time view text size</string>
<string name="system_ui_control_center_remove_media_control_panel_background">Remove mixed color background from card</string>
<string name="system_ui_control_center_media_control_panel_background_mix_blur_radius">Background blur radius</string>
<string name="system_ui_control_center_media_control_panel_background_mix_overlay">Opacity of the background overlay layer</string>
Expand Down
11 changes: 11 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 @@ -180,6 +180,17 @@
app:showSeekBarValue="true"
app:stepValue="1" />

<SeekBarPreferenceEx
android:key="prefs_key_system_ui_control_center_media_control_time_view_text_size"
android:title="@string/system_ui_control_center_media_control_time_view_text_size"
app:format="%d f"
app:maxValue="20"
app:minValue="5"
android:defaultValue="13"
app:defaultValueText="@string/array_default"
app:showSeekBarValue="true"
app:stepValue="1" />

</PreferenceCategory>

<PreferenceCategory android:title="@string/system_ui_controlcenter_card_title">
Expand Down

0 comments on commit 5ad15f1

Please sign in to comment.