summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCharles Lombardo <clombardo169@gmail.com>2023-05-29 07:34:09 +0200
committerbunnei <bunneidev@gmail.com>2023-06-03 09:06:05 +0200
commit897b748895a555a19f79a88c02f1886d4ac44c88 (patch)
tree57d243efae6a728911eb4baf776110a4e3d4321b /src
parentandroid: Upgrade AGP to 8.0.2 (diff)
downloadyuzu-897b748895a555a19f79a88c02f1886d4ac44c88.tar
yuzu-897b748895a555a19f79a88c02f1886d4ac44c88.tar.gz
yuzu-897b748895a555a19f79a88c02f1886d4ac44c88.tar.bz2
yuzu-897b748895a555a19f79a88c02f1886d4ac44c88.tar.lz
yuzu-897b748895a555a19f79a88c02f1886d4ac44c88.tar.xz
yuzu-897b748895a555a19f79a88c02f1886d4ac44c88.tar.zst
yuzu-897b748895a555a19f79a88c02f1886d4ac44c88.zip
Diffstat (limited to 'src')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt19
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/ResetSettingsDialogFragment.kt30
2 files changed, 37 insertions, 12 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt
index 14ae513e2..d9abc358a 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt
@@ -19,6 +19,7 @@ import org.yuzu.yuzu_emu.features.settings.model.Settings
import org.yuzu.yuzu_emu.features.settings.model.StringSetting
import org.yuzu.yuzu_emu.features.settings.model.view.*
import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile
+import org.yuzu.yuzu_emu.fragments.ResetSettingsDialogFragment
import org.yuzu.yuzu_emu.utils.ThemeHelper
class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView) {
@@ -115,7 +116,12 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView)
RunnableSetting(
R.string.reset_to_default,
0
- ) { resetSettings() }
+ ) {
+ ResetSettingsDialogFragment().show(
+ settingsActivity.supportFragmentManager,
+ ResetSettingsDialogFragment.TAG
+ )
+ }
)
}
}
@@ -444,15 +450,4 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView)
)
}
}
-
- private fun resetSettings() {
- MaterialAlertDialogBuilder(settingsActivity)
- .setTitle(R.string.reset_all_settings)
- .setMessage(R.string.reset_all_settings_description)
- .setPositiveButton(android.R.string.ok) { _, _ ->
- settingsActivity.onSettingsReset()
- }
- .setNegativeButton(android.R.string.cancel, null)
- .show()
- }
}
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/ResetSettingsDialogFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/ResetSettingsDialogFragment.kt
new file mode 100644
index 000000000..1b4b93ab8
--- /dev/null
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/ResetSettingsDialogFragment.kt
@@ -0,0 +1,30 @@
+// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+package org.yuzu.yuzu_emu.fragments
+
+import android.app.Dialog
+import android.os.Bundle
+import androidx.fragment.app.DialogFragment
+import com.google.android.material.dialog.MaterialAlertDialogBuilder
+import org.yuzu.yuzu_emu.R
+import org.yuzu.yuzu_emu.features.settings.ui.SettingsActivity
+
+class ResetSettingsDialogFragment : DialogFragment() {
+ override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
+ val settingsActivity = requireActivity() as SettingsActivity
+
+ return MaterialAlertDialogBuilder(requireContext())
+ .setTitle(R.string.reset_all_settings)
+ .setMessage(R.string.reset_all_settings_description)
+ .setPositiveButton(android.R.string.ok) { _, _ ->
+ settingsActivity.onSettingsReset()
+ }
+ .setNegativeButton(android.R.string.cancel, null)
+ .show()
+ }
+
+ companion object {
+ const val TAG = "ResetSettingsDialogFragment"
+ }
+}