diff --git a/app/src/main/java/com/kaisar/xposed/godmode/injection/GodModeInjector.java b/app/src/main/java/com/kaisar/xposed/godmode/injection/GodModeInjector.java index f4f9dfe..cb53671 100644 --- a/app/src/main/java/com/kaisar/xposed/godmode/injection/GodModeInjector.java +++ b/app/src/main/java/com/kaisar/xposed/godmode/injection/GodModeInjector.java @@ -77,8 +77,10 @@ public static void notifyEditModeChanged(boolean enable) { state = checkBlockList(loadPackageParam.packageName) ? State.BLOCKED : State.ALLOWED; } if (state == State.ALLOWED) { + // 显示布局边界 switchProp.set(enable); } + // 显示侧栏 dispatchKeyEventHook.setdisplay(enable); } @@ -290,4 +292,7 @@ protected void beforeHookedMethod(MethodHookParam param) { XposedHelpers.findAndHookMethod(View.class, "dispatchTouchEvent", MotionEvent.class, eventHandlerHook); } + public static DispatchKeyEventHook getDispatchKeyEventHook(){ + return dispatchKeyEventHook; + } } diff --git a/app/src/main/java/com/kaisar/xposed/godmode/injection/hook/DispatchKeyEventHook.java b/app/src/main/java/com/kaisar/xposed/godmode/injection/hook/DispatchKeyEventHook.java index 26817da..8491adb 100644 --- a/app/src/main/java/com/kaisar/xposed/godmode/injection/hook/DispatchKeyEventHook.java +++ b/app/src/main/java/com/kaisar/xposed/godmode/injection/hook/DispatchKeyEventHook.java @@ -252,6 +252,7 @@ public void onPropertyChange(Boolean enable) { } } +// 根据process修改选中的view @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (fromUser) { @@ -273,4 +274,19 @@ public void onStartTrackingTouch(SeekBar seekBar) { public void onStopTrackingTouch(SeekBar seekBar) { mNodeSelectorPanel.setAlpha(1f); } + + public void updateSelectedView(View v){ + int index = -1; + for (int i = 0; i < mViewNodes.size(); i++) { + if(mViewNodes.get(i).get() == v){ + index = i; + break; + } + } + if(index >= 0){ + seekbar.setProgress(index); + onProgressChanged(seekbar,index,true); + } + } + } diff --git a/app/src/main/java/com/kaisar/xposed/godmode/injection/hook/EventHandlerHook.java b/app/src/main/java/com/kaisar/xposed/godmode/injection/hook/EventHandlerHook.java index 14d9b08..b631a96 100644 --- a/app/src/main/java/com/kaisar/xposed/godmode/injection/hook/EventHandlerHook.java +++ b/app/src/main/java/com/kaisar/xposed/godmode/injection/hook/EventHandlerHook.java @@ -8,6 +8,7 @@ import android.graphics.Rect; import android.os.Handler; import android.os.Looper; +import android.util.Log; import android.view.HapticFeedbackConstants; import android.view.KeyEvent; import android.view.MotionEvent; @@ -18,6 +19,7 @@ import android.view.WindowManager; import android.widget.Toast; +import com.kaisar.xposed.godmode.injection.GodModeInjector; import com.kaisar.xposed.godmode.injection.ViewController; import com.kaisar.xposed.godmode.injection.ViewHelper; import com.kaisar.xposed.godmode.injection.bridge.GodModeManager; @@ -105,6 +107,8 @@ private boolean dispatchTouchEvent(View v, MotionEvent event) { } return false; } + // 更新红色标识组件的位置 + GodModeInjector.getDispatchKeyEventHook().updateSelectedView(v); mDragging = true; mMultiPointLock = true;//防止多个触点同时触发 //防止列表控件拦截事件传递