mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-11 21:55:34 -04:00
Fix(hotbar): first touch on 0 index not being taken into account
This commit is contained in:
parent
fae327978e
commit
68fa25cafc
@ -11,6 +11,7 @@ import android.view.ViewParent;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import net.kdt.pojavlaunch.GrabListener;
|
||||
import net.kdt.pojavlaunch.LwjglGlfwKeycode;
|
||||
import net.kdt.pojavlaunch.prefs.LauncherPreferences;
|
||||
import net.kdt.pojavlaunch.utils.MCOptionUtils;
|
||||
@ -26,8 +27,16 @@ public class HotbarView extends View implements MCOptionUtils.MCOptionListener,
|
||||
LwjglGlfwKeycode.GLFW_KEY_4, LwjglGlfwKeycode.GLFW_KEY_5, LwjglGlfwKeycode.GLFW_KEY_6,
|
||||
LwjglGlfwKeycode.GLFW_KEY_7, LwjglGlfwKeycode.GLFW_KEY_8, LwjglGlfwKeycode.GLFW_KEY_9};
|
||||
private final DropGesture mDropGesture = new DropGesture(new Handler(Looper.getMainLooper()));
|
||||
private final GrabListener mGrabListener = new GrabListener() {
|
||||
@Override
|
||||
public void onGrabState(boolean isGrabbing) {
|
||||
mLastIndex = -1;
|
||||
mDropGesture.cancel();
|
||||
}
|
||||
};
|
||||
|
||||
private int mWidth;
|
||||
private int mLastIndex;
|
||||
private int mLastIndex = -1;
|
||||
private int mGuiScale;
|
||||
|
||||
public HotbarView(Context context) {
|
||||
@ -66,6 +75,13 @@ public class HotbarView extends View implements MCOptionUtils.MCOptionListener,
|
||||
}
|
||||
mGuiScale = MCOptionUtils.getMcScale();
|
||||
repositionView();
|
||||
CallbackBridge.addGrabListener(mGrabListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
CallbackBridge.removeGrabListener(mGrabListener);
|
||||
}
|
||||
|
||||
private void repositionView() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user