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

Commit

Permalink
新增: 媒体卡片 进度条 & 滑块 颜色自定义
Browse files Browse the repository at this point in the history
  • Loading branch information
HChenX committed Mar 30, 2024
1 parent 88d694f commit 6d92d23
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.sevtinge.hyperceiler.module.hook.systemui.DisableMiuiMultiWinSwitch;
import com.sevtinge.hyperceiler.module.hook.systemui.DisableTransparent;
import com.sevtinge.hyperceiler.module.hook.systemui.MediaButton;
import com.sevtinge.hyperceiler.module.hook.systemui.MediaSeekBarColor;
import com.sevtinge.hyperceiler.module.hook.systemui.MonetThemeOverlay;
import com.sevtinge.hyperceiler.module.hook.systemui.NotificationFix;
import com.sevtinge.hyperceiler.module.hook.systemui.NotificationFreeform;
Expand Down Expand Up @@ -163,6 +164,8 @@ public void handleLoadPackage() {
initHook(new UnlockCustomActions(), mPrefsMap.getBoolean("system_ui_control_center_media_control_unlock_custom_actions"));
initHook(new MediaButton(), mPrefsMap.getInt("system_ui_control_center_media_control_media_button", 140) != 140
|| mPrefsMap.getInt("system_ui_control_center_media_control_media_button_custom", 140) != 140);
initHook(new MediaSeekBarColor(), mPrefsMap.getInt("system_ui_control_center_media_control_seekbar_color", -1) != -1
|| mPrefsMap.getInt("system_ui_control_center_media_control_seekbar_thumb_color", -1) != -1);
initHook(new SquigglyProgress(), mPrefsMap.getStringAsInt("system_ui_control_center_media_control_progress_mode", 0) == 1);
initHook(new MediaControlSeekbarCustom(), mPrefsMap.getStringAsInt("system_ui_control_center_media_control_progress_mode", 0) == 2);
initHook(new MediaControlPanelTimeViewTextSize(), mPrefsMap.getInt("system_ui_control_center_media_control_time_view_text_size", 13) != 13);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.sevtinge.hyperceiler.module.hook.systemui;

import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.widget.SeekBar;

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

import de.robv.android.xposed.XposedHelpers;

public class MediaSeekBarColor extends BaseHook {
@Override
public void init() throws NoSuchMethodException {
int progressColor = mPrefsMap.getInt("system_ui_control_center_media_control_seekbar_color", -1);
int thumbColor = mPrefsMap.getInt("system_ui_control_center_media_control_seekbar_thumb_color", -1);
findAndHookMethod("com.android.systemui.media.controls.models.player.SeekBarObserver",
"onChanged", Object.class,
new MethodHook() {
@Override
protected void after(MethodHookParam param) {
Object holder = XposedHelpers.getObjectField(param.thisObject, "holder");
SeekBar seekBar = (SeekBar) XposedHelpers.getObjectField(holder, "seekBar");
if (progressColor != -1)
seekBar.getProgressDrawable().setColorFilter(new PorterDuffColorFilter(progressColor, PorterDuff.Mode.SRC_IN));
if (thumbColor != -1)
seekBar.getThumb().setColorFilter(new PorterDuffColorFilter(thumbColor, PorterDuff.Mode.SRC_IN));
}
}
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ public class SquigglyProgress extends BaseHook {
@Override
public void init() throws NoSuchMethodException {
findAndHookConstructor("com.android.systemui.media.controls.models.player.MediaViewHolder",
android.view.View.class, new MethodHook() {
android.view.View.class,
new MethodHook() {
@Override
protected void after(MethodHookParam param) {
SeekBar seekBar = (SeekBar) XposedHelpers.getObjectField(param.thisObject, "seekBar");
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,8 @@
<string name="system_ui_control_center_media_control_progress_thickness">粗细</string>
<string name="system_ui_control_center_media_control_unlock_custom_actions">解除自定义动作应用限制</string>
<string name="system_ui_control_center_media_control_time_view_text_size">时间预览文本大小</string>
<string name="system_ui_control_center_media_control_seekbar_color">进度条颜色</string>
<string name="system_ui_control_center_media_control_seekbar_thumb_color">滑块颜色</string>
<string name="system_ui_control_center_media_control_panel_background_mix">优化音乐面板背景混色效果</string>
<string name="system_ui_control_center_media_control_media_button_custom">自定义动作按钮大小</string>
<string name="system_ui_control_center_media_control_media_button">固有动作按钮大小</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,8 @@
<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_media_control_seekbar_color">Progress bar color</string>
<string name="system_ui_control_center_media_control_seekbar_thumb_color">Slider color</string>
<string name="system_ui_control_center_media_control_media_button_custom">Customize the size of the action button</string>
<string name="system_ui_control_center_media_control_media_button">Intrinsic action button size</string>
<string name="system_ui_control_center_remove_media_control_panel_background">Remove mixed color background from card</string>
Expand Down
12 changes: 12 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 @@ -224,6 +224,18 @@
app:showSeekBarValue="true"
app:stepValue="1" />

<moralnorm.preference.ColorPickerPreference
android:title="@string/system_ui_control_center_media_control_seekbar_color"
android:key="prefs_key_system_ui_control_center_media_control_seekbar_color"
android:defaultValue="-1"
app:showAlphaSlider="true" />

<moralnorm.preference.ColorPickerPreference
android:title="@string/system_ui_control_center_media_control_seekbar_thumb_color"
android:key="prefs_key_system_ui_control_center_media_control_seekbar_thumb_color"
android:defaultValue="-1"
app:showAlphaSlider="true" />

</PreferenceCategory>

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

0 comments on commit 6d92d23

Please sign in to comment.