mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-13 14:51:51 -04:00
Tweak: only instantiate the dialog when first needed
This commit is contained in:
parent
dc06417767
commit
2e9428d54c
@ -190,7 +190,7 @@ public class MainActivity extends BaseActivity implements ControlButtonMenuListe
|
||||
case 0: dialogForceClose(MainActivity.this); break;
|
||||
case 1: openLogOutput(); break;
|
||||
case 2: dialogSendCustomKey(); break;
|
||||
case 3: mQuickSettingSideDialog.appear(true); break;
|
||||
case 3: openQuickSettings(); break;
|
||||
case 4: openCustomControls(); break;
|
||||
}
|
||||
drawerLayout.closeDrawers();
|
||||
@ -212,24 +212,6 @@ public class MainActivity extends BaseActivity implements ControlButtonMenuListe
|
||||
Tools.showErrorRemote(e);
|
||||
}
|
||||
});
|
||||
|
||||
mQuickSettingSideDialog = new QuickSettingSideDialog(this, mControlLayout) {
|
||||
@Override
|
||||
public void onResolutionChanged() {
|
||||
//TODO: reflect the change in event positions sent down to the game
|
||||
minecraftGLView.refreshSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGyroStateChanged() {
|
||||
mGyroControl.updateOrientation();
|
||||
if (PREF_ENABLE_GYRO) {
|
||||
mGyroControl.enable();
|
||||
} else {
|
||||
mGyroControl.disable();
|
||||
}
|
||||
}
|
||||
};
|
||||
} catch (Throwable e) {
|
||||
Tools.showError(this, e, true);
|
||||
}
|
||||
@ -401,6 +383,28 @@ public class MainActivity extends BaseActivity implements ControlButtonMenuListe
|
||||
loggerView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void openQuickSettings() {
|
||||
if(mQuickSettingSideDialog == null) {
|
||||
mQuickSettingSideDialog = new QuickSettingSideDialog(this, mControlLayout) {
|
||||
@Override
|
||||
public void onResolutionChanged() {
|
||||
minecraftGLView.refreshSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGyroStateChanged() {
|
||||
mGyroControl.updateOrientation();
|
||||
if (PREF_ENABLE_GYRO) {
|
||||
mGyroControl.enable();
|
||||
} else {
|
||||
mGyroControl.disable();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
Tools.runOnUiThread(() -> mQuickSettingSideDialog.appear(true));
|
||||
}
|
||||
|
||||
public static void toggleMouse(Context ctx) {
|
||||
if (CallbackBridge.isGrabbing()) return;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user