mirror of
https://github.com/starr-dusT/yuzu-mainline
synced 2024-03-05 21:12:25 -08:00
android: Prevent deleting the settings file while a game is running
This commit is contained in:
parent
4e87a01db6
commit
fdd200d33f
@ -6,6 +6,7 @@ package org.yuzu.yuzu_emu.features.settings.model.view
|
|||||||
class RunnableSetting(
|
class RunnableSetting(
|
||||||
titleId: Int,
|
titleId: Int,
|
||||||
descriptionId: Int,
|
descriptionId: Int,
|
||||||
|
val isRuntimeRunnable: Boolean,
|
||||||
val runnable: () -> Unit
|
val runnable: () -> Unit
|
||||||
) : SettingsItem(null, titleId, descriptionId) {
|
) : SettingsItem(null, titleId, descriptionId) {
|
||||||
override val type = TYPE_RUNNABLE
|
override val type = TYPE_RUNNABLE
|
||||||
|
@ -115,7 +115,8 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView)
|
|||||||
add(
|
add(
|
||||||
RunnableSetting(
|
RunnableSetting(
|
||||||
R.string.reset_to_default,
|
R.string.reset_to_default,
|
||||||
0
|
0,
|
||||||
|
false
|
||||||
) {
|
) {
|
||||||
ResetSettingsDialogFragment().show(
|
ResetSettingsDialogFragment().show(
|
||||||
settingsActivity.supportFragmentManager,
|
settingsActivity.supportFragmentManager,
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
package org.yuzu.yuzu_emu.features.settings.ui.viewholder
|
package org.yuzu.yuzu_emu.features.settings.ui.viewholder
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import org.yuzu.yuzu_emu.NativeLibrary
|
||||||
import org.yuzu.yuzu_emu.databinding.ListItemSettingBinding
|
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.RunnableSetting
|
||||||
import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem
|
import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem
|
||||||
@ -25,7 +26,9 @@ class RunnableViewHolder(val binding: ListItemSettingBinding, adapter: SettingsA
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onClick(clicked: View) {
|
override fun onClick(clicked: View) {
|
||||||
setting.runnable.invoke()
|
if (!setting.isRuntimeRunnable && !NativeLibrary.isRunning()) {
|
||||||
|
setting.runnable.invoke()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onLongClick(clicked: View): Boolean {
|
override fun onLongClick(clicked: View): Boolean {
|
||||||
|
Loading…
Reference in New Issue
Block a user