summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar liamwhite2024-02-09 11:47:17 -0500
committerGravatar GitHub2024-02-09 11:47:17 -0500
commit89dd0fa932ce8ef114d4bddb47587195f9360aa2 (patch)
tree192cab5f0433e62556486d3191b3a3f40cf8d545
parentMerge pull request #12964 from t895/foreground-service-test (diff)
parentandroid: Use utility function for applying view margins (diff)
downloadyuzu-89dd0fa932ce8ef114d4bddb47587195f9360aa2.tar.gz
yuzu-89dd0fa932ce8ef114d4bddb47587195f9360aa2.tar.xz
yuzu-89dd0fa932ce8ef114d4bddb47587195f9360aa2.zip
Merge pull request #12968 from t895/thermal-status
android: Thermal throttling indicator
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt3
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragment.kt18
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt13
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AddonsFragment.kt23
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AppletLauncherFragment.kt13
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/DriverManagerFragment.kt23
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EarlyAccessFragment.kt6
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt55
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GameFoldersFragment.kt24
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GameInfoFragment.kt14
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GamePropertiesFragment.kt42
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt7
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/InstallableFragment.kt13
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/LicensesFragment.kt13
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SettingsSearchFragment.kt18
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt15
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/ViewUtils.kt25
-rw-r--r--src/android/app/src/main/jni/android_settings.h2
-rw-r--r--src/android/app/src/main/res/layout/fragment_emulation.xml15
-rw-r--r--src/android/app/src/main/res/menu/menu_overlay_options.xml5
-rw-r--r--src/android/app/src/main/res/values/strings.xml1
21 files changed, 180 insertions, 168 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt
index 86bd33672..664478472 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt
@@ -25,7 +25,8 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting {
25 HAPTIC_FEEDBACK("haptic_feedback"), 25 HAPTIC_FEEDBACK("haptic_feedback"),
26 SHOW_PERFORMANCE_OVERLAY("show_performance_overlay"), 26 SHOW_PERFORMANCE_OVERLAY("show_performance_overlay"),
27 SHOW_INPUT_OVERLAY("show_input_overlay"), 27 SHOW_INPUT_OVERLAY("show_input_overlay"),
28 TOUCHSCREEN("touchscreen"); 28 TOUCHSCREEN("touchscreen"),
29 SHOW_THERMAL_OVERLAY("show_thermal_overlay");
29 30
30 override fun getBoolean(needsGlobal: Boolean): Boolean = 31 override fun getBoolean(needsGlobal: Boolean): Boolean =
31 NativeConfig.getBoolean(key, needsGlobal) 32 NativeConfig.getBoolean(key, needsGlobal)
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragment.kt
index d7ab0b5d9..6f6e7be10 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragment.kt
@@ -8,7 +8,6 @@ import android.os.Bundle
8import android.view.LayoutInflater 8import android.view.LayoutInflater
9import android.view.View 9import android.view.View
10import android.view.ViewGroup 10import android.view.ViewGroup
11import android.view.ViewGroup.MarginLayoutParams
12import androidx.core.view.ViewCompat 11import androidx.core.view.ViewCompat
13import androidx.core.view.WindowInsetsCompat 12import androidx.core.view.WindowInsetsCompat
14import androidx.core.view.updatePadding 13import androidx.core.view.updatePadding
@@ -27,6 +26,7 @@ import org.yuzu.yuzu_emu.R
27import org.yuzu.yuzu_emu.databinding.FragmentSettingsBinding 26import org.yuzu.yuzu_emu.databinding.FragmentSettingsBinding
28import org.yuzu.yuzu_emu.features.settings.model.Settings 27import org.yuzu.yuzu_emu.features.settings.model.Settings
29import org.yuzu.yuzu_emu.model.SettingsViewModel 28import org.yuzu.yuzu_emu.model.SettingsViewModel
29import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
30 30
31class SettingsFragment : Fragment() { 31class SettingsFragment : Fragment() {
32 private lateinit var presenter: SettingsFragmentPresenter 32 private lateinit var presenter: SettingsFragmentPresenter
@@ -125,18 +125,10 @@ class SettingsFragment : Fragment() {
125 val leftInsets = barInsets.left + cutoutInsets.left 125 val leftInsets = barInsets.left + cutoutInsets.left
126 val rightInsets = barInsets.right + cutoutInsets.right 126 val rightInsets = barInsets.right + cutoutInsets.right
127 127
128 val mlpSettingsList = binding.listSettings.layoutParams as MarginLayoutParams 128 binding.listSettings.updateMargins(left = leftInsets, right = rightInsets)
129 mlpSettingsList.leftMargin = leftInsets 129 binding.listSettings.updatePadding(bottom = barInsets.bottom)
130 mlpSettingsList.rightMargin = rightInsets 130
131 binding.listSettings.layoutParams = mlpSettingsList 131 binding.appbarSettings.updateMargins(left = leftInsets, right = rightInsets)
132 binding.listSettings.updatePadding(
133 bottom = barInsets.bottom
134 )
135
136 val mlpAppBar = binding.appbarSettings.layoutParams as MarginLayoutParams
137 mlpAppBar.leftMargin = leftInsets
138 mlpAppBar.rightMargin = rightInsets
139 binding.appbarSettings.layoutParams = mlpAppBar
140 windowInsets 132 windowInsets
141 } 133 }
142 } 134 }
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt
index 5ab38ffda..ff4f0e5df 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt
@@ -13,7 +13,6 @@ import android.os.Bundle
13import android.view.LayoutInflater 13import android.view.LayoutInflater
14import android.view.View 14import android.view.View
15import android.view.ViewGroup 15import android.view.ViewGroup
16import android.view.ViewGroup.MarginLayoutParams
17import android.widget.Toast 16import android.widget.Toast
18import androidx.core.view.ViewCompat 17import androidx.core.view.ViewCompat
19import androidx.core.view.WindowInsetsCompat 18import androidx.core.view.WindowInsetsCompat
@@ -26,6 +25,7 @@ import org.yuzu.yuzu_emu.BuildConfig
26import org.yuzu.yuzu_emu.R 25import org.yuzu.yuzu_emu.R
27import org.yuzu.yuzu_emu.databinding.FragmentAboutBinding 26import org.yuzu.yuzu_emu.databinding.FragmentAboutBinding
28import org.yuzu.yuzu_emu.model.HomeViewModel 27import org.yuzu.yuzu_emu.model.HomeViewModel
28import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
29 29
30class AboutFragment : Fragment() { 30class AboutFragment : Fragment() {
31 private var _binding: FragmentAboutBinding? = null 31 private var _binding: FragmentAboutBinding? = null
@@ -114,15 +114,8 @@ class AboutFragment : Fragment() {
114 val leftInsets = barInsets.left + cutoutInsets.left 114 val leftInsets = barInsets.left + cutoutInsets.left
115 val rightInsets = barInsets.right + cutoutInsets.right 115 val rightInsets = barInsets.right + cutoutInsets.right
116 116
117 val mlpToolbar = binding.toolbarAbout.layoutParams as MarginLayoutParams 117 binding.toolbarAbout.updateMargins(left = leftInsets, right = rightInsets)
118 mlpToolbar.leftMargin = leftInsets 118 binding.scrollAbout.updateMargins(left = leftInsets, right = rightInsets)
119 mlpToolbar.rightMargin = rightInsets
120 binding.toolbarAbout.layoutParams = mlpToolbar
121
122 val mlpScrollAbout = binding.scrollAbout.layoutParams as MarginLayoutParams
123 mlpScrollAbout.leftMargin = leftInsets
124 mlpScrollAbout.rightMargin = rightInsets
125 binding.scrollAbout.layoutParams = mlpScrollAbout
126 119
127 binding.contentAbout.updatePadding(bottom = barInsets.bottom) 120 binding.contentAbout.updatePadding(bottom = barInsets.bottom)
128 121
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AddonsFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AddonsFragment.kt
index adb65812c..f5647fa95 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AddonsFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AddonsFragment.kt
@@ -31,6 +31,7 @@ import org.yuzu.yuzu_emu.model.AddonViewModel
31import org.yuzu.yuzu_emu.model.HomeViewModel 31import org.yuzu.yuzu_emu.model.HomeViewModel
32import org.yuzu.yuzu_emu.utils.AddonUtil 32import org.yuzu.yuzu_emu.utils.AddonUtil
33import org.yuzu.yuzu_emu.utils.FileUtil.copyFilesTo 33import org.yuzu.yuzu_emu.utils.FileUtil.copyFilesTo
34import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
34import java.io.File 35import java.io.File
35 36
36class AddonsFragment : Fragment() { 37class AddonsFragment : Fragment() {
@@ -202,27 +203,19 @@ class AddonsFragment : Fragment() {
202 val leftInsets = barInsets.left + cutoutInsets.left 203 val leftInsets = barInsets.left + cutoutInsets.left
203 val rightInsets = barInsets.right + cutoutInsets.right 204 val rightInsets = barInsets.right + cutoutInsets.right
204 205
205 val mlpToolbar = binding.toolbarAddons.layoutParams as ViewGroup.MarginLayoutParams 206 binding.toolbarAddons.updateMargins(left = leftInsets, right = rightInsets)
206 mlpToolbar.leftMargin = leftInsets 207 binding.listAddons.updateMargins(left = leftInsets, right = rightInsets)
207 mlpToolbar.rightMargin = rightInsets
208 binding.toolbarAddons.layoutParams = mlpToolbar
209
210 val mlpAddonsList = binding.listAddons.layoutParams as ViewGroup.MarginLayoutParams
211 mlpAddonsList.leftMargin = leftInsets
212 mlpAddonsList.rightMargin = rightInsets
213 binding.listAddons.layoutParams = mlpAddonsList
214 binding.listAddons.updatePadding( 208 binding.listAddons.updatePadding(
215 bottom = barInsets.bottom + 209 bottom = barInsets.bottom +
216 resources.getDimensionPixelSize(R.dimen.spacing_bottom_list_fab) 210 resources.getDimensionPixelSize(R.dimen.spacing_bottom_list_fab)
217 ) 211 )
218 212
219 val fabSpacing = resources.getDimensionPixelSize(R.dimen.spacing_fab) 213 val fabSpacing = resources.getDimensionPixelSize(R.dimen.spacing_fab)
220 val mlpFab = 214 binding.buttonInstall.updateMargins(
221 binding.buttonInstall.layoutParams as ViewGroup.MarginLayoutParams 215 left = leftInsets + fabSpacing,
222 mlpFab.leftMargin = leftInsets + fabSpacing 216 right = rightInsets + fabSpacing,
223 mlpFab.rightMargin = rightInsets + fabSpacing 217 bottom = barInsets.bottom + fabSpacing
224 mlpFab.bottomMargin = barInsets.bottom + fabSpacing 218 )
225 binding.buttonInstall.layoutParams = mlpFab
226 219
227 windowInsets 220 windowInsets
228 } 221 }
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AppletLauncherFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AppletLauncherFragment.kt
index 1f66b440d..73ca40484 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AppletLauncherFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AppletLauncherFragment.kt
@@ -21,6 +21,7 @@ import org.yuzu.yuzu_emu.databinding.FragmentAppletLauncherBinding
21import org.yuzu.yuzu_emu.model.Applet 21import org.yuzu.yuzu_emu.model.Applet
22import org.yuzu.yuzu_emu.model.AppletInfo 22import org.yuzu.yuzu_emu.model.AppletInfo
23import org.yuzu.yuzu_emu.model.HomeViewModel 23import org.yuzu.yuzu_emu.model.HomeViewModel
24import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
24 25
25class AppletLauncherFragment : Fragment() { 26class AppletLauncherFragment : Fragment() {
26 private var _binding: FragmentAppletLauncherBinding? = null 27 private var _binding: FragmentAppletLauncherBinding? = null
@@ -95,16 +96,8 @@ class AppletLauncherFragment : Fragment() {
95 val leftInsets = barInsets.left + cutoutInsets.left 96 val leftInsets = barInsets.left + cutoutInsets.left
96 val rightInsets = barInsets.right + cutoutInsets.right 97 val rightInsets = barInsets.right + cutoutInsets.right
97 98
98 val mlpAppBar = binding.toolbarApplets.layoutParams as ViewGroup.MarginLayoutParams 99 binding.toolbarApplets.updateMargins(left = leftInsets, right = rightInsets)
99 mlpAppBar.leftMargin = leftInsets 100 binding.listApplets.updateMargins(left = leftInsets, right = rightInsets)
100 mlpAppBar.rightMargin = rightInsets
101 binding.toolbarApplets.layoutParams = mlpAppBar
102
103 val mlpListApplets =
104 binding.listApplets.layoutParams as ViewGroup.MarginLayoutParams
105 mlpListApplets.leftMargin = leftInsets
106 mlpListApplets.rightMargin = rightInsets
107 binding.listApplets.layoutParams = mlpListApplets
108 101
109 binding.listApplets.updatePadding(bottom = barInsets.bottom) 102 binding.listApplets.updatePadding(bottom = barInsets.bottom)
110 103
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/DriverManagerFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/DriverManagerFragment.kt
index bf017cd7c..41cff46c1 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/DriverManagerFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/DriverManagerFragment.kt
@@ -34,6 +34,7 @@ import org.yuzu.yuzu_emu.model.HomeViewModel
34import org.yuzu.yuzu_emu.utils.FileUtil 34import org.yuzu.yuzu_emu.utils.FileUtil
35import org.yuzu.yuzu_emu.utils.GpuDriverHelper 35import org.yuzu.yuzu_emu.utils.GpuDriverHelper
36import org.yuzu.yuzu_emu.utils.NativeConfig 36import org.yuzu.yuzu_emu.utils.NativeConfig
37import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
37import java.io.File 38import java.io.File
38import java.io.IOException 39import java.io.IOException
39 40
@@ -141,23 +142,15 @@ class DriverManagerFragment : Fragment() {
141 val leftInsets = barInsets.left + cutoutInsets.left 142 val leftInsets = barInsets.left + cutoutInsets.left
142 val rightInsets = barInsets.right + cutoutInsets.right 143 val rightInsets = barInsets.right + cutoutInsets.right
143 144
144 val mlpAppBar = binding.toolbarDrivers.layoutParams as ViewGroup.MarginLayoutParams 145 binding.toolbarDrivers.updateMargins(left = leftInsets, right = rightInsets)
145 mlpAppBar.leftMargin = leftInsets 146 binding.listDrivers.updateMargins(left = leftInsets, right = rightInsets)
146 mlpAppBar.rightMargin = rightInsets
147 binding.toolbarDrivers.layoutParams = mlpAppBar
148
149 val mlplistDrivers = binding.listDrivers.layoutParams as ViewGroup.MarginLayoutParams
150 mlplistDrivers.leftMargin = leftInsets
151 mlplistDrivers.rightMargin = rightInsets
152 binding.listDrivers.layoutParams = mlplistDrivers
153 147
154 val fabSpacing = resources.getDimensionPixelSize(R.dimen.spacing_fab) 148 val fabSpacing = resources.getDimensionPixelSize(R.dimen.spacing_fab)
155 val mlpFab = 149 binding.buttonInstall.updateMargins(
156 binding.buttonInstall.layoutParams as ViewGroup.MarginLayoutParams 150 left = leftInsets + fabSpacing,
157 mlpFab.leftMargin = leftInsets + fabSpacing 151 right = rightInsets + fabSpacing,
158 mlpFab.rightMargin = rightInsets + fabSpacing 152 bottom = barInsets.bottom + fabSpacing
159 mlpFab.bottomMargin = barInsets.bottom + fabSpacing 153 )
160 binding.buttonInstall.layoutParams = mlpFab
161 154
162 binding.listDrivers.updatePadding( 155 binding.listDrivers.updatePadding(
163 bottom = barInsets.bottom + 156 bottom = barInsets.bottom +
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EarlyAccessFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EarlyAccessFragment.kt
index dbc16da4a..0534b68ce 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EarlyAccessFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EarlyAccessFragment.kt
@@ -19,6 +19,7 @@ import com.google.android.material.transition.MaterialSharedAxis
19import org.yuzu.yuzu_emu.R 19import org.yuzu.yuzu_emu.R
20import org.yuzu.yuzu_emu.databinding.FragmentEarlyAccessBinding 20import org.yuzu.yuzu_emu.databinding.FragmentEarlyAccessBinding
21import org.yuzu.yuzu_emu.model.HomeViewModel 21import org.yuzu.yuzu_emu.model.HomeViewModel
22import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
22 23
23class EarlyAccessFragment : Fragment() { 24class EarlyAccessFragment : Fragment() {
24 private var _binding: FragmentEarlyAccessBinding? = null 25 private var _binding: FragmentEarlyAccessBinding? = null
@@ -73,10 +74,7 @@ class EarlyAccessFragment : Fragment() {
73 val leftInsets = barInsets.left + cutoutInsets.left 74 val leftInsets = barInsets.left + cutoutInsets.left
74 val rightInsets = barInsets.right + cutoutInsets.right 75 val rightInsets = barInsets.right + cutoutInsets.right
75 76
76 val mlpAppBar = binding.appbarEa.layoutParams as ViewGroup.MarginLayoutParams 77 binding.appbarEa.updateMargins(left = leftInsets, right = rightInsets)
77 mlpAppBar.leftMargin = leftInsets
78 mlpAppBar.rightMargin = rightInsets
79 binding.appbarEa.layoutParams = mlpAppBar
80 78
81 binding.scrollEa.updatePadding( 79 binding.scrollEa.updatePadding(
82 left = leftInsets, 80 left = leftInsets,
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt
index 937b8faf1..44af896da 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt
@@ -13,6 +13,7 @@ import android.net.Uri
13import android.os.Bundle 13import android.os.Bundle
14import android.os.Handler 14import android.os.Handler
15import android.os.Looper 15import android.os.Looper
16import android.os.PowerManager
16import android.os.SystemClock 17import android.os.SystemClock
17import android.view.* 18import android.view.*
18import android.widget.TextView 19import android.widget.TextView
@@ -23,6 +24,7 @@ import androidx.core.content.res.ResourcesCompat
23import androidx.core.graphics.Insets 24import androidx.core.graphics.Insets
24import androidx.core.view.ViewCompat 25import androidx.core.view.ViewCompat
25import androidx.core.view.WindowInsetsCompat 26import androidx.core.view.WindowInsetsCompat
27import androidx.core.view.updatePadding
26import androidx.drawerlayout.widget.DrawerLayout 28import androidx.drawerlayout.widget.DrawerLayout
27import androidx.drawerlayout.widget.DrawerLayout.DrawerListener 29import androidx.drawerlayout.widget.DrawerLayout.DrawerListener
28import androidx.fragment.app.Fragment 30import androidx.fragment.app.Fragment
@@ -38,7 +40,6 @@ import androidx.window.layout.WindowLayoutInfo
38import com.google.android.material.dialog.MaterialAlertDialogBuilder 40import com.google.android.material.dialog.MaterialAlertDialogBuilder
39import com.google.android.material.slider.Slider 41import com.google.android.material.slider.Slider
40import kotlinx.coroutines.Dispatchers 42import kotlinx.coroutines.Dispatchers
41import kotlinx.coroutines.flow.collect
42import kotlinx.coroutines.flow.collectLatest 43import kotlinx.coroutines.flow.collectLatest
43import kotlinx.coroutines.launch 44import kotlinx.coroutines.launch
44import org.yuzu.yuzu_emu.HomeNavigationDirections 45import org.yuzu.yuzu_emu.HomeNavigationDirections
@@ -64,6 +65,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
64 private lateinit var emulationState: EmulationState 65 private lateinit var emulationState: EmulationState
65 private var emulationActivity: EmulationActivity? = null 66 private var emulationActivity: EmulationActivity? = null
66 private var perfStatsUpdater: (() -> Unit)? = null 67 private var perfStatsUpdater: (() -> Unit)? = null
68 private var thermalStatsUpdater: (() -> Unit)? = null
67 69
68 private var _binding: FragmentEmulationBinding? = null 70 private var _binding: FragmentEmulationBinding? = null
69 private val binding get() = _binding!! 71 private val binding get() = _binding!!
@@ -77,6 +79,8 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
77 79
78 private var isInFoldableLayout = false 80 private var isInFoldableLayout = false
79 81
82 private lateinit var powerManager: PowerManager
83
80 override fun onAttach(context: Context) { 84 override fun onAttach(context: Context) {
81 super.onAttach(context) 85 super.onAttach(context)
82 if (context is EmulationActivity) { 86 if (context is EmulationActivity) {
@@ -102,6 +106,8 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
102 super.onCreate(savedInstanceState) 106 super.onCreate(savedInstanceState)
103 updateOrientation() 107 updateOrientation()
104 108
109 powerManager = requireContext().getSystemService(Context.POWER_SERVICE) as PowerManager
110
105 val intentUri: Uri? = requireActivity().intent.data 111 val intentUri: Uri? = requireActivity().intent.data
106 var intentGame: Game? = null 112 var intentGame: Game? = null
107 if (intentUri != null) { 113 if (intentUri != null) {
@@ -394,8 +400,9 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
394 400
395 emulationState.updateSurface() 401 emulationState.updateSurface()
396 402
397 // Setup overlay 403 // Setup overlays
398 updateShowFpsOverlay() 404 updateShowFpsOverlay()
405 updateThermalOverlay()
399 } 406 }
400 } 407 }
401 } 408 }
@@ -553,6 +560,38 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
553 } 560 }
554 } 561 }
555 562
563 private fun updateThermalOverlay() {
564 if (BooleanSetting.SHOW_THERMAL_OVERLAY.getBoolean()) {
565 thermalStatsUpdater = {
566 if (emulationViewModel.emulationStarted.value &&
567 !emulationViewModel.isEmulationStopping.value
568 ) {
569 val thermalStatus = when (powerManager.currentThermalStatus) {
570 PowerManager.THERMAL_STATUS_LIGHT -> "😥"
571 PowerManager.THERMAL_STATUS_MODERATE -> "🥵"
572 PowerManager.THERMAL_STATUS_SEVERE -> "🔥"
573 PowerManager.THERMAL_STATUS_CRITICAL,
574 PowerManager.THERMAL_STATUS_EMERGENCY,
575 PowerManager.THERMAL_STATUS_SHUTDOWN -> "☢️"
576
577 else -> "🙂"
578 }
579 if (_binding != null) {
580 binding.showThermalsText.text = thermalStatus
581 }
582 thermalStatsUpdateHandler.postDelayed(thermalStatsUpdater!!, 1000)
583 }
584 }
585 thermalStatsUpdateHandler.post(thermalStatsUpdater!!)
586 binding.showThermalsText.visibility = View.VISIBLE
587 } else {
588 if (thermalStatsUpdater != null) {
589 thermalStatsUpdateHandler.removeCallbacks(thermalStatsUpdater!!)
590 }
591 binding.showThermalsText.visibility = View.GONE
592 }
593 }
594
556 @SuppressLint("SourceLockedOrientationActivity") 595 @SuppressLint("SourceLockedOrientationActivity")
557 private fun updateOrientation() { 596 private fun updateOrientation() {
558 emulationActivity?.let { 597 emulationActivity?.let {
@@ -641,6 +680,8 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
641 popup.menu.apply { 680 popup.menu.apply {
642 findItem(R.id.menu_toggle_fps).isChecked = 681 findItem(R.id.menu_toggle_fps).isChecked =
643 BooleanSetting.SHOW_PERFORMANCE_OVERLAY.getBoolean() 682 BooleanSetting.SHOW_PERFORMANCE_OVERLAY.getBoolean()
683 findItem(R.id.thermal_indicator).isChecked =
684 BooleanSetting.SHOW_THERMAL_OVERLAY.getBoolean()
644 findItem(R.id.menu_rel_stick_center).isChecked = 685 findItem(R.id.menu_rel_stick_center).isChecked =
645 BooleanSetting.JOYSTICK_REL_CENTER.getBoolean() 686 BooleanSetting.JOYSTICK_REL_CENTER.getBoolean()
646 findItem(R.id.menu_dpad_slide).isChecked = BooleanSetting.DPAD_SLIDE.getBoolean() 687 findItem(R.id.menu_dpad_slide).isChecked = BooleanSetting.DPAD_SLIDE.getBoolean()
@@ -660,6 +701,13 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
660 true 701 true
661 } 702 }
662 703
704 R.id.thermal_indicator -> {
705 it.isChecked = !it.isChecked
706 BooleanSetting.SHOW_THERMAL_OVERLAY.setBoolean(it.isChecked)
707 updateThermalOverlay()
708 true
709 }
710
663 R.id.menu_edit_overlay -> { 711 R.id.menu_edit_overlay -> {
664 binding.drawerLayout.close() 712 binding.drawerLayout.close()
665 binding.surfaceInputOverlay.requestFocus() 713 binding.surfaceInputOverlay.requestFocus()
@@ -850,7 +898,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
850 right = cutInsets.right 898 right = cutInsets.right
851 } 899 }
852 900
853 v.setPadding(left, cutInsets.top, right, 0) 901 v.updatePadding(left = left, top = cutInsets.top, right = right)
854 windowInsets 902 windowInsets
855 } 903 }
856 } 904 }
@@ -1003,5 +1051,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
1003 1051
1004 companion object { 1052 companion object {
1005 private val perfStatsUpdateHandler = Handler(Looper.myLooper()!!) 1053 private val perfStatsUpdateHandler = Handler(Looper.myLooper()!!)
1054 private val thermalStatsUpdateHandler = Handler(Looper.myLooper()!!)
1006 } 1055 }
1007} 1056}
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GameFoldersFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GameFoldersFragment.kt
index 341a37fdb..5c558b1a5 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GameFoldersFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GameFoldersFragment.kt
@@ -26,6 +26,7 @@ import org.yuzu.yuzu_emu.databinding.FragmentFoldersBinding
26import org.yuzu.yuzu_emu.model.GamesViewModel 26import org.yuzu.yuzu_emu.model.GamesViewModel
27import org.yuzu.yuzu_emu.model.HomeViewModel 27import org.yuzu.yuzu_emu.model.HomeViewModel
28import org.yuzu.yuzu_emu.ui.main.MainActivity 28import org.yuzu.yuzu_emu.ui.main.MainActivity
29import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
29 30
30class GameFoldersFragment : Fragment() { 31class GameFoldersFragment : Fragment() {
31 private var _binding: FragmentFoldersBinding? = null 32 private var _binding: FragmentFoldersBinding? = null
@@ -100,23 +101,16 @@ class GameFoldersFragment : Fragment() {
100 val leftInsets = barInsets.left + cutoutInsets.left 101 val leftInsets = barInsets.left + cutoutInsets.left
101 val rightInsets = barInsets.right + cutoutInsets.right 102 val rightInsets = barInsets.right + cutoutInsets.right
102 103
103 val mlpToolbar = binding.toolbarFolders.layoutParams as ViewGroup.MarginLayoutParams 104 binding.toolbarFolders.updateMargins(left = leftInsets, right = rightInsets)
104 mlpToolbar.leftMargin = leftInsets
105 mlpToolbar.rightMargin = rightInsets
106 binding.toolbarFolders.layoutParams = mlpToolbar
107 105
108 val fabSpacing = resources.getDimensionPixelSize(R.dimen.spacing_fab) 106 val fabSpacing = resources.getDimensionPixelSize(R.dimen.spacing_fab)
109 val mlpFab = 107 binding.buttonAdd.updateMargins(
110 binding.buttonAdd.layoutParams as ViewGroup.MarginLayoutParams 108 left = leftInsets + fabSpacing,
111 mlpFab.leftMargin = leftInsets + fabSpacing 109 right = rightInsets + fabSpacing,
112 mlpFab.rightMargin = rightInsets + fabSpacing 110 bottom = barInsets.bottom + fabSpacing
113 mlpFab.bottomMargin = barInsets.bottom + fabSpacing 111 )
114 binding.buttonAdd.layoutParams = mlpFab 112
115 113 binding.listFolders.updateMargins(left = leftInsets, right = rightInsets)
116 val mlpListFolders = binding.listFolders.layoutParams as ViewGroup.MarginLayoutParams
117 mlpListFolders.leftMargin = leftInsets
118 mlpListFolders.rightMargin = rightInsets
119 binding.listFolders.layoutParams = mlpListFolders
120 114
121 binding.listFolders.updatePadding( 115 binding.listFolders.updatePadding(
122 bottom = barInsets.bottom + 116 bottom = barInsets.bottom +
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GameInfoFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GameInfoFragment.kt
index 5aa3f453f..dbd56e84f 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GameInfoFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GameInfoFragment.kt
@@ -27,6 +27,7 @@ import org.yuzu.yuzu_emu.databinding.FragmentGameInfoBinding
27import org.yuzu.yuzu_emu.model.GameVerificationResult 27import org.yuzu.yuzu_emu.model.GameVerificationResult
28import org.yuzu.yuzu_emu.model.HomeViewModel 28import org.yuzu.yuzu_emu.model.HomeViewModel
29import org.yuzu.yuzu_emu.utils.GameMetadata 29import org.yuzu.yuzu_emu.utils.GameMetadata
30import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
30 31
31class GameInfoFragment : Fragment() { 32class GameInfoFragment : Fragment() {
32 private var _binding: FragmentGameInfoBinding? = null 33 private var _binding: FragmentGameInfoBinding? = null
@@ -122,11 +123,13 @@ class GameInfoFragment : Fragment() {
122 titleId = R.string.verify_success, 123 titleId = R.string.verify_success,
123 descriptionId = R.string.operation_completed_successfully 124 descriptionId = R.string.operation_completed_successfully
124 ) 125 )
126
125 GameVerificationResult.Failed -> 127 GameVerificationResult.Failed ->
126 MessageDialogFragment.newInstance( 128 MessageDialogFragment.newInstance(
127 titleId = R.string.verify_failure, 129 titleId = R.string.verify_failure,
128 descriptionId = R.string.verify_failure_description 130 descriptionId = R.string.verify_failure_description
129 ) 131 )
132
130 GameVerificationResult.NotImplemented -> 133 GameVerificationResult.NotImplemented ->
131 MessageDialogFragment.newInstance( 134 MessageDialogFragment.newInstance(
132 titleId = R.string.verify_no_result, 135 titleId = R.string.verify_no_result,
@@ -165,15 +168,8 @@ class GameInfoFragment : Fragment() {
165 val leftInsets = barInsets.left + cutoutInsets.left 168 val leftInsets = barInsets.left + cutoutInsets.left
166 val rightInsets = barInsets.right + cutoutInsets.right 169 val rightInsets = barInsets.right + cutoutInsets.right
167 170
168 val mlpToolbar = binding.toolbarInfo.layoutParams as ViewGroup.MarginLayoutParams 171 binding.toolbarInfo.updateMargins(left = leftInsets, right = rightInsets)
169 mlpToolbar.leftMargin = leftInsets 172 binding.scrollInfo.updateMargins(left = leftInsets, right = rightInsets)
170 mlpToolbar.rightMargin = rightInsets
171 binding.toolbarInfo.layoutParams = mlpToolbar
172
173 val mlpScrollAbout = binding.scrollInfo.layoutParams as ViewGroup.MarginLayoutParams
174 mlpScrollAbout.leftMargin = leftInsets
175 mlpScrollAbout.rightMargin = rightInsets
176 binding.scrollInfo.layoutParams = mlpScrollAbout
177 173
178 binding.contentInfo.updatePadding(bottom = barInsets.bottom) 174 binding.contentInfo.updatePadding(bottom = barInsets.bottom)
179 175
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GamePropertiesFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GamePropertiesFragment.kt
index 582df0133..d14b2c634 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GamePropertiesFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GamePropertiesFragment.kt
@@ -46,6 +46,7 @@ import org.yuzu.yuzu_emu.utils.FileUtil
46import org.yuzu.yuzu_emu.utils.GameIconUtils 46import org.yuzu.yuzu_emu.utils.GameIconUtils
47import org.yuzu.yuzu_emu.utils.GpuDriverHelper 47import org.yuzu.yuzu_emu.utils.GpuDriverHelper
48import org.yuzu.yuzu_emu.utils.MemoryUtil 48import org.yuzu.yuzu_emu.utils.MemoryUtil
49import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
49import java.io.BufferedOutputStream 50import java.io.BufferedOutputStream
50import java.io.File 51import java.io.File
51 52
@@ -320,46 +321,25 @@ class GamePropertiesFragment : Fragment() {
320 321
321 val smallLayout = resources.getBoolean(R.bool.small_layout) 322 val smallLayout = resources.getBoolean(R.bool.small_layout)
322 if (smallLayout) { 323 if (smallLayout) {
323 val mlpListAll = 324 binding.listAll.updateMargins(left = leftInsets, right = rightInsets)
324 binding.listAll.layoutParams as ViewGroup.MarginLayoutParams
325 mlpListAll.leftMargin = leftInsets
326 mlpListAll.rightMargin = rightInsets
327 binding.listAll.layoutParams = mlpListAll
328 } else { 325 } else {
329 if (ViewCompat.getLayoutDirection(binding.root) == 326 if (ViewCompat.getLayoutDirection(binding.root) ==
330 ViewCompat.LAYOUT_DIRECTION_LTR 327 ViewCompat.LAYOUT_DIRECTION_LTR
331 ) { 328 ) {
332 val mlpListAll = 329 binding.listAll.updateMargins(right = rightInsets)
333 binding.listAll.layoutParams as ViewGroup.MarginLayoutParams 330 binding.iconLayout!!.updateMargins(top = barInsets.top, left = leftInsets)
334 mlpListAll.rightMargin = rightInsets
335 binding.listAll.layoutParams = mlpListAll
336
337 val mlpIconLayout =
338 binding.iconLayout!!.layoutParams as ViewGroup.MarginLayoutParams
339 mlpIconLayout.topMargin = barInsets.top
340 mlpIconLayout.leftMargin = leftInsets
341 binding.iconLayout!!.layoutParams = mlpIconLayout
342 } else { 331 } else {
343 val mlpListAll = 332 binding.listAll.updateMargins(left = leftInsets)
344 binding.listAll.layoutParams as ViewGroup.MarginLayoutParams 333 binding.iconLayout!!.updateMargins(top = barInsets.top, right = rightInsets)
345 mlpListAll.leftMargin = leftInsets
346 binding.listAll.layoutParams = mlpListAll
347
348 val mlpIconLayout =
349 binding.iconLayout!!.layoutParams as ViewGroup.MarginLayoutParams
350 mlpIconLayout.topMargin = barInsets.top
351 mlpIconLayout.rightMargin = rightInsets
352 binding.iconLayout!!.layoutParams = mlpIconLayout
353 } 334 }
354 } 335 }
355 336
356 val fabSpacing = resources.getDimensionPixelSize(R.dimen.spacing_fab) 337 val fabSpacing = resources.getDimensionPixelSize(R.dimen.spacing_fab)
357 val mlpFab = 338 binding.buttonStart.updateMargins(
358 binding.buttonStart.layoutParams as ViewGroup.MarginLayoutParams 339 left = leftInsets + fabSpacing,
359 mlpFab.leftMargin = leftInsets + fabSpacing 340 right = rightInsets + fabSpacing,
360 mlpFab.rightMargin = rightInsets + fabSpacing 341 bottom = barInsets.bottom + fabSpacing
361 mlpFab.bottomMargin = barInsets.bottom + fabSpacing 342 )
362 binding.buttonStart.layoutParams = mlpFab
363 343
364 binding.layoutAll.updatePadding( 344 binding.layoutAll.updatePadding(
365 top = barInsets.top, 345 top = barInsets.top,
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt
index 1f3578b22..87e130d3e 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt
@@ -12,7 +12,6 @@ import android.provider.DocumentsContract
12import android.view.LayoutInflater 12import android.view.LayoutInflater
13import android.view.View 13import android.view.View
14import android.view.ViewGroup 14import android.view.ViewGroup
15import android.view.ViewGroup.MarginLayoutParams
16import android.widget.Toast 15import android.widget.Toast
17import androidx.appcompat.app.AppCompatActivity 16import androidx.appcompat.app.AppCompatActivity
18import androidx.core.app.ActivityCompat 17import androidx.core.app.ActivityCompat
@@ -44,6 +43,7 @@ import org.yuzu.yuzu_emu.ui.main.MainActivity
44import org.yuzu.yuzu_emu.utils.FileUtil 43import org.yuzu.yuzu_emu.utils.FileUtil
45import org.yuzu.yuzu_emu.utils.GpuDriverHelper 44import org.yuzu.yuzu_emu.utils.GpuDriverHelper
46import org.yuzu.yuzu_emu.utils.Log 45import org.yuzu.yuzu_emu.utils.Log
46import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
47 47
48class HomeSettingsFragment : Fragment() { 48class HomeSettingsFragment : Fragment() {
49 private var _binding: FragmentHomeSettingsBinding? = null 49 private var _binding: FragmentHomeSettingsBinding? = null
@@ -408,10 +408,7 @@ class HomeSettingsFragment : Fragment() {
408 bottom = barInsets.bottom 408 bottom = barInsets.bottom
409 ) 409 )
410 410
411 val mlpScrollSettings = binding.scrollViewSettings.layoutParams as MarginLayoutParams 411 binding.scrollViewSettings.updateMargins(left = leftInsets, right = rightInsets)
412 mlpScrollSettings.leftMargin = leftInsets
413 mlpScrollSettings.rightMargin = rightInsets
414 binding.scrollViewSettings.layoutParams = mlpScrollSettings
415 412
416 binding.linearLayoutSettings.updatePadding(bottom = spacingNavigation) 413 binding.linearLayoutSettings.updatePadding(bottom = spacingNavigation)
417 414
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/InstallableFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/InstallableFragment.kt
index 7df8e6bf4..63112dc6f 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/InstallableFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/InstallableFragment.kt
@@ -34,6 +34,7 @@ import org.yuzu.yuzu_emu.model.TaskState
34import org.yuzu.yuzu_emu.ui.main.MainActivity 34import org.yuzu.yuzu_emu.ui.main.MainActivity
35import org.yuzu.yuzu_emu.utils.DirectoryInitialization 35import org.yuzu.yuzu_emu.utils.DirectoryInitialization
36import org.yuzu.yuzu_emu.utils.FileUtil 36import org.yuzu.yuzu_emu.utils.FileUtil
37import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
37import java.io.BufferedOutputStream 38import java.io.BufferedOutputStream
38import java.io.File 39import java.io.File
39import java.math.BigInteger 40import java.math.BigInteger
@@ -172,16 +173,8 @@ class InstallableFragment : Fragment() {
172 val leftInsets = barInsets.left + cutoutInsets.left 173 val leftInsets = barInsets.left + cutoutInsets.left
173 val rightInsets = barInsets.right + cutoutInsets.right 174 val rightInsets = barInsets.right + cutoutInsets.right
174 175
175 val mlpAppBar = binding.toolbarInstallables.layoutParams as ViewGroup.MarginLayoutParams 176 binding.toolbarInstallables.updateMargins(left = leftInsets, right = rightInsets)
176 mlpAppBar.leftMargin = leftInsets 177 binding.listInstallables.updateMargins(left = leftInsets, right = rightInsets)
177 mlpAppBar.rightMargin = rightInsets
178 binding.toolbarInstallables.layoutParams = mlpAppBar
179
180 val mlpScrollAbout =
181 binding.listInstallables.layoutParams as ViewGroup.MarginLayoutParams
182 mlpScrollAbout.leftMargin = leftInsets
183 mlpScrollAbout.rightMargin = rightInsets
184 binding.listInstallables.layoutParams = mlpScrollAbout
185 178
186 binding.listInstallables.updatePadding(bottom = barInsets.bottom) 179 binding.listInstallables.updatePadding(bottom = barInsets.bottom)
187 180
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/LicensesFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/LicensesFragment.kt
index b6e9129f7..f17f621f8 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/LicensesFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/LicensesFragment.kt
@@ -7,7 +7,6 @@ import android.os.Bundle
7import android.view.LayoutInflater 7import android.view.LayoutInflater
8import android.view.View 8import android.view.View
9import android.view.ViewGroup 9import android.view.ViewGroup
10import android.view.ViewGroup.MarginLayoutParams
11import androidx.appcompat.app.AppCompatActivity 10import androidx.appcompat.app.AppCompatActivity
12import androidx.core.view.ViewCompat 11import androidx.core.view.ViewCompat
13import androidx.core.view.WindowInsetsCompat 12import androidx.core.view.WindowInsetsCompat
@@ -22,6 +21,7 @@ import org.yuzu.yuzu_emu.adapters.LicenseAdapter
22import org.yuzu.yuzu_emu.databinding.FragmentLicensesBinding 21import org.yuzu.yuzu_emu.databinding.FragmentLicensesBinding
23import org.yuzu.yuzu_emu.model.HomeViewModel 22import org.yuzu.yuzu_emu.model.HomeViewModel
24import org.yuzu.yuzu_emu.model.License 23import org.yuzu.yuzu_emu.model.License
24import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
25 25
26class LicensesFragment : Fragment() { 26class LicensesFragment : Fragment() {
27 private var _binding: FragmentLicensesBinding? = null 27 private var _binding: FragmentLicensesBinding? = null
@@ -122,15 +122,8 @@ class LicensesFragment : Fragment() {
122 val leftInsets = barInsets.left + cutoutInsets.left 122 val leftInsets = barInsets.left + cutoutInsets.left
123 val rightInsets = barInsets.right + cutoutInsets.right 123 val rightInsets = barInsets.right + cutoutInsets.right
124 124
125 val mlpAppBar = binding.appbarLicenses.layoutParams as MarginLayoutParams 125 binding.appbarLicenses.updateMargins(left = leftInsets, right = rightInsets)
126 mlpAppBar.leftMargin = leftInsets 126 binding.listLicenses.updateMargins(left = leftInsets, right = rightInsets)
127 mlpAppBar.rightMargin = rightInsets
128 binding.appbarLicenses.layoutParams = mlpAppBar
129
130 val mlpScrollAbout = binding.listLicenses.layoutParams as MarginLayoutParams
131 mlpScrollAbout.leftMargin = leftInsets
132 mlpScrollAbout.rightMargin = rightInsets
133 binding.listLicenses.layoutParams = mlpScrollAbout
134 127
135 binding.listLicenses.updatePadding(bottom = barInsets.bottom) 128 binding.listLicenses.updatePadding(bottom = barInsets.bottom)
136 129
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SettingsSearchFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SettingsSearchFragment.kt
index f95d545bf..a135b80b4 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SettingsSearchFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SettingsSearchFragment.kt
@@ -29,6 +29,7 @@ import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem
29import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter 29import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter
30import org.yuzu.yuzu_emu.model.SettingsViewModel 30import org.yuzu.yuzu_emu.model.SettingsViewModel
31import org.yuzu.yuzu_emu.utils.NativeConfig 31import org.yuzu.yuzu_emu.utils.NativeConfig
32import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
32 33
33class SettingsSearchFragment : Fragment() { 34class SettingsSearchFragment : Fragment() {
34 private var _binding: FragmentSettingsSearchBinding? = null 35 private var _binding: FragmentSettingsSearchBinding? = null
@@ -174,15 +175,14 @@ class SettingsSearchFragment : Fragment() {
174 bottom = barInsets.bottom 175 bottom = barInsets.bottom
175 ) 176 )
176 177
177 val mlpSettingsList = binding.settingsList.layoutParams as ViewGroup.MarginLayoutParams 178 binding.settingsList.updateMargins(
178 mlpSettingsList.leftMargin = leftInsets + sideMargin 179 left = leftInsets + sideMargin,
179 mlpSettingsList.rightMargin = rightInsets + sideMargin 180 right = rightInsets + sideMargin
180 binding.settingsList.layoutParams = mlpSettingsList 181 )
181 182 binding.divider.updateMargins(
182 val mlpDivider = binding.divider.layoutParams as ViewGroup.MarginLayoutParams 183 left = leftInsets + sideMargin,
183 mlpDivider.leftMargin = leftInsets + sideMargin 184 right = rightInsets + sideMargin
184 mlpDivider.rightMargin = rightInsets + sideMargin 185 )
185 binding.divider.layoutParams = mlpDivider
186 186
187 windowInsets 187 windowInsets
188 } 188 }
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt
index 54380323e..23ca49b53 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt
@@ -8,7 +8,6 @@ import android.os.Bundle
8import android.view.LayoutInflater 8import android.view.LayoutInflater
9import android.view.View 9import android.view.View
10import android.view.ViewGroup 10import android.view.ViewGroup
11import android.view.ViewGroup.MarginLayoutParams
12import androidx.appcompat.app.AppCompatActivity 11import androidx.appcompat.app.AppCompatActivity
13import androidx.core.view.ViewCompat 12import androidx.core.view.ViewCompat
14import androidx.core.view.WindowInsetsCompat 13import androidx.core.view.WindowInsetsCompat
@@ -27,6 +26,7 @@ import org.yuzu.yuzu_emu.databinding.FragmentGamesBinding
27import org.yuzu.yuzu_emu.layout.AutofitGridLayoutManager 26import org.yuzu.yuzu_emu.layout.AutofitGridLayoutManager
28import org.yuzu.yuzu_emu.model.GamesViewModel 27import org.yuzu.yuzu_emu.model.GamesViewModel
29import org.yuzu.yuzu_emu.model.HomeViewModel 28import org.yuzu.yuzu_emu.model.HomeViewModel
29import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
30 30
31class GamesFragment : Fragment() { 31class GamesFragment : Fragment() {
32 private var _binding: FragmentGamesBinding? = null 32 private var _binding: FragmentGamesBinding? = null
@@ -169,15 +169,16 @@ class GamesFragment : Fragment() {
169 169
170 val leftInsets = barInsets.left + cutoutInsets.left 170 val leftInsets = barInsets.left + cutoutInsets.left
171 val rightInsets = barInsets.right + cutoutInsets.right 171 val rightInsets = barInsets.right + cutoutInsets.right
172 val mlpSwipe = binding.swipeRefresh.layoutParams as MarginLayoutParams 172 val left: Int
173 val right: Int
173 if (ViewCompat.getLayoutDirection(view) == ViewCompat.LAYOUT_DIRECTION_LTR) { 174 if (ViewCompat.getLayoutDirection(view) == ViewCompat.LAYOUT_DIRECTION_LTR) {
174 mlpSwipe.leftMargin = leftInsets + spacingNavigationRail 175 left = leftInsets + spacingNavigationRail
175 mlpSwipe.rightMargin = rightInsets 176 right = rightInsets
176 } else { 177 } else {
177 mlpSwipe.leftMargin = leftInsets 178 left = leftInsets
178 mlpSwipe.rightMargin = rightInsets + spacingNavigationRail 179 right = rightInsets + spacingNavigationRail
179 } 180 }
180 binding.swipeRefresh.layoutParams = mlpSwipe 181 binding.swipeRefresh.updateMargins(left = left, right = right)
181 182
182 binding.noticeText.updatePadding(bottom = spacingNavigation) 183 binding.noticeText.updatePadding(bottom = spacingNavigation)
183 184
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/ViewUtils.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/ViewUtils.kt
index f9a3e4126..ffbfa9337 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/ViewUtils.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/ViewUtils.kt
@@ -4,6 +4,7 @@
4package org.yuzu.yuzu_emu.utils 4package org.yuzu.yuzu_emu.utils
5 5
6import android.view.View 6import android.view.View
7import android.view.ViewGroup
7 8
8object ViewUtils { 9object ViewUtils {
9 fun showView(view: View, length: Long = 300) { 10 fun showView(view: View, length: Long = 300) {
@@ -32,4 +33,28 @@ object ViewUtils {
32 view.visibility = View.INVISIBLE 33 view.visibility = View.INVISIBLE
33 }.start() 34 }.start()
34 } 35 }
36
37 fun View.updateMargins(
38 left: Int = -1,
39 top: Int = -1,
40 right: Int = -1,
41 bottom: Int = -1
42 ) {
43 val layoutParams = this.layoutParams as ViewGroup.MarginLayoutParams
44 layoutParams.apply {
45 if (left != -1) {
46 leftMargin = left
47 }
48 if (top != -1) {
49 topMargin = top
50 }
51 if (right != -1) {
52 rightMargin = right
53 }
54 if (bottom != -1) {
55 bottomMargin = bottom
56 }
57 }
58 this.layoutParams = layoutParams
59 }
35} 60}
diff --git a/src/android/app/src/main/jni/android_settings.h b/src/android/app/src/main/jni/android_settings.h
index cf93304da..4a3bc8e53 100644
--- a/src/android/app/src/main/jni/android_settings.h
+++ b/src/android/app/src/main/jni/android_settings.h
@@ -60,6 +60,8 @@ struct Values {
60 Settings::Category::Overlay}; 60 Settings::Category::Overlay};
61 Settings::Setting<bool> show_performance_overlay{linkage, true, "show_performance_overlay", 61 Settings::Setting<bool> show_performance_overlay{linkage, true, "show_performance_overlay",
62 Settings::Category::Overlay}; 62 Settings::Category::Overlay};
63 Settings::Setting<bool> show_thermal_overlay{linkage, false, "show_thermal_overlay",
64 Settings::Category::Overlay};
63 Settings::Setting<bool> show_input_overlay{linkage, true, "show_input_overlay", 65 Settings::Setting<bool> show_input_overlay{linkage, true, "show_input_overlay",
64 Settings::Category::Overlay}; 66 Settings::Category::Overlay};
65 Settings::Setting<bool> touchscreen{linkage, true, "touchscreen", Settings::Category::Overlay}; 67 Settings::Setting<bool> touchscreen{linkage, true, "touchscreen", Settings::Category::Overlay};
diff --git a/src/android/app/src/main/res/layout/fragment_emulation.xml b/src/android/app/src/main/res/layout/fragment_emulation.xml
index 0d2bfe8d6..e99a15783 100644
--- a/src/android/app/src/main/res/layout/fragment_emulation.xml
+++ b/src/android/app/src/main/res/layout/fragment_emulation.xml
@@ -140,6 +140,7 @@
140 android:id="@+id/overlay_container" 140 android:id="@+id/overlay_container"
141 android:layout_width="match_parent" 141 android:layout_width="match_parent"
142 android:layout_height="match_parent" 142 android:layout_height="match_parent"
143 android:layout_marginHorizontal="20dp"
143 android:fitsSystemWindows="true"> 144 android:fitsSystemWindows="true">
144 145
145 <com.google.android.material.textview.MaterialTextView 146 <com.google.android.material.textview.MaterialTextView
@@ -150,7 +151,19 @@
150 android:layout_gravity="left" 151 android:layout_gravity="left"
151 android:clickable="false" 152 android:clickable="false"
152 android:focusable="false" 153 android:focusable="false"
153 android:paddingHorizontal="20dp" 154 android:textColor="@android:color/white"
155 android:shadowColor="@android:color/black"
156 android:shadowRadius="3"
157 tools:ignore="RtlHardcoded" />
158
159 <com.google.android.material.textview.MaterialTextView
160 android:id="@+id/show_thermals_text"
161 style="@style/TextAppearance.Material3.BodySmall"
162 android:layout_width="wrap_content"
163 android:layout_height="wrap_content"
164 android:layout_gravity="right"
165 android:clickable="false"
166 android:focusable="false"
154 android:textColor="@android:color/white" 167 android:textColor="@android:color/white"
155 android:shadowColor="@android:color/black" 168 android:shadowColor="@android:color/black"
156 android:shadowRadius="3" 169 android:shadowRadius="3"
diff --git a/src/android/app/src/main/res/menu/menu_overlay_options.xml b/src/android/app/src/main/res/menu/menu_overlay_options.xml
index 363781652..a9e807427 100644
--- a/src/android/app/src/main/res/menu/menu_overlay_options.xml
+++ b/src/android/app/src/main/res/menu/menu_overlay_options.xml
@@ -7,6 +7,11 @@
7 android:checkable="true" /> 7 android:checkable="true" />
8 8
9 <item 9 <item
10 android:id="@+id/thermal_indicator"
11 android:title="@string/emulation_thermal_indicator"
12 android:checkable="true" />
13
14 <item
10 android:id="@+id/menu_edit_overlay" 15 android:id="@+id/menu_edit_overlay"
11 android:title="@string/emulation_touch_overlay_edit" /> 16 android:title="@string/emulation_touch_overlay_edit" />
12 17
diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml
index 775099415..489e00107 100644
--- a/src/android/app/src/main/res/values/strings.xml
+++ b/src/android/app/src/main/res/values/strings.xml
@@ -376,6 +376,7 @@
376 <string name="emulation_exit">Exit emulation</string> 376 <string name="emulation_exit">Exit emulation</string>
377 <string name="emulation_done">Done</string> 377 <string name="emulation_done">Done</string>
378 <string name="emulation_fps_counter">FPS counter</string> 378 <string name="emulation_fps_counter">FPS counter</string>
379 <string name="emulation_thermal_indicator">Thermal indicator</string>
379 <string name="emulation_toggle_controls">Toggle controls</string> 380 <string name="emulation_toggle_controls">Toggle controls</string>
380 <string name="emulation_rel_stick_center">Relative stick center</string> 381 <string name="emulation_rel_stick_center">Relative stick center</string>
381 <string name="emulation_dpad_slide">D-pad slide</string> 382 <string name="emulation_dpad_slide">D-pad slide</string>