diff options
Diffstat (limited to 'src/android')
3 files changed, 21 insertions, 11 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 75d994c9c..b1771b424 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 @@ -109,9 +109,9 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener { Toast.makeText( this, getString( - R.string.device_memory_inadequate_description, + R.string.device_memory_inadequate, memoryUtil.getDeviceRAM(), - "8 GB" + "8 ${getString(R.string.memory_gigabyte)}" ), Toast.LENGTH_LONG ).show() diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/MemoryUtil.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/MemoryUtil.kt index 390767e47..18e5fa0b0 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/MemoryUtil.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/MemoryUtil.kt @@ -5,22 +5,23 @@ package org.yuzu.yuzu_emu.utils import android.app.ActivityManager import android.content.Context +import org.yuzu.yuzu_emu.R import java.util.Locale -class MemoryUtil(context: Context) { +class MemoryUtil(val context: Context) { private val Long.floatForm: String get() = String.format(Locale.ROOT, "%.2f", this.toDouble()) private fun bytesToSizeUnit(size: Long): String { return when { - size < Kb -> size.floatForm + " byte" - size < Mb -> (size / Kb).floatForm + " KB" - size < Gb -> (size / Mb).floatForm + " MB" - size < Tb -> (size / Gb).floatForm + " GB" - size < Pb -> (size / Tb).floatForm + " TB" - size < Eb -> (size / Pb).floatForm + " Pb" - else -> (size / Eb).floatForm + " Eb" + size < Kb -> "${size.floatForm} ${context.getString(R.string.memory_byte)}" + size < Mb -> "${(size / Kb).floatForm} ${context.getString(R.string.memory_kilobyte)}" + size < Gb -> "${(size / Mb).floatForm} ${context.getString(R.string.memory_megabyte)}" + size < Tb -> "${(size / Gb).floatForm} ${context.getString(R.string.memory_gigabyte)}" + size < Pb -> "${(size / Tb).floatForm} ${context.getString(R.string.memory_terabyte)}" + size < Eb -> "${(size / Pb).floatForm} ${context.getString(R.string.memory_petabyte)}" + else -> "${(size / Eb).floatForm} ${context.getString(R.string.memory_exabyte)}" } } diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index 7d37d2bee..85fc682f2 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml @@ -270,7 +270,7 @@ <string name="fatal_error">Fatal Error</string> <string name="fatal_error_message">A fatal error occurred. Check the log for details.\nContinuing emulation may result in crashes and bugs.</string> <string name="performance_warning">Turning off this setting will significantly reduce emulation performance! For the best experience, it is recommended that you leave this setting enabled.</string> - <string name="device_memory_inadequate_description">Device RAM: %1$s\nRecommended: %2$s</string> + <string name="device_memory_inadequate">Device RAM: %1$s\nRecommended: %2$s</string> <!-- Region Names --> <string name="region_japan">Japan</string> @@ -301,6 +301,15 @@ <string name="language_traditional_chinese">Traditional Chinese (正體中文)</string> <string name="language_brazilian_portuguese">Brazilian Portuguese (Português do Brasil)</string> + <!-- Memory Sizes --> + <string name="memory_byte">Byte</string> + <string name="memory_kilobyte">KB</string> + <string name="memory_megabyte">MB</string> + <string name="memory_gigabyte">GB</string> + <string name="memory_terabyte">TB</string> + <string name="memory_petabyte">PB</string> + <string name="memory_exabyte">EB</string> + <!-- Renderer APIs --> <string name="renderer_vulkan">Vulkan</string> <string name="renderer_none">None</string> |