From 82e9ea45d7022f66c662329eb775a81c3112214d Mon Sep 17 00:00:00 2001 From: izzy2lost Date: Tue, 2 Sep 2025 09:21:48 -0400 Subject: [PATCH] cleanup some code --- .../java/com/izzy2lost/psx2/MainActivity.java | 82 +------------------ .../main/res/layout-land/activity_main.xml | 23 +----- .../res/layout-land/dialog_covers_grid.xml | 4 +- .../main/res/layout-port/activity_main.xml | 67 +-------------- 4 files changed, 8 insertions(+), 168 deletions(-) diff --git a/app/src/main/java/com/izzy2lost/psx2/MainActivity.java b/app/src/main/java/com/izzy2lost/psx2/MainActivity.java index dbd00b4..e0b8745 100644 --- a/app/src/main/java/com/izzy2lost/psx2/MainActivity.java +++ b/app/src/main/java/com/izzy2lost/psx2/MainActivity.java @@ -2,7 +2,6 @@ package com.izzy2lost.psx2; import android.app.Activity; import androidx.appcompat.app.AlertDialog; -// Use MaterialAlertDialogBuilder to adopt Material 3 styling for all dialogs. import com.google.android.material.dialog.MaterialAlertDialogBuilder; import android.content.Context; import android.content.Intent; @@ -62,7 +61,6 @@ public class MainActivity extends AppCompatActivity implements GamesCoverDialogF private boolean mHudVisible = false; private InputManager mInputManager; - // Track joystick directional pressed state to avoid duplicate down events private boolean joyUpPressed = false; private boolean joyDownPressed = false; @@ -87,8 +85,6 @@ public class MainActivity extends AppCompatActivity implements GamesCoverDialogF return !TextUtils.isEmpty(m_szGamefile); } - - @Override public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); @@ -97,10 +93,6 @@ public class MainActivity extends AppCompatActivity implements GamesCoverDialogF applyConstraintsForOrientation(newConfig.orientation); } - - - - private void applyConstraintsForOrientation(int orientation) { // Views present in both layouts View quick = findViewById(R.id.ll_quick_actions); @@ -388,7 +380,6 @@ public class MainActivity extends AppCompatActivity implements GamesCoverDialogF setupBackPressedHandler(); // Default resources - copyAssetAll(getApplicationContext(), "bios"); copyAssetAll(getApplicationContext(), "resources"); Initialize(); @@ -513,75 +504,6 @@ public class MainActivity extends AppCompatActivity implements GamesCoverDialogF }); } - // Small unhide button (appears when all UI is hidden) - MaterialButton btn_unhide_ui = findViewById(R.id.btn_unhide_ui); - if(btn_unhide_ui != null) { - btn_unhide_ui.setOnClickListener(v -> { - toggleAllUIVisibility(); // Show UI again - }); - } - - // RENDERER - MaterialButton btn_ogl = findViewById(R.id.btn_ogl); - if(btn_ogl != null) { - btn_ogl.setOnClickListener(v -> { - // Save setting first with commit() to ensure immediate write - getSharedPreferences("app_prefs", MODE_PRIVATE).edit().putInt("renderer", 12).apply(); - - // Small delay to ensure setting is persisted - try { - Thread.sleep(100); - } catch (InterruptedException ignored) {} - - try { - NativeApp.renderGpu(12); - } catch (Exception e) { - // Setting saved for next restart - } - }); - } - MaterialButton btn_vulkan = findViewById(R.id.btn_vulkan); - if(btn_vulkan != null) { - btn_vulkan.setOnClickListener(v -> { - // Save setting first with commit() to ensure immediate write - getSharedPreferences("app_prefs", MODE_PRIVATE).edit().putInt("renderer", 14).apply(); - - // Small delay to ensure setting is persisted - try { - Thread.sleep(100); - } catch (InterruptedException ignored) {} - - try { - NativeApp.renderGpu(14); - } catch (Exception e) { - // Setting saved for next restart - } - }); - } - MaterialButton btn_sw = findViewById(R.id.btn_sw); - if(btn_sw != null) { - btn_sw.setOnClickListener(v -> { - android.util.Log.d("MainActivity", "SW button clicked - saving renderer 13"); - - // Save setting first with commit() to ensure immediate write - getSharedPreferences("app_prefs", MODE_PRIVATE).edit().putInt("renderer", 13).apply(); - android.util.Log.d("MainActivity", "SW renderer setting saved"); - - // Small delay to ensure setting is persisted - try { - Thread.sleep(100); - } catch (InterruptedException ignored) {} - - try { - NativeApp.renderGpu(13); - android.util.Log.d("MainActivity", "Applied SW renderer (13)"); - } catch (Exception e) { - android.util.Log.e("MainActivity", "Failed to apply SW renderer: " + e.getMessage()); - // Setting saved for next restart - } - }); - } - // PAD MaterialButton btn_pad_select = findViewById(R.id.btn_pad_select); if(btn_pad_select != null) { @@ -1087,11 +1009,11 @@ public class MainActivity extends AppCompatActivity implements GamesCoverDialogF NativeApp.setAspectRatio(aspectRatio); // Widescreen patches - boolean widescreenPatches = prefs.getBoolean("widescreen_patches", false); + boolean widescreenPatches = prefs.getBoolean("widescreen_patches", true); NativeApp.setWidescreenPatches(widescreenPatches); // No interlacing patches - boolean noInterlacingPatches = prefs.getBoolean("no_interlacing_patches", false); + boolean noInterlacingPatches = prefs.getBoolean("no_interlacing_patches", true); NativeApp.setNoInterlacingPatches(noInterlacingPatches); // Texture loading options diff --git a/app/src/main/res/layout-land/activity_main.xml b/app/src/main/res/layout-land/activity_main.xml index 330953a..6cfb77f 100644 --- a/app/src/main/res/layout-land/activity_main.xml +++ b/app/src/main/res/layout-land/activity_main.xml @@ -34,7 +34,6 @@ app:layout_constraintStart_toStartOf="parent" android:layout_margin="12dp"/> - - - - diff --git a/app/src/main/res/layout-land/dialog_covers_grid.xml b/app/src/main/res/layout-land/dialog_covers_grid.xml index 944abbf..aa7caea 100644 --- a/app/src/main/res/layout-land/dialog_covers_grid.xml +++ b/app/src/main/res/layout-land/dialog_covers_grid.xml @@ -62,7 +62,7 @@ + app:iconSize="24dp" /> diff --git a/app/src/main/res/layout-port/activity_main.xml b/app/src/main/res/layout-port/activity_main.xml index 42d8904..81eacf7 100644 --- a/app/src/main/res/layout-port/activity_main.xml +++ b/app/src/main/res/layout-port/activity_main.xml @@ -34,48 +34,6 @@ app:layout_constraintStart_toStartOf="parent" android:layout_margin="12dp"/> - - - - - - - - - - - - - - - - @@ -182,7 +119,7 @@ android:layout_height="wrap_content" android:layout_marginEnd="8dp" android:text="select" - android:textColor="@color/md_theme_onSurface" + android:textColor="#FFFFFFFF" app:rippleColor="#80cdcdcd" />