cleanup: remove unneeded menu entry

It's been a while that everything closes when swiping away the app
This commit is contained in:
Mathias-Boulay
2024-11-22 20:22:58 +01:00
parent 19afab28f4
commit 19dc51fa8a
4 changed files with 19 additions and 21 deletions

View File

@@ -177,7 +177,7 @@ public class JavaGUILauncherActivity extends BaseActivity implements View.OnTouc
getOnBackPressedDispatcher().addCallback(new OnBackPressedCallback(true) { getOnBackPressedDispatcher().addCallback(new OnBackPressedCallback(true) {
@Override @Override
public void handleOnBackPressed() { public void handleOnBackPressed() {
MainActivity.dialogForceClose(JavaGUILauncherActivity.this); Tools.dialogForceClose(JavaGUILauncherActivity.this);
} }
}); });
} }
@@ -336,7 +336,7 @@ public class JavaGUILauncherActivity extends BaseActivity implements View.OnTouc
} }
public void forceClose(View v) { public void forceClose(View v) {
MainActivity.dialogForceClose(this); Tools.dialogForceClose(this);
} }
public void openLogOutput(View v) { public void openLogOutput(View v) {

View File

@@ -189,11 +189,10 @@ public class MainActivity extends BaseActivity implements ControlButtonMenuListe
android.R.layout.simple_list_item_1, getResources().getStringArray(R.array.menu_ingame)); android.R.layout.simple_list_item_1, getResources().getStringArray(R.array.menu_ingame));
gameActionClickListener = (parent, view, position, id) -> { gameActionClickListener = (parent, view, position, id) -> {
switch(position) { switch(position) {
case 0: dialogForceClose(MainActivity.this); break; case 0: openLogOutput(); break;
case 1: openLogOutput(); break; case 1: dialogSendCustomKey(); break;
case 2: dialogSendCustomKey(); break; case 2: openQuickSettings(); break;
case 3: openQuickSettings(); break; case 3: openCustomControls(); break;
case 4: openCustomControls(); break;
} }
drawerLayout.closeDrawers(); drawerLayout.closeDrawers();
}; };
@@ -419,19 +418,6 @@ public class MainActivity extends BaseActivity implements ControlButtonMenuListe
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
} }
public static void dialogForceClose(Context ctx) {
new AlertDialog.Builder(ctx)
.setMessage(R.string.mcn_exit_confirm)
.setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(android.R.string.ok, (p1, p2) -> {
try {
Tools.fullyExit();
} catch (Throwable th) {
Log.w(Tools.APP_NAME, "Could not enable System.exit() method!", th);
}
}).show();
}
@Override @Override
public boolean dispatchKeyEvent(KeyEvent event) { public boolean dispatchKeyEvent(KeyEvent event) {
if(isInEditor) { if(isInEditor) {

View File

@@ -1292,4 +1292,17 @@ public final class Tools {
return ((SensorManager)context.getSystemService(Context.SENSOR_SERVICE)).getDefaultSensor(Sensor.TYPE_GYROSCOPE) != null; return ((SensorManager)context.getSystemService(Context.SENSOR_SERVICE)).getDefaultSensor(Sensor.TYPE_GYROSCOPE) != null;
} }
public static void dialogForceClose(Context ctx) {
new android.app.AlertDialog.Builder(ctx)
.setMessage(R.string.mcn_exit_confirm)
.setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(android.R.string.ok, (p1, p2) -> {
try {
Tools.fullyExit();
} catch (Throwable th) {
Log.w(Tools.APP_NAME, "Could not enable System.exit() method!", th);
}
}).show();
}
} }

View File

@@ -27,7 +27,6 @@
</string-array> </string-array>
<string-array name="menu_ingame"> <string-array name="menu_ingame">
<item>@string/control_forceclose</item>
<item>@string/control_viewout</item> <item>@string/control_viewout</item>
<item>@string/control_customkey</item> <item>@string/control_customkey</item>
<item>@string/quick_setting_title</item> <item>@string/quick_setting_title</item>