mirror of
https://github.com/izzy2lost/PSX2.git
synced 2026-07-05 15:18:36 -07:00
squash some bugs
This commit is contained in:
+2
-2
@@ -11,8 +11,8 @@ android {
|
||||
applicationId "com.izzy2lost.psx2"
|
||||
minSdk 26
|
||||
targetSdk 36
|
||||
versionCode 7
|
||||
versionName "1.0.5"
|
||||
versionCode 8
|
||||
versionName "1.0.6"
|
||||
// APK
|
||||
setProperty("archivesBaseName","PSX2_${versionCode}_${new Date().format('yyyyMMddHHmm')}")
|
||||
|
||||
|
||||
@@ -48,10 +48,12 @@ public class GameSettingsDialogFragment extends DialogFragment {
|
||||
// Dialog is being destroyed - resume the game
|
||||
android.util.Log.d("GameSettingsDialog", "onDestroy called - resuming game");
|
||||
try {
|
||||
if (getActivity() instanceof MainActivity) {
|
||||
if (getActivity() != null && !getActivity().isFinishing() && getActivity() instanceof MainActivity) {
|
||||
((MainActivity) getActivity()).onDialogClosed();
|
||||
}
|
||||
} catch (Throwable ignored) {}
|
||||
} catch (Throwable e) {
|
||||
android.util.Log.e("GameSettingsDialog", "Error in onDestroy: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
||||
@@ -105,10 +105,12 @@ public class GamesCoverDialogFragment extends DialogFragment {
|
||||
// Dialog is being destroyed - resume the game
|
||||
android.util.Log.d("GamesCoverDialog", "onDestroy called - resuming game");
|
||||
try {
|
||||
if (getActivity() instanceof MainActivity) {
|
||||
if (getActivity() != null && !getActivity().isFinishing() && getActivity() instanceof MainActivity) {
|
||||
((MainActivity) getActivity()).onDialogClosed();
|
||||
}
|
||||
} catch (Throwable ignored) {}
|
||||
} catch (Throwable e) {
|
||||
android.util.Log.e("GamesCoverDialog", "Error in onDestroy: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2414,14 +2414,24 @@ public class MainActivity extends AppCompatActivity implements GamesCoverDialogF
|
||||
mOpenDialogCount = Math.max(0, mOpenDialogCount - 1);
|
||||
android.util.Log.d("DialogTracking", "Dialog closed. Count: " + mOpenDialogCount + ", Drawer open: " + mDrawerOpen);
|
||||
if (mOpenDialogCount == 0 && !mDrawerOpen) {
|
||||
// All dialogs closed and no drawers open, resume the game
|
||||
try {
|
||||
if (hasSelectedGame() && isThread() && NativeApp.isPaused()) {
|
||||
android.util.Log.d("DialogTracking", "Resuming game on dialog close");
|
||||
NativeApp.resume();
|
||||
updatePausePlayButton();
|
||||
}
|
||||
} catch (Throwable ignored) {}
|
||||
// All dialogs closed and no drawers open, resume the game with a small delay
|
||||
// Delay prevents crashes when rapidly opening/closing dialogs
|
||||
View root = findViewById(android.R.id.content);
|
||||
if (root != null) {
|
||||
root.postDelayed(() -> {
|
||||
try {
|
||||
if (hasSelectedGame() && isThread() && NativeApp.isPaused()) {
|
||||
android.util.Log.d("DialogTracking", "Resuming game on dialog close");
|
||||
NativeApp.resume();
|
||||
updatePausePlayButton();
|
||||
} else {
|
||||
android.util.Log.d("DialogTracking", "Not resuming - hasGame: " + hasSelectedGame() + ", isThread: " + isThread() + ", isPaused: " + (isThread() ? NativeApp.isPaused() : "N/A"));
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
android.util.Log.e("DialogTracking", "Error resuming game: " + e.getMessage());
|
||||
}
|
||||
}, 100); // Small delay to let dialog fully close
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2442,14 +2452,23 @@ public class MainActivity extends AppCompatActivity implements GamesCoverDialogF
|
||||
mDrawerOpen = false;
|
||||
android.util.Log.d("DrawerTracking", "Drawer closed. Dialog count: " + mOpenDialogCount);
|
||||
if (mOpenDialogCount == 0 && !mDrawerOpen) {
|
||||
// All dialogs closed and no drawers open, resume the game
|
||||
try {
|
||||
if (hasSelectedGame() && isThread() && NativeApp.isPaused()) {
|
||||
android.util.Log.d("DrawerTracking", "Resuming game on drawer close");
|
||||
NativeApp.resume();
|
||||
updatePausePlayButton();
|
||||
}
|
||||
} catch (Throwable ignored) {}
|
||||
// All dialogs closed and no drawers open, resume the game with a small delay
|
||||
View root = findViewById(android.R.id.content);
|
||||
if (root != null) {
|
||||
root.postDelayed(() -> {
|
||||
try {
|
||||
if (hasSelectedGame() && isThread() && NativeApp.isPaused()) {
|
||||
android.util.Log.d("DrawerTracking", "Resuming game on drawer close");
|
||||
NativeApp.resume();
|
||||
updatePausePlayButton();
|
||||
} else {
|
||||
android.util.Log.d("DrawerTracking", "Not resuming - hasGame: " + hasSelectedGame() + ", isThread: " + isThread() + ", isPaused: " + (isThread() ? NativeApp.isPaused() : "N/A"));
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
android.util.Log.e("DrawerTracking", "Error resuming game: " + e.getMessage());
|
||||
}
|
||||
}, 100); // Small delay to let drawer fully close
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -283,10 +283,12 @@ public class QuickActionsDialogFragment extends DialogFragment {
|
||||
// Dialog is being destroyed - resume the game
|
||||
android.util.Log.d("QuickActionsDialog", "onDestroy called - resuming game");
|
||||
try {
|
||||
if (getActivity() instanceof MainActivity) {
|
||||
if (getActivity() != null && !getActivity().isFinishing() && getActivity() instanceof MainActivity) {
|
||||
((MainActivity) getActivity()).onDialogClosed();
|
||||
}
|
||||
} catch (Throwable ignored) {}
|
||||
} catch (Throwable e) {
|
||||
android.util.Log.e("QuickActionsDialog", "Error in onDestroy: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void quitApp() {
|
||||
|
||||
@@ -217,9 +217,11 @@ public class SavesDialogFragment extends DialogFragment {
|
||||
// Dialog is being destroyed - resume the game
|
||||
android.util.Log.d("SavesDialog", "onDestroy called - resuming game");
|
||||
try {
|
||||
if (getActivity() instanceof MainActivity) {
|
||||
if (getActivity() != null && !getActivity().isFinishing() && getActivity() instanceof MainActivity) {
|
||||
((MainActivity) getActivity()).onDialogClosed();
|
||||
}
|
||||
} catch (Throwable ignored) {}
|
||||
} catch (Throwable e) {
|
||||
android.util.Log.e("SavesDialog", "Error in onDestroy: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user