Skip to content

Commit

Permalink
fix: 系统界面-通知与控制中心-媒体通知卡片-动作按钮大小不生效的问题(HyperOS1-HyperOS2)
Browse files Browse the repository at this point in the history
  • Loading branch information
lingqiqi5211 committed Jan 11, 2025
1 parent c3b8255 commit 5da5307
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package com.sevtinge.hyperceiler.module.hook.systemui.controlcenter;

import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreHyperOSVersion;

import android.widget.ImageButton;
import android.content.Context;
import android.graphics.Bitmap;
Expand All @@ -35,19 +37,25 @@
import de.robv.android.xposed.XposedHelpers;

public class MediaButton extends BaseHook {
private String pkg = null;
Class<?> MediaControlPanel;

private final int type = mPrefsMap.getInt("system_ui_control_center_media_control_media_button", 140);
private final int typeCustom = mPrefsMap.getInt("system_ui_control_center_media_control_media_button_custom", 140);

@Override
public void init() throws NoSuchMethodException {

if (isMoreHyperOSVersion(2f)) {
MediaControlPanel = findClassIfExists("com.android.systemui.media.controls.ui.controller.MediaControlPanel", lpparam.classLoader);
} else {
MediaControlPanel = findClassIfExists("com.android.systemui.media.controls.ui.MediaControlPanel", lpparam.classLoader);
}
Class<?> DrawableUtils = findClassIfExists("com.miui.utils.DrawableUtils", lpparam.classLoader);
hookAllMethods("com.android.systemui.media.controls.ui.controller.MediaControlPanel",
"bindButtonCommon", new MethodHook() {

hookAllMethods(MediaControlPanel, "bindButtonCommon", new MethodHook() {
@Override
protected void before(MethodHookParam param) throws Throwable {
Object mediaAction = param.args[0];
Object mediaAction = param.args[1];
String desc = (String) XposedHelpers.getObjectField(mediaAction, "contentDescription");
if ((typeCustom != 140) &&
!desc.contains("Play") && !desc.contains("Pause") &&
Expand Down

0 comments on commit 5da5307

Please sign in to comment.