Added toggle to disable the pause button in EmulationActivity

This commit is contained in:
QuackingCanary
2023-05-10 00:13:32 +02:00
committed by Niccolò Betto
parent 75cc42159b
commit 7c5fba36d4
5 changed files with 33 additions and 1 deletions

View File

@ -372,6 +372,11 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo
binding.onScreenPauseToggle.apply {
isGone = binding.onScreenControllerView.isGone
if(!emulationSettings.showPauseButton) {
binding.onScreenPauseToggle.visibility = View.GONE
} else {
binding.onScreenPauseToggle.visibility = View.VISIBLE
}
setOnClickListener {
if (isEmulatorPaused) {
resumeEmulator()
@ -502,7 +507,7 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo
isGone = binding.onScreenControllerView.isGone
}
binding.onScreenPauseToggle.apply {
isGone = binding.onScreenControllerView.isGone
isGone = !emulationSettings.showPauseButton
}
}
}

View File

@ -41,6 +41,7 @@ class EmulationSettings private constructor(context : Context, prefName : String
var aspectRatio by sharedPreferences(context, 0, prefName = prefName)
var respectDisplayCutout by sharedPreferences(context, false, prefName = prefName)
var enableFoldableLayout by sharedPreferences(context, false, prefName = prefName)
var showPauseButton by sharedPreferences(context, false, prefName = prefName)
// GPU
var gpuDriver by sharedPreferences(context, SYSTEM_GPU_DRIVER, prefName = prefName)

View File

@ -42,6 +42,21 @@
android:textColor="@color/colorPerfStatsPrimary"
tools:text="60 FPS\n16.6±0.10ms" />
<GridLayout
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/ram_stats"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="10dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="@dimen/onScreenItemHorizontalMargin"
tools:text="2000,00MB"
android:textColor="@color/colorRamUsage" />
<ImageButton
android:id="@+id/on_screen_pause_toggle"
android:layout_width="wrap_content"
@ -54,6 +69,8 @@
app:tint="#40FFFFFF"
tools:ignore="ContentDescription" />
</GridLayout>
<ImageButton
android:id="@+id/on_screen_controller_toggle"
android:layout_width="wrap_content"

View File

@ -101,6 +101,9 @@
<string name="enable_foldable_layout">Enable Foldable Layout</string>
<string name="enable_foldable_layout_enabled">Folded devices will display game and controller separately</string>
<string name="enable_foldable_layout_disabled">Display controller over games even when device is folded</string>
<string name="show_pause_button">Show Pause Button</string>
<string name="show_pause_button_disabled">The pause button won\'t be displayed</string>
<string name="show_pause_button_enabled">The pause button will be displayed</string>
<!-- Settings - Audio -->
<string name="audio">Audio</string>
<string name="disable_audio_output">Disable Audio Output</string>

View File

@ -79,6 +79,12 @@
app:key="enable_foldable_layout"
app:title="@string/enable_foldable_layout"
app:isPreferenceVisible="false"/>
<SwitchPreferenceCompat
android:defaultValue="false"
android:summaryOff="@string/show_pause_button_disabled"
android:summaryOn="@string/show_pause_button_enabled"
android:key="show_pause_button"
android:title="@string/show_pause_button" />
</PreferenceCategory>
<PreferenceCategory
android:key="category_audio"