mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 23:02:47 +01:00
android: Prevent deleting the settings file while a game is running
This commit is contained in:
parent
4e87a01db6
commit
fdd200d33f
3 changed files with 7 additions and 2 deletions
|
@ -6,6 +6,7 @@ package org.yuzu.yuzu_emu.features.settings.model.view
|
|||
class RunnableSetting(
|
||||
titleId: Int,
|
||||
descriptionId: Int,
|
||||
val isRuntimeRunnable: Boolean,
|
||||
val runnable: () -> Unit
|
||||
) : SettingsItem(null, titleId, descriptionId) {
|
||||
override val type = TYPE_RUNNABLE
|
||||
|
|
|
@ -115,7 +115,8 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView)
|
|||
add(
|
||||
RunnableSetting(
|
||||
R.string.reset_to_default,
|
||||
0
|
||||
0,
|
||||
false
|
||||
) {
|
||||
ResetSettingsDialogFragment().show(
|
||||
settingsActivity.supportFragmentManager,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
package org.yuzu.yuzu_emu.features.settings.ui.viewholder
|
||||
|
||||
import android.view.View
|
||||
import org.yuzu.yuzu_emu.NativeLibrary
|
||||
import org.yuzu.yuzu_emu.databinding.ListItemSettingBinding
|
||||
import org.yuzu.yuzu_emu.features.settings.model.view.RunnableSetting
|
||||
import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem
|
||||
|
@ -25,8 +26,10 @@ class RunnableViewHolder(val binding: ListItemSettingBinding, adapter: SettingsA
|
|||
}
|
||||
|
||||
override fun onClick(clicked: View) {
|
||||
if (!setting.isRuntimeRunnable && !NativeLibrary.isRunning()) {
|
||||
setting.runnable.invoke()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLongClick(clicked: View): Boolean {
|
||||
// no-op
|
||||
|
|
Loading…
Reference in a new issue