Skip to content

Commit

Permalink
Add the logic to update the key-selected view by clicking
Browse files Browse the repository at this point in the history
  • Loading branch information
ff19 committed Jan 10, 2023
1 parent 4ee32f0 commit c78cb7f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -290,4 +292,7 @@ protected void beforeHookedMethod(MethodHookParam param) {
XposedHelpers.findAndHookMethod(View.class, "dispatchTouchEvent", MotionEvent.class, eventHandlerHook);
}

public static DispatchKeyEventHook getDispatchKeyEventHook(){
return dispatchKeyEventHook;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ public void onPropertyChange(Boolean enable) {
}
}

// 根据process修改选中的view
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (fromUser) {
Expand All @@ -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);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -105,6 +107,8 @@ private boolean dispatchTouchEvent(View v, MotionEvent event) {
}
return false;
}
// 更新红色标识组件的位置
GodModeInjector.getDispatchKeyEventHook().updateSelectedView(v);
mDragging = true;
mMultiPointLock = true;//防止多个触点同时触发
//防止列表控件拦截事件传递
Expand Down

0 comments on commit c78cb7f

Please sign in to comment.