mirror of
https://github.com/izzy2lost/PSX2.git
synced 2026-07-05 15:18:36 -07:00
cleanup some code
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_margin="12dp"/>
|
||||
|
||||
<!-- Controls toggle (top-right) -->
|
||||
<!-- Visibility toggle button in upper right corner -->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_toggle_controls"
|
||||
@@ -57,24 +56,6 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_margin="12dp"/>
|
||||
|
||||
<!-- Small unhide button (only visible when all UI is hidden) -->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_unhide_ui"
|
||||
style="@style/PSX2.ElevatedTransparentButton"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:visibility="gone"
|
||||
app:icon="@drawable/ic_unhide"
|
||||
app:iconSize="24dp"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="0dp"
|
||||
app:iconTint="@color/md_theme_tertiary"
|
||||
app:rippleColor="#40ffffff"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_margin="8dp"
|
||||
android:elevation="4dp"/>
|
||||
|
||||
<!-- Top center menu row -->
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_quick_actions"
|
||||
@@ -142,7 +123,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" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
@@ -152,7 +133,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="start"
|
||||
android:textColor="@color/md_theme_onSurface"
|
||||
android:textColor="#FFFFFFFF"
|
||||
app:rippleColor="#80cdcdcd" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_letters"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:paddingStart="24dp"
|
||||
android:paddingEnd="24dp"
|
||||
@@ -117,6 +117,6 @@
|
||||
app:iconTint="@color/brand_primary"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="20dp"
|
||||
app:iconSize="34dp" />
|
||||
app:iconSize="24dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -34,48 +34,6 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_margin="12dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_renderer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_ogl"
|
||||
style="@style/PSX2.ElevatedTransparentButton"
|
||||
android:layout_width="60dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="OGL"
|
||||
android:textSize="12sp"
|
||||
|
||||
app:rippleColor="#80cdcdcd" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_vulkan"
|
||||
style="@style/PSX2.ElevatedTransparentButton"
|
||||
android:layout_width="60dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="VK"
|
||||
android:textSize="12sp"
|
||||
|
||||
app:rippleColor="#80cdcdcd" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_sw"
|
||||
style="@style/PSX2.ElevatedTransparentButton"
|
||||
android:layout_width="60dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="SW"
|
||||
android:textSize="12sp"
|
||||
|
||||
app:rippleColor="#80cdcdcd" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Controls toggle (top-right) -->
|
||||
<!-- Visibility toggle button in upper right corner -->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_toggle_controls"
|
||||
@@ -98,26 +56,6 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_margin="12dp"/>
|
||||
|
||||
<!-- Small unhide button (only visible when all UI is hidden) -->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_unhide_ui"
|
||||
style="@style/PSX2.ElevatedTransparentButton"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:visibility="gone"
|
||||
app:icon="@drawable/ic_unhide"
|
||||
app:iconSize="24dp"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="0dp"
|
||||
app:iconTint="@color/md_theme_tertiary"
|
||||
app:rippleColor="#40ffffff"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_margin="8dp"
|
||||
android:elevation="4dp"/>
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_quick_actions"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -160,7 +98,6 @@
|
||||
|
||||
app:rippleColor="#80cdcdcd" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Portrait control stack: Joy above D-Pad; both above Select/Start; Right cluster above Select/Start -->
|
||||
@@ -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" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
@@ -192,7 +129,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="start"
|
||||
android:textColor="@color/md_theme_onSurface"
|
||||
android:textColor="#FFFFFFFF"
|
||||
app:rippleColor="#80cdcdcd" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
Reference in New Issue
Block a user