diff options
author | Charles Lombardo <clombardo169@gmail.com> | 2023-06-30 19:46:35 +0200 |
---|---|---|
committer | Charles Lombardo <clombardo169@gmail.com> | 2023-06-30 19:46:35 +0200 |
commit | ff6d35f2c780df5e3604979eef0d5b7c194617ea (patch) | |
tree | bc991f04143e98cc136f1aab789f4f2ba5347cec /src | |
parent | android: Rework MemoryUtil (diff) | |
download | yuzu-ff6d35f2c780df5e3604979eef0d5b7c194617ea.tar yuzu-ff6d35f2c780df5e3604979eef0d5b7c194617ea.tar.gz yuzu-ff6d35f2c780df5e3604979eef0d5b7c194617ea.tar.bz2 yuzu-ff6d35f2c780df5e3604979eef0d5b7c194617ea.tar.lz yuzu-ff6d35f2c780df5e3604979eef0d5b7c194617ea.tar.xz yuzu-ff6d35f2c780df5e3604979eef0d5b7c194617ea.tar.zst yuzu-ff6d35f2c780df5e3604979eef0d5b7c194617ea.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt | 35 | ||||
-rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Settings.kt | 2 |
2 files changed, 24 insertions, 13 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt index 2c671fea3..7461fb093 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt @@ -34,11 +34,14 @@ import androidx.core.view.WindowCompat import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsControllerCompat import androidx.navigation.fragment.NavHostFragment +import androidx.preference.PreferenceManager import org.yuzu.yuzu_emu.NativeLibrary import org.yuzu.yuzu_emu.R +import org.yuzu.yuzu_emu.YuzuApplication import org.yuzu.yuzu_emu.databinding.ActivityEmulationBinding import org.yuzu.yuzu_emu.features.settings.model.BooleanSetting import org.yuzu.yuzu_emu.features.settings.model.IntSetting +import org.yuzu.yuzu_emu.features.settings.model.Settings import org.yuzu.yuzu_emu.features.settings.model.SettingsViewModel import org.yuzu.yuzu_emu.model.Game import org.yuzu.yuzu_emu.utils.ControllerMappingHelper @@ -107,20 +110,26 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener { inputHandler = InputHandler() inputHandler.initialize() - if (MemoryUtil.isLessThan(MemoryUtil.REQUIRED_MEMORY, MemoryUtil.Gb)) { - Toast.makeText( - this, - getString( - R.string.device_memory_inadequate, - MemoryUtil.getDeviceRAM(), + val preferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext) + if (!preferences.getBoolean(Settings.PREF_MEMORY_WARNING_SHOWN, false)) { + if (MemoryUtil.isLessThan(MemoryUtil.REQUIRED_MEMORY, MemoryUtil.Gb)) { + Toast.makeText( + this, getString( - R.string.memory_formatted, - NumberFormat.getInstance().format(MemoryUtil.REQUIRED_MEMORY), - getString(R.string.memory_gigabyte) - ) - ), - Toast.LENGTH_LONG - ).show() + R.string.device_memory_inadequate, + MemoryUtil.getDeviceRAM(), + getString( + R.string.memory_formatted, + NumberFormat.getInstance().format(MemoryUtil.REQUIRED_MEMORY), + getString(R.string.memory_gigabyte) + ) + ), + Toast.LENGTH_LONG + ).show() + preferences.edit() + .putBoolean(Settings.PREF_MEMORY_WARNING_SHOWN, true) + .apply() + } } // Start a foreground service to prevent the app from getting killed in the background diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Settings.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Settings.kt index 88afb2223..be6e17e65 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Settings.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Settings.kt @@ -110,6 +110,8 @@ class Settings { const val SECTION_THEME = "Theme" const val SECTION_DEBUG = "Debug" + const val PREF_MEMORY_WARNING_SHOWN = "MemoryWarningShown" + const val PREF_OVERLAY_INIT = "OverlayInit" const val PREF_CONTROL_SCALE = "controlScale" const val PREF_CONTROL_OPACITY = "controlOpacity" |