6.7.0 - Alpha18 - Fine tuning
This commit is contained in:
@@ -86,7 +86,7 @@ class PostNotificationsPermission(override val context: Context) : PermissionIte
|
||||
}
|
||||
|
||||
// First request (or still allowed without rationale).
|
||||
// zh-CN: 首次请求 (或无需 rationale 也允许再次请求)时直接发起系统权限请求.
|
||||
// zh-CN: 首次请求 (或无需 rationale 也允许再次请求) 时直接发起系统权限请求.
|
||||
launchRequest()
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import io.reactivex.subjects.PublishSubject;
|
||||
import org.autojs.autojs6.R;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Created by Stardust on Sep 24, 2017.
|
||||
@@ -54,6 +55,7 @@ public class FloatingActionMenu extends FrameLayout implements View.OnClickListe
|
||||
private OnFloatingActionButtonClickListener mOnFloatingActionButtonClickListener;
|
||||
|
||||
private View mToggleFab;
|
||||
private int[] mToggleFabLoc;
|
||||
|
||||
public FloatingActionMenu(@NonNull Context context) {
|
||||
super(context);
|
||||
@@ -110,8 +112,9 @@ public class FloatingActionMenu extends FrameLayout implements View.OnClickListe
|
||||
mOnFloatingActionButtonClickListener = listener;
|
||||
}
|
||||
|
||||
public void setToggleFab(@Nullable View toggleFab) {
|
||||
public void setToggleFab(@Nullable View toggleFab, int @NotNull [] locFab) {
|
||||
mToggleFab = toggleFab;
|
||||
mToggleFabLoc = locFab;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -190,29 +193,28 @@ public class FloatingActionMenu extends FrameLayout implements View.OnClickListe
|
||||
FloatingActionMenu thisMenu = this;
|
||||
|
||||
mOverlay = new View(context) {
|
||||
private final int[] loc = new int[2];
|
||||
private final Rect menuRectOnScreen = new Rect();
|
||||
private final Rect toggleFabRectOnScreen = new Rect();
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
thisMenu.getLocationOnScreen(loc);
|
||||
int[] locMenu = new int[2];
|
||||
thisMenu.getLocationOnScreen(locMenu);
|
||||
menuRectOnScreen.set(
|
||||
loc[0],
|
||||
loc[1],
|
||||
loc[0] + thisMenu.getWidth(),
|
||||
loc[1] + thisMenu.getHeight()
|
||||
locMenu[0],
|
||||
locMenu[1],
|
||||
locMenu[0] + thisMenu.getWidth(),
|
||||
locMenu[1] + thisMenu.getHeight()
|
||||
);
|
||||
|
||||
boolean hasToggleFab = (mToggleFab != null) && mToggleFab.isShown();
|
||||
if (hasToggleFab) {
|
||||
mToggleFab.getLocationOnScreen(loc);
|
||||
toggleFabRectOnScreen.set(
|
||||
loc[0],
|
||||
loc[1],
|
||||
loc[0] + mToggleFab.getWidth(),
|
||||
loc[1] + mToggleFab.getHeight()
|
||||
mToggleFabLoc[0],
|
||||
mToggleFabLoc[1],
|
||||
mToggleFabLoc[0] + mToggleFab.getWidth(),
|
||||
mToggleFabLoc[1] + mToggleFab.getHeight()
|
||||
);
|
||||
} else {
|
||||
toggleFabRectOnScreen.setEmpty();
|
||||
|
||||
@@ -22,6 +22,7 @@ import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import io.reactivex.subjects.PublishSubject;
|
||||
import org.autojs.autojs6.R;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Created by SuperMonster003 on Jan 17, 2026.
|
||||
@@ -49,6 +50,7 @@ public class PluginFloatingActionMenu extends FrameLayout implements View.OnClic
|
||||
private OnFloatingActionButtonClickListener mOnFloatingActionButtonClickListener;
|
||||
|
||||
private View mToggleFab;
|
||||
private int[] mToggleFabLoc;
|
||||
|
||||
public PluginFloatingActionMenu(@NonNull Context context) {
|
||||
super(context);
|
||||
@@ -105,8 +107,9 @@ public class PluginFloatingActionMenu extends FrameLayout implements View.OnClic
|
||||
mOnFloatingActionButtonClickListener = listener;
|
||||
}
|
||||
|
||||
public void setToggleFab(@Nullable View toggleFab) {
|
||||
public void setToggleFab(@Nullable View toggleFab, int @NotNull [] locFab) {
|
||||
mToggleFab = toggleFab;
|
||||
mToggleFabLoc = locFab;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -185,29 +188,28 @@ public class PluginFloatingActionMenu extends FrameLayout implements View.OnClic
|
||||
PluginFloatingActionMenu thisMenu = this;
|
||||
|
||||
mOverlay = new View(context) {
|
||||
private final int[] loc = new int[2];
|
||||
private final Rect menuRectOnScreen = new Rect();
|
||||
private final Rect toggleFabRectOnScreen = new Rect();
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
thisMenu.getLocationOnScreen(loc);
|
||||
int[] locMenu = new int[2];
|
||||
thisMenu.getLocationOnScreen(locMenu);
|
||||
menuRectOnScreen.set(
|
||||
loc[0],
|
||||
loc[1],
|
||||
loc[0] + thisMenu.getWidth(),
|
||||
loc[1] + thisMenu.getHeight()
|
||||
locMenu[0],
|
||||
locMenu[1],
|
||||
locMenu[0] + thisMenu.getWidth(),
|
||||
locMenu[1] + thisMenu.getHeight()
|
||||
);
|
||||
|
||||
boolean hasToggleFab = (mToggleFab != null) && mToggleFab.isShown();
|
||||
if (hasToggleFab) {
|
||||
mToggleFab.getLocationOnScreen(loc);
|
||||
toggleFabRectOnScreen.set(
|
||||
loc[0],
|
||||
loc[1],
|
||||
loc[0] + mToggleFab.getWidth(),
|
||||
loc[1] + mToggleFab.getHeight()
|
||||
mToggleFabLoc[0],
|
||||
mToggleFabLoc[1],
|
||||
mToggleFabLoc[0] + mToggleFab.getWidth(),
|
||||
mToggleFabLoc[1] + mToggleFab.getHeight()
|
||||
);
|
||||
} else {
|
||||
toggleFabRectOnScreen.setEmpty();
|
||||
|
||||
@@ -100,6 +100,8 @@ class PluginFragment : ViewPagerFragment(0), OnFloatingActionButtonClickListener
|
||||
|
||||
private fun initFloatingActionMenuIfNeeded(fab: FloatingActionButton): PluginFloatingActionMenu {
|
||||
return mFloatingActionMenu ?: requireActivity().findViewById<PluginFloatingActionMenu>(R.id.plugin_floating_action_menu).also { menu ->
|
||||
val locFab = IntArray(2)
|
||||
fab.getLocationOnScreen(locFab)
|
||||
menu.state
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : SimpleObserver<Boolean?>() {
|
||||
@@ -114,7 +116,7 @@ class PluginFragment : ViewPagerFragment(0), OnFloatingActionButtonClickListener
|
||||
menu.layoutParams.runCatching {
|
||||
javaClass.getField("bottomMargin").setInt(this, fab.marginBottom)
|
||||
}
|
||||
menu.setToggleFab(fab)
|
||||
menu.setToggleFab(fab, locFab)
|
||||
mFloatingActionMenu = menu
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,6 +125,8 @@ class ExplorerFragment : ViewPagerFragment(0), OnFloatingActionButtonClickListen
|
||||
|
||||
private fun initFloatingActionMenuIfNeeded(fab: FloatingActionButton): FloatingActionMenu {
|
||||
return mFloatingActionMenu ?: requireActivity().findViewById<FloatingActionMenu>(R.id.floating_action_menu).also { menu ->
|
||||
val locFab = IntArray(2)
|
||||
fab.getLocationOnScreen(locFab)
|
||||
menu.state
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : SimpleObserver<Boolean?>() {
|
||||
@@ -139,7 +141,7 @@ class ExplorerFragment : ViewPagerFragment(0), OnFloatingActionButtonClickListen
|
||||
menu.layoutParams.runCatching {
|
||||
javaClass.getField("bottomMargin").setInt(this, fab.marginBottom)
|
||||
}
|
||||
menu.setToggleFab(fab)
|
||||
menu.setToggleFab(fab, locFab)
|
||||
mFloatingActionMenu = menu
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user