fix: https://docs.qq.com/doc/Bx01Pn3VcgTn1sMR4T3EkjgU0LuPI60KdqgC2ETyTC4KNvuh39MYhP0gVL1S3wtZlQ2SUh123 : "悬浮窗选择器問題,如果點擊佈局图层分析,然後找到最下面一個長按,會出現無法顯示查看控件信息問題"

This commit is contained in:
hyb1996 2018-09-18 21:12:27 +08:00
parent a01fdbc131
commit 44fe0079c3
3 changed files with 16 additions and 7 deletions

View File

@ -115,7 +115,7 @@ public class CircularMenu implements Recorder.OnStateChangedListener, LayoutInsp
@Override
public View inflateActionView(FloatyService service, CircularMenuWindow window) {
View actionView = View.inflate(service, R.layout.circular_action_view, null);
mActionViewIcon = (RoundedImageView) actionView.findViewById(R.id.icon);
mActionViewIcon = actionView.findViewById(R.id.icon);
return actionView;
}

View File

@ -1,11 +1,8 @@
package org.autojs.autojs.ui.floating;
import android.app.Activity;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.util.Log;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.view.OrientationEventListener;
import android.view.View;
import android.view.WindowManager;
@ -15,9 +12,13 @@ import com.stardust.enhancedfloaty.FloatyWindow;
import com.stardust.enhancedfloaty.WindowBridge;
import com.stardust.floatingcircularactionmenu.CircularActionMenu;
import com.stardust.floatingcircularactionmenu.gesture.BounceDragGesture;
import com.stardust.util.ScreenMetrics;
public class CircularMenuWindow implements FloatyWindow {
private static final String KEY_POSITION_X = CircularMenuWindow.class.getName() + ".position.x";
private static final String KEY_POSITION_Y = CircularMenuWindow.class.getName() + ".position.y";
protected CircularMenuFloaty mFloaty;
protected WindowManager mWindowManager;
protected CircularActionMenu mCircularActionMenu;
@ -66,6 +67,9 @@ public class CircularMenuWindow implements FloatyWindow {
}
private void setInitialState() {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext);
int y = preferences.getInt(KEY_POSITION_Y, ScreenMetrics.getDeviceScreenHeight() / 2);
mActionViewWindowBridge.updatePosition(mActionViewWindowBridge.getX(), y);
keepToSide();
}
@ -190,6 +194,11 @@ public class CircularMenuWindow implements FloatyWindow {
}
public void close() {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext);
preferences.edit()
.putInt(KEY_POSITION_X, mActionViewWindowBridge.getX())
.putInt(KEY_POSITION_Y, mActionViewWindowBridge.getY())
.apply();
mOrientationEventListener.disable();
this.mWindowManager.removeView(this.mCircularActionMenu);
this.mWindowManager.removeView(this.mCircularActionView);

View File

@ -58,7 +58,7 @@ public class BubblePopupMenu extends PopupWindow {
} else {
params.leftMargin = 0;
}
if (y + height > screenHeight) {
if (y > screenHeight / 2) {
getContentView().setRotation(180);
mRecyclerView.setRotation(180);
params.leftMargin = -params.leftMargin;