Skip to content

Commit

Permalink
cleanup: remove unneeded menu entry
Browse files Browse the repository at this point in the history
It's been a while that everything closes when swiping away the app
  • Loading branch information
Mathias-Boulay committed Nov 22, 2024
1 parent 19afab2 commit 19dc51f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public boolean onTouch(View v, MotionEvent event) {
getOnBackPressedDispatcher().addCallback(new OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() {
MainActivity.dialogForceClose(JavaGUILauncherActivity.this);
Tools.dialogForceClose(JavaGUILauncherActivity.this);
}
});
}
Expand Down Expand Up @@ -336,7 +336,7 @@ void sendScaledMousePosition(float x, float y){
}

public void forceClose(View v) {
MainActivity.dialogForceClose(this);
Tools.dialogForceClose(this);
}

public void openLogOutput(View v) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,10 @@ protected void initLayout(int resId) {
android.R.layout.simple_list_item_1, getResources().getStringArray(R.array.menu_ingame));
gameActionClickListener = (parent, view, position, id) -> {
switch(position) {
case 0: dialogForceClose(MainActivity.this); break;
case 1: openLogOutput(); break;
case 2: dialogSendCustomKey(); break;
case 3: openQuickSettings(); break;
case 4: openCustomControls(); break;
case 0: openLogOutput(); break;
case 1: dialogSendCustomKey(); break;
case 2: openQuickSettings(); break;
case 3: openCustomControls(); break;
}
drawerLayout.closeDrawers();
};
Expand Down Expand Up @@ -419,19 +418,6 @@ public static void toggleMouse(Context ctx) {
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
public boolean dispatchKeyEvent(KeyEvent event) {
if(isInEditor) {
Expand Down
13 changes: 13 additions & 0 deletions app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java
Original file line number Diff line number Diff line change
Expand Up @@ -1292,4 +1292,17 @@ public static boolean deviceSupportsGyro(@NonNull Context context) {
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();
}
}
1 change: 0 additions & 1 deletion app_pojavlauncher/src/main/res/values/headings_array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
</string-array>

<string-array name="menu_ingame">
<item>@string/control_forceclose</item>
<item>@string/control_viewout</item>
<item>@string/control_customkey</item>
<item>@string/quick_setting_title</item>
Expand Down

0 comments on commit 19dc51f

Please sign in to comment.