Skip to content

Commit

Permalink
fix: 修复 手机管家-全局侧边栏-隐藏侧边栏 功能失效的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
lingqiqi5211 committed Jan 10, 2025
1 parent d7ab6e5 commit 29ad9d2
Showing 1 changed file with 25 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@
import android.content.IntentFilter;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import android.view.MotionEvent;
import android.view.View;

import androidx.core.content.ContextCompat;

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

import java.lang.reflect.Method;
Expand Down Expand Up @@ -68,12 +71,12 @@ public void onReceive(Context context, Intent intent) {
int pos = originDockLocation;
if (bundle != null) {
pos = bundle.getInt("inDirection", 0);
view.getContext().getSharedPreferences("sp_video_box", 0).edit().putInt("dock_line_location", pos).commit();
view.getContext().getSharedPreferences("sp_video_box", 0).edit().putInt("dock_line_location", pos).apply();
}
showSideBar(view, pos);
}
};
view.getContext().registerReceiver(showReceiver, new IntentFilter(ACTION_PREFIX + "ShowSideBar"));
ContextCompat.registerReceiver(view.getContext(), showReceiver, new IntentFilter(ACTION_PREFIX + "ShowSideBar"), ContextCompat.RECEIVER_NOT_EXPORTED);
XposedHelpers.setAdditionalInstanceField(param.thisObject, "showReceiver", showReceiver);

if (!isHooked[1]) {
Expand All @@ -96,14 +99,26 @@ protected void before(MethodHookParam param) throws Throwable {
}
});
}
Class<?> bgDrawable = view.getBackground().getClass();
findAndHookMethod(bgDrawable, "draw", Canvas.class, new MethodHook() {
@Override
protected void before(MethodHookParam param) throws Throwable {
param.setResult(null);
}
});
view.setBackground(null);
try {
// 10.0.0 及以上的手机管家获取 drawable 的方式
Class<?> bgDrawable = XposedHelpers.callMethod(view, "getDrawable").getClass();
findAndHookMethod(bgDrawable, "draw", Canvas.class, new MethodHook() {
@Override
protected void before(MethodHookParam param) {
param.setResult(null);
}
});
XposedHelpers.callMethod(view, "setImageDrawable", (Drawable) null);
} catch (Throwable e) {
Class<?> bgDrawable = view.getBackground().getClass();
findAndHookMethod(bgDrawable, "draw", Canvas.class, new MethodHook() {
@Override
protected void before(MethodHookParam param) {
param.setResult(null);
}
});
view.setBackground(null);
}
}
};
myhandler.postDelayed(removeBg, 150);
Expand Down

0 comments on commit 29ad9d2

Please sign in to comment.