FloatingButton: fix: button can't be dragged
Signed-off-by: cjybyjk <cjybyjk@zjnu.edu.cn>
diff --git a/app/src/main/java/org/exthmui/game/services/OverlayService.java b/app/src/main/java/org/exthmui/game/services/OverlayService.java
index ddf92fe..dc1860d 100644
--- a/app/src/main/java/org/exthmui/game/services/OverlayService.java
+++ b/app/src/main/java/org/exthmui/game/services/OverlayService.java
@@ -227,7 +227,13 @@
mGamingFBLayoutParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
mGamingFBLayoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
- mGamingFloatingLayout.setOnTouchListener(new View.OnTouchListener() {
+ mWindowManager.addView(mGamingFloatingLayout, mGamingFBLayoutParams);
+ }
+
+ if (mGamingFloatingButton == null) {
+ mGamingFloatingButton = mGamingFloatingLayout.findViewById(R.id.floating_button);
+ mGamingFloatingButton.setOnClickListener(v -> showHideGamingMenu(0));
+ mGamingFloatingButton.setOnTouchListener(new View.OnTouchListener() {
private int origX;
private int origY;
private int touchX;
@@ -276,12 +282,6 @@
}
});
- mWindowManager.addView(mGamingFloatingLayout, mGamingFBLayoutParams);
- }
-
- if (mGamingFloatingButton == null) {
- mGamingFloatingButton = mGamingFloatingLayout.findViewById(R.id.floating_button);
- mGamingFloatingButton.setOnClickListener(v -> showHideGamingMenu(0));
}
if (mCallControlButton == null) {