mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-18 19:41:01 +01:00
Merge pull request #12968 from t895/thermal-status
android: Thermal throttling indicator
This commit is contained in:
commit
89dd0fa932
21 changed files with 178 additions and 166 deletions
|
@ -25,7 +25,8 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting {
|
||||||
HAPTIC_FEEDBACK("haptic_feedback"),
|
HAPTIC_FEEDBACK("haptic_feedback"),
|
||||||
SHOW_PERFORMANCE_OVERLAY("show_performance_overlay"),
|
SHOW_PERFORMANCE_OVERLAY("show_performance_overlay"),
|
||||||
SHOW_INPUT_OVERLAY("show_input_overlay"),
|
SHOW_INPUT_OVERLAY("show_input_overlay"),
|
||||||
TOUCHSCREEN("touchscreen");
|
TOUCHSCREEN("touchscreen"),
|
||||||
|
SHOW_THERMAL_OVERLAY("show_thermal_overlay");
|
||||||
|
|
||||||
override fun getBoolean(needsGlobal: Boolean): Boolean =
|
override fun getBoolean(needsGlobal: Boolean): Boolean =
|
||||||
NativeConfig.getBoolean(key, needsGlobal)
|
NativeConfig.getBoolean(key, needsGlobal)
|
||||||
|
|
|
@ -8,7 +8,6 @@ import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.ViewGroup.MarginLayoutParams
|
|
||||||
import androidx.core.view.ViewCompat
|
import androidx.core.view.ViewCompat
|
||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
import androidx.core.view.updatePadding
|
import androidx.core.view.updatePadding
|
||||||
|
@ -27,6 +26,7 @@ import org.yuzu.yuzu_emu.R
|
||||||
import org.yuzu.yuzu_emu.databinding.FragmentSettingsBinding
|
import org.yuzu.yuzu_emu.databinding.FragmentSettingsBinding
|
||||||
import org.yuzu.yuzu_emu.features.settings.model.Settings
|
import org.yuzu.yuzu_emu.features.settings.model.Settings
|
||||||
import org.yuzu.yuzu_emu.model.SettingsViewModel
|
import org.yuzu.yuzu_emu.model.SettingsViewModel
|
||||||
|
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
|
||||||
|
|
||||||
class SettingsFragment : Fragment() {
|
class SettingsFragment : Fragment() {
|
||||||
private lateinit var presenter: SettingsFragmentPresenter
|
private lateinit var presenter: SettingsFragmentPresenter
|
||||||
|
@ -125,18 +125,10 @@ class SettingsFragment : Fragment() {
|
||||||
val leftInsets = barInsets.left + cutoutInsets.left
|
val leftInsets = barInsets.left + cutoutInsets.left
|
||||||
val rightInsets = barInsets.right + cutoutInsets.right
|
val rightInsets = barInsets.right + cutoutInsets.right
|
||||||
|
|
||||||
val mlpSettingsList = binding.listSettings.layoutParams as MarginLayoutParams
|
binding.listSettings.updateMargins(left = leftInsets, right = rightInsets)
|
||||||
mlpSettingsList.leftMargin = leftInsets
|
binding.listSettings.updatePadding(bottom = barInsets.bottom)
|
||||||
mlpSettingsList.rightMargin = rightInsets
|
|
||||||
binding.listSettings.layoutParams = mlpSettingsList
|
|
||||||
binding.listSettings.updatePadding(
|
|
||||||
bottom = barInsets.bottom
|
|
||||||
)
|
|
||||||
|
|
||||||
val mlpAppBar = binding.appbarSettings.layoutParams as MarginLayoutParams
|
binding.appbarSettings.updateMargins(left = leftInsets, right = rightInsets)
|
||||||
mlpAppBar.leftMargin = leftInsets
|
|
||||||
mlpAppBar.rightMargin = rightInsets
|
|
||||||
binding.appbarSettings.layoutParams = mlpAppBar
|
|
||||||
windowInsets
|
windowInsets
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.ViewGroup.MarginLayoutParams
|
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.core.view.ViewCompat
|
import androidx.core.view.ViewCompat
|
||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
|
@ -26,6 +25,7 @@ import org.yuzu.yuzu_emu.BuildConfig
|
||||||
import org.yuzu.yuzu_emu.R
|
import org.yuzu.yuzu_emu.R
|
||||||
import org.yuzu.yuzu_emu.databinding.FragmentAboutBinding
|
import org.yuzu.yuzu_emu.databinding.FragmentAboutBinding
|
||||||
import org.yuzu.yuzu_emu.model.HomeViewModel
|
import org.yuzu.yuzu_emu.model.HomeViewModel
|
||||||
|
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
|
||||||
|
|
||||||
class AboutFragment : Fragment() {
|
class AboutFragment : Fragment() {
|
||||||
private var _binding: FragmentAboutBinding? = null
|
private var _binding: FragmentAboutBinding? = null
|
||||||
|
@ -114,15 +114,8 @@ class AboutFragment : Fragment() {
|
||||||
val leftInsets = barInsets.left + cutoutInsets.left
|
val leftInsets = barInsets.left + cutoutInsets.left
|
||||||
val rightInsets = barInsets.right + cutoutInsets.right
|
val rightInsets = barInsets.right + cutoutInsets.right
|
||||||
|
|
||||||
val mlpToolbar = binding.toolbarAbout.layoutParams as MarginLayoutParams
|
binding.toolbarAbout.updateMargins(left = leftInsets, right = rightInsets)
|
||||||
mlpToolbar.leftMargin = leftInsets
|
binding.scrollAbout.updateMargins(left = leftInsets, right = rightInsets)
|
||||||
mlpToolbar.rightMargin = rightInsets
|
|
||||||
binding.toolbarAbout.layoutParams = mlpToolbar
|
|
||||||
|
|
||||||
val mlpScrollAbout = binding.scrollAbout.layoutParams as MarginLayoutParams
|
|
||||||
mlpScrollAbout.leftMargin = leftInsets
|
|
||||||
mlpScrollAbout.rightMargin = rightInsets
|
|
||||||
binding.scrollAbout.layoutParams = mlpScrollAbout
|
|
||||||
|
|
||||||
binding.contentAbout.updatePadding(bottom = barInsets.bottom)
|
binding.contentAbout.updatePadding(bottom = barInsets.bottom)
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.yuzu.yuzu_emu.model.AddonViewModel
|
||||||
import org.yuzu.yuzu_emu.model.HomeViewModel
|
import org.yuzu.yuzu_emu.model.HomeViewModel
|
||||||
import org.yuzu.yuzu_emu.utils.AddonUtil
|
import org.yuzu.yuzu_emu.utils.AddonUtil
|
||||||
import org.yuzu.yuzu_emu.utils.FileUtil.copyFilesTo
|
import org.yuzu.yuzu_emu.utils.FileUtil.copyFilesTo
|
||||||
|
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class AddonsFragment : Fragment() {
|
class AddonsFragment : Fragment() {
|
||||||
|
@ -202,27 +203,19 @@ class AddonsFragment : Fragment() {
|
||||||
val leftInsets = barInsets.left + cutoutInsets.left
|
val leftInsets = barInsets.left + cutoutInsets.left
|
||||||
val rightInsets = barInsets.right + cutoutInsets.right
|
val rightInsets = barInsets.right + cutoutInsets.right
|
||||||
|
|
||||||
val mlpToolbar = binding.toolbarAddons.layoutParams as ViewGroup.MarginLayoutParams
|
binding.toolbarAddons.updateMargins(left = leftInsets, right = rightInsets)
|
||||||
mlpToolbar.leftMargin = leftInsets
|
binding.listAddons.updateMargins(left = leftInsets, right = rightInsets)
|
||||||
mlpToolbar.rightMargin = rightInsets
|
|
||||||
binding.toolbarAddons.layoutParams = mlpToolbar
|
|
||||||
|
|
||||||
val mlpAddonsList = binding.listAddons.layoutParams as ViewGroup.MarginLayoutParams
|
|
||||||
mlpAddonsList.leftMargin = leftInsets
|
|
||||||
mlpAddonsList.rightMargin = rightInsets
|
|
||||||
binding.listAddons.layoutParams = mlpAddonsList
|
|
||||||
binding.listAddons.updatePadding(
|
binding.listAddons.updatePadding(
|
||||||
bottom = barInsets.bottom +
|
bottom = barInsets.bottom +
|
||||||
resources.getDimensionPixelSize(R.dimen.spacing_bottom_list_fab)
|
resources.getDimensionPixelSize(R.dimen.spacing_bottom_list_fab)
|
||||||
)
|
)
|
||||||
|
|
||||||
val fabSpacing = resources.getDimensionPixelSize(R.dimen.spacing_fab)
|
val fabSpacing = resources.getDimensionPixelSize(R.dimen.spacing_fab)
|
||||||
val mlpFab =
|
binding.buttonInstall.updateMargins(
|
||||||
binding.buttonInstall.layoutParams as ViewGroup.MarginLayoutParams
|
left = leftInsets + fabSpacing,
|
||||||
mlpFab.leftMargin = leftInsets + fabSpacing
|
right = rightInsets + fabSpacing,
|
||||||
mlpFab.rightMargin = rightInsets + fabSpacing
|
bottom = barInsets.bottom + fabSpacing
|
||||||
mlpFab.bottomMargin = barInsets.bottom + fabSpacing
|
)
|
||||||
binding.buttonInstall.layoutParams = mlpFab
|
|
||||||
|
|
||||||
windowInsets
|
windowInsets
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import org.yuzu.yuzu_emu.databinding.FragmentAppletLauncherBinding
|
||||||
import org.yuzu.yuzu_emu.model.Applet
|
import org.yuzu.yuzu_emu.model.Applet
|
||||||
import org.yuzu.yuzu_emu.model.AppletInfo
|
import org.yuzu.yuzu_emu.model.AppletInfo
|
||||||
import org.yuzu.yuzu_emu.model.HomeViewModel
|
import org.yuzu.yuzu_emu.model.HomeViewModel
|
||||||
|
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
|
||||||
|
|
||||||
class AppletLauncherFragment : Fragment() {
|
class AppletLauncherFragment : Fragment() {
|
||||||
private var _binding: FragmentAppletLauncherBinding? = null
|
private var _binding: FragmentAppletLauncherBinding? = null
|
||||||
|
@ -95,16 +96,8 @@ class AppletLauncherFragment : Fragment() {
|
||||||
val leftInsets = barInsets.left + cutoutInsets.left
|
val leftInsets = barInsets.left + cutoutInsets.left
|
||||||
val rightInsets = barInsets.right + cutoutInsets.right
|
val rightInsets = barInsets.right + cutoutInsets.right
|
||||||
|
|
||||||
val mlpAppBar = binding.toolbarApplets.layoutParams as ViewGroup.MarginLayoutParams
|
binding.toolbarApplets.updateMargins(left = leftInsets, right = rightInsets)
|
||||||
mlpAppBar.leftMargin = leftInsets
|
binding.listApplets.updateMargins(left = leftInsets, right = rightInsets)
|
||||||
mlpAppBar.rightMargin = rightInsets
|
|
||||||
binding.toolbarApplets.layoutParams = mlpAppBar
|
|
||||||
|
|
||||||
val mlpListApplets =
|
|
||||||
binding.listApplets.layoutParams as ViewGroup.MarginLayoutParams
|
|
||||||
mlpListApplets.leftMargin = leftInsets
|
|
||||||
mlpListApplets.rightMargin = rightInsets
|
|
||||||
binding.listApplets.layoutParams = mlpListApplets
|
|
||||||
|
|
||||||
binding.listApplets.updatePadding(bottom = barInsets.bottom)
|
binding.listApplets.updatePadding(bottom = barInsets.bottom)
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.yuzu.yuzu_emu.model.HomeViewModel
|
||||||
import org.yuzu.yuzu_emu.utils.FileUtil
|
import org.yuzu.yuzu_emu.utils.FileUtil
|
||||||
import org.yuzu.yuzu_emu.utils.GpuDriverHelper
|
import org.yuzu.yuzu_emu.utils.GpuDriverHelper
|
||||||
import org.yuzu.yuzu_emu.utils.NativeConfig
|
import org.yuzu.yuzu_emu.utils.NativeConfig
|
||||||
|
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
|
||||||
|
@ -141,23 +142,15 @@ class DriverManagerFragment : Fragment() {
|
||||||
val leftInsets = barInsets.left + cutoutInsets.left
|
val leftInsets = barInsets.left + cutoutInsets.left
|
||||||
val rightInsets = barInsets.right + cutoutInsets.right
|
val rightInsets = barInsets.right + cutoutInsets.right
|
||||||
|
|
||||||
val mlpAppBar = binding.toolbarDrivers.layoutParams as ViewGroup.MarginLayoutParams
|
binding.toolbarDrivers.updateMargins(left = leftInsets, right = rightInsets)
|
||||||
mlpAppBar.leftMargin = leftInsets
|
binding.listDrivers.updateMargins(left = leftInsets, right = rightInsets)
|
||||||
mlpAppBar.rightMargin = rightInsets
|
|
||||||
binding.toolbarDrivers.layoutParams = mlpAppBar
|
|
||||||
|
|
||||||
val mlplistDrivers = binding.listDrivers.layoutParams as ViewGroup.MarginLayoutParams
|
|
||||||
mlplistDrivers.leftMargin = leftInsets
|
|
||||||
mlplistDrivers.rightMargin = rightInsets
|
|
||||||
binding.listDrivers.layoutParams = mlplistDrivers
|
|
||||||
|
|
||||||
val fabSpacing = resources.getDimensionPixelSize(R.dimen.spacing_fab)
|
val fabSpacing = resources.getDimensionPixelSize(R.dimen.spacing_fab)
|
||||||
val mlpFab =
|
binding.buttonInstall.updateMargins(
|
||||||
binding.buttonInstall.layoutParams as ViewGroup.MarginLayoutParams
|
left = leftInsets + fabSpacing,
|
||||||
mlpFab.leftMargin = leftInsets + fabSpacing
|
right = rightInsets + fabSpacing,
|
||||||
mlpFab.rightMargin = rightInsets + fabSpacing
|
bottom = barInsets.bottom + fabSpacing
|
||||||
mlpFab.bottomMargin = barInsets.bottom + fabSpacing
|
)
|
||||||
binding.buttonInstall.layoutParams = mlpFab
|
|
||||||
|
|
||||||
binding.listDrivers.updatePadding(
|
binding.listDrivers.updatePadding(
|
||||||
bottom = barInsets.bottom +
|
bottom = barInsets.bottom +
|
||||||
|
|
|
@ -19,6 +19,7 @@ import com.google.android.material.transition.MaterialSharedAxis
|
||||||
import org.yuzu.yuzu_emu.R
|
import org.yuzu.yuzu_emu.R
|
||||||
import org.yuzu.yuzu_emu.databinding.FragmentEarlyAccessBinding
|
import org.yuzu.yuzu_emu.databinding.FragmentEarlyAccessBinding
|
||||||
import org.yuzu.yuzu_emu.model.HomeViewModel
|
import org.yuzu.yuzu_emu.model.HomeViewModel
|
||||||
|
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
|
||||||
|
|
||||||
class EarlyAccessFragment : Fragment() {
|
class EarlyAccessFragment : Fragment() {
|
||||||
private var _binding: FragmentEarlyAccessBinding? = null
|
private var _binding: FragmentEarlyAccessBinding? = null
|
||||||
|
@ -73,10 +74,7 @@ class EarlyAccessFragment : Fragment() {
|
||||||
val leftInsets = barInsets.left + cutoutInsets.left
|
val leftInsets = barInsets.left + cutoutInsets.left
|
||||||
val rightInsets = barInsets.right + cutoutInsets.right
|
val rightInsets = barInsets.right + cutoutInsets.right
|
||||||
|
|
||||||
val mlpAppBar = binding.appbarEa.layoutParams as ViewGroup.MarginLayoutParams
|
binding.appbarEa.updateMargins(left = leftInsets, right = rightInsets)
|
||||||
mlpAppBar.leftMargin = leftInsets
|
|
||||||
mlpAppBar.rightMargin = rightInsets
|
|
||||||
binding.appbarEa.layoutParams = mlpAppBar
|
|
||||||
|
|
||||||
binding.scrollEa.updatePadding(
|
binding.scrollEa.updatePadding(
|
||||||
left = leftInsets,
|
left = leftInsets,
|
||||||
|
|
|
@ -13,6 +13,7 @@ import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
|
import android.os.PowerManager
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
import android.view.*
|
import android.view.*
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
@ -23,6 +24,7 @@ import androidx.core.content.res.ResourcesCompat
|
||||||
import androidx.core.graphics.Insets
|
import androidx.core.graphics.Insets
|
||||||
import androidx.core.view.ViewCompat
|
import androidx.core.view.ViewCompat
|
||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
|
import androidx.core.view.updatePadding
|
||||||
import androidx.drawerlayout.widget.DrawerLayout
|
import androidx.drawerlayout.widget.DrawerLayout
|
||||||
import androidx.drawerlayout.widget.DrawerLayout.DrawerListener
|
import androidx.drawerlayout.widget.DrawerLayout.DrawerListener
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
|
@ -38,7 +40,6 @@ import androidx.window.layout.WindowLayoutInfo
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import com.google.android.material.slider.Slider
|
import com.google.android.material.slider.Slider
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.flow.collect
|
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.yuzu.yuzu_emu.HomeNavigationDirections
|
import org.yuzu.yuzu_emu.HomeNavigationDirections
|
||||||
|
@ -64,6 +65,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
private lateinit var emulationState: EmulationState
|
private lateinit var emulationState: EmulationState
|
||||||
private var emulationActivity: EmulationActivity? = null
|
private var emulationActivity: EmulationActivity? = null
|
||||||
private var perfStatsUpdater: (() -> Unit)? = null
|
private var perfStatsUpdater: (() -> Unit)? = null
|
||||||
|
private var thermalStatsUpdater: (() -> Unit)? = null
|
||||||
|
|
||||||
private var _binding: FragmentEmulationBinding? = null
|
private var _binding: FragmentEmulationBinding? = null
|
||||||
private val binding get() = _binding!!
|
private val binding get() = _binding!!
|
||||||
|
@ -77,6 +79,8 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
|
|
||||||
private var isInFoldableLayout = false
|
private var isInFoldableLayout = false
|
||||||
|
|
||||||
|
private lateinit var powerManager: PowerManager
|
||||||
|
|
||||||
override fun onAttach(context: Context) {
|
override fun onAttach(context: Context) {
|
||||||
super.onAttach(context)
|
super.onAttach(context)
|
||||||
if (context is EmulationActivity) {
|
if (context is EmulationActivity) {
|
||||||
|
@ -102,6 +106,8 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
updateOrientation()
|
updateOrientation()
|
||||||
|
|
||||||
|
powerManager = requireContext().getSystemService(Context.POWER_SERVICE) as PowerManager
|
||||||
|
|
||||||
val intentUri: Uri? = requireActivity().intent.data
|
val intentUri: Uri? = requireActivity().intent.data
|
||||||
var intentGame: Game? = null
|
var intentGame: Game? = null
|
||||||
if (intentUri != null) {
|
if (intentUri != null) {
|
||||||
|
@ -394,8 +400,9 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
|
|
||||||
emulationState.updateSurface()
|
emulationState.updateSurface()
|
||||||
|
|
||||||
// Setup overlay
|
// Setup overlays
|
||||||
updateShowFpsOverlay()
|
updateShowFpsOverlay()
|
||||||
|
updateThermalOverlay()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -553,6 +560,38 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun updateThermalOverlay() {
|
||||||
|
if (BooleanSetting.SHOW_THERMAL_OVERLAY.getBoolean()) {
|
||||||
|
thermalStatsUpdater = {
|
||||||
|
if (emulationViewModel.emulationStarted.value &&
|
||||||
|
!emulationViewModel.isEmulationStopping.value
|
||||||
|
) {
|
||||||
|
val thermalStatus = when (powerManager.currentThermalStatus) {
|
||||||
|
PowerManager.THERMAL_STATUS_LIGHT -> "😥"
|
||||||
|
PowerManager.THERMAL_STATUS_MODERATE -> "🥵"
|
||||||
|
PowerManager.THERMAL_STATUS_SEVERE -> "🔥"
|
||||||
|
PowerManager.THERMAL_STATUS_CRITICAL,
|
||||||
|
PowerManager.THERMAL_STATUS_EMERGENCY,
|
||||||
|
PowerManager.THERMAL_STATUS_SHUTDOWN -> "☢️"
|
||||||
|
|
||||||
|
else -> "🙂"
|
||||||
|
}
|
||||||
|
if (_binding != null) {
|
||||||
|
binding.showThermalsText.text = thermalStatus
|
||||||
|
}
|
||||||
|
thermalStatsUpdateHandler.postDelayed(thermalStatsUpdater!!, 1000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
thermalStatsUpdateHandler.post(thermalStatsUpdater!!)
|
||||||
|
binding.showThermalsText.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
if (thermalStatsUpdater != null) {
|
||||||
|
thermalStatsUpdateHandler.removeCallbacks(thermalStatsUpdater!!)
|
||||||
|
}
|
||||||
|
binding.showThermalsText.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("SourceLockedOrientationActivity")
|
@SuppressLint("SourceLockedOrientationActivity")
|
||||||
private fun updateOrientation() {
|
private fun updateOrientation() {
|
||||||
emulationActivity?.let {
|
emulationActivity?.let {
|
||||||
|
@ -641,6 +680,8 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
popup.menu.apply {
|
popup.menu.apply {
|
||||||
findItem(R.id.menu_toggle_fps).isChecked =
|
findItem(R.id.menu_toggle_fps).isChecked =
|
||||||
BooleanSetting.SHOW_PERFORMANCE_OVERLAY.getBoolean()
|
BooleanSetting.SHOW_PERFORMANCE_OVERLAY.getBoolean()
|
||||||
|
findItem(R.id.thermal_indicator).isChecked =
|
||||||
|
BooleanSetting.SHOW_THERMAL_OVERLAY.getBoolean()
|
||||||
findItem(R.id.menu_rel_stick_center).isChecked =
|
findItem(R.id.menu_rel_stick_center).isChecked =
|
||||||
BooleanSetting.JOYSTICK_REL_CENTER.getBoolean()
|
BooleanSetting.JOYSTICK_REL_CENTER.getBoolean()
|
||||||
findItem(R.id.menu_dpad_slide).isChecked = BooleanSetting.DPAD_SLIDE.getBoolean()
|
findItem(R.id.menu_dpad_slide).isChecked = BooleanSetting.DPAD_SLIDE.getBoolean()
|
||||||
|
@ -660,6 +701,13 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
R.id.thermal_indicator -> {
|
||||||
|
it.isChecked = !it.isChecked
|
||||||
|
BooleanSetting.SHOW_THERMAL_OVERLAY.setBoolean(it.isChecked)
|
||||||
|
updateThermalOverlay()
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
R.id.menu_edit_overlay -> {
|
R.id.menu_edit_overlay -> {
|
||||||
binding.drawerLayout.close()
|
binding.drawerLayout.close()
|
||||||
binding.surfaceInputOverlay.requestFocus()
|
binding.surfaceInputOverlay.requestFocus()
|
||||||
|
@ -850,7 +898,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
right = cutInsets.right
|
right = cutInsets.right
|
||||||
}
|
}
|
||||||
|
|
||||||
v.setPadding(left, cutInsets.top, right, 0)
|
v.updatePadding(left = left, top = cutInsets.top, right = right)
|
||||||
windowInsets
|
windowInsets
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1003,5 +1051,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val perfStatsUpdateHandler = Handler(Looper.myLooper()!!)
|
private val perfStatsUpdateHandler = Handler(Looper.myLooper()!!)
|
||||||
|
private val thermalStatsUpdateHandler = Handler(Looper.myLooper()!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.yuzu.yuzu_emu.databinding.FragmentFoldersBinding
|
||||||
import org.yuzu.yuzu_emu.model.GamesViewModel
|
import org.yuzu.yuzu_emu.model.GamesViewModel
|
||||||
import org.yuzu.yuzu_emu.model.HomeViewModel
|
import org.yuzu.yuzu_emu.model.HomeViewModel
|
||||||
import org.yuzu.yuzu_emu.ui.main.MainActivity
|
import org.yuzu.yuzu_emu.ui.main.MainActivity
|
||||||
|
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
|
||||||
|
|
||||||
class GameFoldersFragment : Fragment() {
|
class GameFoldersFragment : Fragment() {
|
||||||
private var _binding: FragmentFoldersBinding? = null
|
private var _binding: FragmentFoldersBinding? = null
|
||||||
|
@ -100,23 +101,16 @@ class GameFoldersFragment : Fragment() {
|
||||||
val leftInsets = barInsets.left + cutoutInsets.left
|
val leftInsets = barInsets.left + cutoutInsets.left
|
||||||
val rightInsets = barInsets.right + cutoutInsets.right
|
val rightInsets = barInsets.right + cutoutInsets.right
|
||||||
|
|
||||||
val mlpToolbar = binding.toolbarFolders.layoutParams as ViewGroup.MarginLayoutParams
|
binding.toolbarFolders.updateMargins(left = leftInsets, right = rightInsets)
|
||||||
mlpToolbar.leftMargin = leftInsets
|
|
||||||
mlpToolbar.rightMargin = rightInsets
|
|
||||||
binding.toolbarFolders.layoutParams = mlpToolbar
|
|
||||||
|
|
||||||
val fabSpacing = resources.getDimensionPixelSize(R.dimen.spacing_fab)
|
val fabSpacing = resources.getDimensionPixelSize(R.dimen.spacing_fab)
|
||||||
val mlpFab =
|
binding.buttonAdd.updateMargins(
|
||||||
binding.buttonAdd.layoutParams as ViewGroup.MarginLayoutParams
|
left = leftInsets + fabSpacing,
|
||||||
mlpFab.leftMargin = leftInsets + fabSpacing
|
right = rightInsets + fabSpacing,
|
||||||
mlpFab.rightMargin = rightInsets + fabSpacing
|
bottom = barInsets.bottom + fabSpacing
|
||||||
mlpFab.bottomMargin = barInsets.bottom + fabSpacing
|
)
|
||||||
binding.buttonAdd.layoutParams = mlpFab
|
|
||||||
|
|
||||||
val mlpListFolders = binding.listFolders.layoutParams as ViewGroup.MarginLayoutParams
|
binding.listFolders.updateMargins(left = leftInsets, right = rightInsets)
|
||||||
mlpListFolders.leftMargin = leftInsets
|
|
||||||
mlpListFolders.rightMargin = rightInsets
|
|
||||||
binding.listFolders.layoutParams = mlpListFolders
|
|
||||||
|
|
||||||
binding.listFolders.updatePadding(
|
binding.listFolders.updatePadding(
|
||||||
bottom = barInsets.bottom +
|
bottom = barInsets.bottom +
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.yuzu.yuzu_emu.databinding.FragmentGameInfoBinding
|
||||||
import org.yuzu.yuzu_emu.model.GameVerificationResult
|
import org.yuzu.yuzu_emu.model.GameVerificationResult
|
||||||
import org.yuzu.yuzu_emu.model.HomeViewModel
|
import org.yuzu.yuzu_emu.model.HomeViewModel
|
||||||
import org.yuzu.yuzu_emu.utils.GameMetadata
|
import org.yuzu.yuzu_emu.utils.GameMetadata
|
||||||
|
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
|
||||||
|
|
||||||
class GameInfoFragment : Fragment() {
|
class GameInfoFragment : Fragment() {
|
||||||
private var _binding: FragmentGameInfoBinding? = null
|
private var _binding: FragmentGameInfoBinding? = null
|
||||||
|
@ -122,11 +123,13 @@ class GameInfoFragment : Fragment() {
|
||||||
titleId = R.string.verify_success,
|
titleId = R.string.verify_success,
|
||||||
descriptionId = R.string.operation_completed_successfully
|
descriptionId = R.string.operation_completed_successfully
|
||||||
)
|
)
|
||||||
|
|
||||||
GameVerificationResult.Failed ->
|
GameVerificationResult.Failed ->
|
||||||
MessageDialogFragment.newInstance(
|
MessageDialogFragment.newInstance(
|
||||||
titleId = R.string.verify_failure,
|
titleId = R.string.verify_failure,
|
||||||
descriptionId = R.string.verify_failure_description
|
descriptionId = R.string.verify_failure_description
|
||||||
)
|
)
|
||||||
|
|
||||||
GameVerificationResult.NotImplemented ->
|
GameVerificationResult.NotImplemented ->
|
||||||
MessageDialogFragment.newInstance(
|
MessageDialogFragment.newInstance(
|
||||||
titleId = R.string.verify_no_result,
|
titleId = R.string.verify_no_result,
|
||||||
|
@ -165,15 +168,8 @@ class GameInfoFragment : Fragment() {
|
||||||
val leftInsets = barInsets.left + cutoutInsets.left
|
val leftInsets = barInsets.left + cutoutInsets.left
|
||||||
val rightInsets = barInsets.right + cutoutInsets.right
|
val rightInsets = barInsets.right + cutoutInsets.right
|
||||||
|
|
||||||
val mlpToolbar = binding.toolbarInfo.layoutParams as ViewGroup.MarginLayoutParams
|
binding.toolbarInfo.updateMargins(left = leftInsets, right = rightInsets)
|
||||||
mlpToolbar.leftMargin = leftInsets
|
binding.scrollInfo.updateMargins(left = leftInsets, right = rightInsets)
|
||||||
mlpToolbar.rightMargin = rightInsets
|
|
||||||
binding.toolbarInfo.layoutParams = mlpToolbar
|
|
||||||
|
|
||||||
val mlpScrollAbout = binding.scrollInfo.layoutParams as ViewGroup.MarginLayoutParams
|
|
||||||
mlpScrollAbout.leftMargin = leftInsets
|
|
||||||
mlpScrollAbout.rightMargin = rightInsets
|
|
||||||
binding.scrollInfo.layoutParams = mlpScrollAbout
|
|
||||||
|
|
||||||
binding.contentInfo.updatePadding(bottom = barInsets.bottom)
|
binding.contentInfo.updatePadding(bottom = barInsets.bottom)
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ import org.yuzu.yuzu_emu.utils.FileUtil
|
||||||
import org.yuzu.yuzu_emu.utils.GameIconUtils
|
import org.yuzu.yuzu_emu.utils.GameIconUtils
|
||||||
import org.yuzu.yuzu_emu.utils.GpuDriverHelper
|
import org.yuzu.yuzu_emu.utils.GpuDriverHelper
|
||||||
import org.yuzu.yuzu_emu.utils.MemoryUtil
|
import org.yuzu.yuzu_emu.utils.MemoryUtil
|
||||||
|
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
|
||||||
import java.io.BufferedOutputStream
|
import java.io.BufferedOutputStream
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
|
@ -320,46 +321,25 @@ class GamePropertiesFragment : Fragment() {
|
||||||
|
|
||||||
val smallLayout = resources.getBoolean(R.bool.small_layout)
|
val smallLayout = resources.getBoolean(R.bool.small_layout)
|
||||||
if (smallLayout) {
|
if (smallLayout) {
|
||||||
val mlpListAll =
|
binding.listAll.updateMargins(left = leftInsets, right = rightInsets)
|
||||||
binding.listAll.layoutParams as ViewGroup.MarginLayoutParams
|
|
||||||
mlpListAll.leftMargin = leftInsets
|
|
||||||
mlpListAll.rightMargin = rightInsets
|
|
||||||
binding.listAll.layoutParams = mlpListAll
|
|
||||||
} else {
|
} else {
|
||||||
if (ViewCompat.getLayoutDirection(binding.root) ==
|
if (ViewCompat.getLayoutDirection(binding.root) ==
|
||||||
ViewCompat.LAYOUT_DIRECTION_LTR
|
ViewCompat.LAYOUT_DIRECTION_LTR
|
||||||
) {
|
) {
|
||||||
val mlpListAll =
|
binding.listAll.updateMargins(right = rightInsets)
|
||||||
binding.listAll.layoutParams as ViewGroup.MarginLayoutParams
|
binding.iconLayout!!.updateMargins(top = barInsets.top, left = leftInsets)
|
||||||
mlpListAll.rightMargin = rightInsets
|
|
||||||
binding.listAll.layoutParams = mlpListAll
|
|
||||||
|
|
||||||
val mlpIconLayout =
|
|
||||||
binding.iconLayout!!.layoutParams as ViewGroup.MarginLayoutParams
|
|
||||||
mlpIconLayout.topMargin = barInsets.top
|
|
||||||
mlpIconLayout.leftMargin = leftInsets
|
|
||||||
binding.iconLayout!!.layoutParams = mlpIconLayout
|
|
||||||
} else {
|
} else {
|
||||||
val mlpListAll =
|
binding.listAll.updateMargins(left = leftInsets)
|
||||||
binding.listAll.layoutParams as ViewGroup.MarginLayoutParams
|
binding.iconLayout!!.updateMargins(top = barInsets.top, right = rightInsets)
|
||||||
mlpListAll.leftMargin = leftInsets
|
|
||||||
binding.listAll.layoutParams = mlpListAll
|
|
||||||
|
|
||||||
val mlpIconLayout =
|
|
||||||
binding.iconLayout!!.layoutParams as ViewGroup.MarginLayoutParams
|
|
||||||
mlpIconLayout.topMargin = barInsets.top
|
|
||||||
mlpIconLayout.rightMargin = rightInsets
|
|
||||||
binding.iconLayout!!.layoutParams = mlpIconLayout
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val fabSpacing = resources.getDimensionPixelSize(R.dimen.spacing_fab)
|
val fabSpacing = resources.getDimensionPixelSize(R.dimen.spacing_fab)
|
||||||
val mlpFab =
|
binding.buttonStart.updateMargins(
|
||||||
binding.buttonStart.layoutParams as ViewGroup.MarginLayoutParams
|
left = leftInsets + fabSpacing,
|
||||||
mlpFab.leftMargin = leftInsets + fabSpacing
|
right = rightInsets + fabSpacing,
|
||||||
mlpFab.rightMargin = rightInsets + fabSpacing
|
bottom = barInsets.bottom + fabSpacing
|
||||||
mlpFab.bottomMargin = barInsets.bottom + fabSpacing
|
)
|
||||||
binding.buttonStart.layoutParams = mlpFab
|
|
||||||
|
|
||||||
binding.layoutAll.updatePadding(
|
binding.layoutAll.updatePadding(
|
||||||
top = barInsets.top,
|
top = barInsets.top,
|
||||||
|
|
|
@ -12,7 +12,6 @@ import android.provider.DocumentsContract
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.ViewGroup.MarginLayoutParams
|
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.app.ActivityCompat
|
import androidx.core.app.ActivityCompat
|
||||||
|
@ -44,6 +43,7 @@ import org.yuzu.yuzu_emu.ui.main.MainActivity
|
||||||
import org.yuzu.yuzu_emu.utils.FileUtil
|
import org.yuzu.yuzu_emu.utils.FileUtil
|
||||||
import org.yuzu.yuzu_emu.utils.GpuDriverHelper
|
import org.yuzu.yuzu_emu.utils.GpuDriverHelper
|
||||||
import org.yuzu.yuzu_emu.utils.Log
|
import org.yuzu.yuzu_emu.utils.Log
|
||||||
|
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
|
||||||
|
|
||||||
class HomeSettingsFragment : Fragment() {
|
class HomeSettingsFragment : Fragment() {
|
||||||
private var _binding: FragmentHomeSettingsBinding? = null
|
private var _binding: FragmentHomeSettingsBinding? = null
|
||||||
|
@ -408,10 +408,7 @@ class HomeSettingsFragment : Fragment() {
|
||||||
bottom = barInsets.bottom
|
bottom = barInsets.bottom
|
||||||
)
|
)
|
||||||
|
|
||||||
val mlpScrollSettings = binding.scrollViewSettings.layoutParams as MarginLayoutParams
|
binding.scrollViewSettings.updateMargins(left = leftInsets, right = rightInsets)
|
||||||
mlpScrollSettings.leftMargin = leftInsets
|
|
||||||
mlpScrollSettings.rightMargin = rightInsets
|
|
||||||
binding.scrollViewSettings.layoutParams = mlpScrollSettings
|
|
||||||
|
|
||||||
binding.linearLayoutSettings.updatePadding(bottom = spacingNavigation)
|
binding.linearLayoutSettings.updatePadding(bottom = spacingNavigation)
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.yuzu.yuzu_emu.model.TaskState
|
||||||
import org.yuzu.yuzu_emu.ui.main.MainActivity
|
import org.yuzu.yuzu_emu.ui.main.MainActivity
|
||||||
import org.yuzu.yuzu_emu.utils.DirectoryInitialization
|
import org.yuzu.yuzu_emu.utils.DirectoryInitialization
|
||||||
import org.yuzu.yuzu_emu.utils.FileUtil
|
import org.yuzu.yuzu_emu.utils.FileUtil
|
||||||
|
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
|
||||||
import java.io.BufferedOutputStream
|
import java.io.BufferedOutputStream
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.math.BigInteger
|
import java.math.BigInteger
|
||||||
|
@ -172,16 +173,8 @@ class InstallableFragment : Fragment() {
|
||||||
val leftInsets = barInsets.left + cutoutInsets.left
|
val leftInsets = barInsets.left + cutoutInsets.left
|
||||||
val rightInsets = barInsets.right + cutoutInsets.right
|
val rightInsets = barInsets.right + cutoutInsets.right
|
||||||
|
|
||||||
val mlpAppBar = binding.toolbarInstallables.layoutParams as ViewGroup.MarginLayoutParams
|
binding.toolbarInstallables.updateMargins(left = leftInsets, right = rightInsets)
|
||||||
mlpAppBar.leftMargin = leftInsets
|
binding.listInstallables.updateMargins(left = leftInsets, right = rightInsets)
|
||||||
mlpAppBar.rightMargin = rightInsets
|
|
||||||
binding.toolbarInstallables.layoutParams = mlpAppBar
|
|
||||||
|
|
||||||
val mlpScrollAbout =
|
|
||||||
binding.listInstallables.layoutParams as ViewGroup.MarginLayoutParams
|
|
||||||
mlpScrollAbout.leftMargin = leftInsets
|
|
||||||
mlpScrollAbout.rightMargin = rightInsets
|
|
||||||
binding.listInstallables.layoutParams = mlpScrollAbout
|
|
||||||
|
|
||||||
binding.listInstallables.updatePadding(bottom = barInsets.bottom)
|
binding.listInstallables.updatePadding(bottom = barInsets.bottom)
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.ViewGroup.MarginLayoutParams
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.view.ViewCompat
|
import androidx.core.view.ViewCompat
|
||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
|
@ -22,6 +21,7 @@ import org.yuzu.yuzu_emu.adapters.LicenseAdapter
|
||||||
import org.yuzu.yuzu_emu.databinding.FragmentLicensesBinding
|
import org.yuzu.yuzu_emu.databinding.FragmentLicensesBinding
|
||||||
import org.yuzu.yuzu_emu.model.HomeViewModel
|
import org.yuzu.yuzu_emu.model.HomeViewModel
|
||||||
import org.yuzu.yuzu_emu.model.License
|
import org.yuzu.yuzu_emu.model.License
|
||||||
|
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
|
||||||
|
|
||||||
class LicensesFragment : Fragment() {
|
class LicensesFragment : Fragment() {
|
||||||
private var _binding: FragmentLicensesBinding? = null
|
private var _binding: FragmentLicensesBinding? = null
|
||||||
|
@ -122,15 +122,8 @@ class LicensesFragment : Fragment() {
|
||||||
val leftInsets = barInsets.left + cutoutInsets.left
|
val leftInsets = barInsets.left + cutoutInsets.left
|
||||||
val rightInsets = barInsets.right + cutoutInsets.right
|
val rightInsets = barInsets.right + cutoutInsets.right
|
||||||
|
|
||||||
val mlpAppBar = binding.appbarLicenses.layoutParams as MarginLayoutParams
|
binding.appbarLicenses.updateMargins(left = leftInsets, right = rightInsets)
|
||||||
mlpAppBar.leftMargin = leftInsets
|
binding.listLicenses.updateMargins(left = leftInsets, right = rightInsets)
|
||||||
mlpAppBar.rightMargin = rightInsets
|
|
||||||
binding.appbarLicenses.layoutParams = mlpAppBar
|
|
||||||
|
|
||||||
val mlpScrollAbout = binding.listLicenses.layoutParams as MarginLayoutParams
|
|
||||||
mlpScrollAbout.leftMargin = leftInsets
|
|
||||||
mlpScrollAbout.rightMargin = rightInsets
|
|
||||||
binding.listLicenses.layoutParams = mlpScrollAbout
|
|
||||||
|
|
||||||
binding.listLicenses.updatePadding(bottom = barInsets.bottom)
|
binding.listLicenses.updatePadding(bottom = barInsets.bottom)
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem
|
||||||
import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter
|
import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter
|
||||||
import org.yuzu.yuzu_emu.model.SettingsViewModel
|
import org.yuzu.yuzu_emu.model.SettingsViewModel
|
||||||
import org.yuzu.yuzu_emu.utils.NativeConfig
|
import org.yuzu.yuzu_emu.utils.NativeConfig
|
||||||
|
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
|
||||||
|
|
||||||
class SettingsSearchFragment : Fragment() {
|
class SettingsSearchFragment : Fragment() {
|
||||||
private var _binding: FragmentSettingsSearchBinding? = null
|
private var _binding: FragmentSettingsSearchBinding? = null
|
||||||
|
@ -174,15 +175,14 @@ class SettingsSearchFragment : Fragment() {
|
||||||
bottom = barInsets.bottom
|
bottom = barInsets.bottom
|
||||||
)
|
)
|
||||||
|
|
||||||
val mlpSettingsList = binding.settingsList.layoutParams as ViewGroup.MarginLayoutParams
|
binding.settingsList.updateMargins(
|
||||||
mlpSettingsList.leftMargin = leftInsets + sideMargin
|
left = leftInsets + sideMargin,
|
||||||
mlpSettingsList.rightMargin = rightInsets + sideMargin
|
right = rightInsets + sideMargin
|
||||||
binding.settingsList.layoutParams = mlpSettingsList
|
)
|
||||||
|
binding.divider.updateMargins(
|
||||||
val mlpDivider = binding.divider.layoutParams as ViewGroup.MarginLayoutParams
|
left = leftInsets + sideMargin,
|
||||||
mlpDivider.leftMargin = leftInsets + sideMargin
|
right = rightInsets + sideMargin
|
||||||
mlpDivider.rightMargin = rightInsets + sideMargin
|
)
|
||||||
binding.divider.layoutParams = mlpDivider
|
|
||||||
|
|
||||||
windowInsets
|
windowInsets
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.ViewGroup.MarginLayoutParams
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.view.ViewCompat
|
import androidx.core.view.ViewCompat
|
||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
|
@ -27,6 +26,7 @@ import org.yuzu.yuzu_emu.databinding.FragmentGamesBinding
|
||||||
import org.yuzu.yuzu_emu.layout.AutofitGridLayoutManager
|
import org.yuzu.yuzu_emu.layout.AutofitGridLayoutManager
|
||||||
import org.yuzu.yuzu_emu.model.GamesViewModel
|
import org.yuzu.yuzu_emu.model.GamesViewModel
|
||||||
import org.yuzu.yuzu_emu.model.HomeViewModel
|
import org.yuzu.yuzu_emu.model.HomeViewModel
|
||||||
|
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
|
||||||
|
|
||||||
class GamesFragment : Fragment() {
|
class GamesFragment : Fragment() {
|
||||||
private var _binding: FragmentGamesBinding? = null
|
private var _binding: FragmentGamesBinding? = null
|
||||||
|
@ -169,15 +169,16 @@ class GamesFragment : Fragment() {
|
||||||
|
|
||||||
val leftInsets = barInsets.left + cutoutInsets.left
|
val leftInsets = barInsets.left + cutoutInsets.left
|
||||||
val rightInsets = barInsets.right + cutoutInsets.right
|
val rightInsets = barInsets.right + cutoutInsets.right
|
||||||
val mlpSwipe = binding.swipeRefresh.layoutParams as MarginLayoutParams
|
val left: Int
|
||||||
|
val right: Int
|
||||||
if (ViewCompat.getLayoutDirection(view) == ViewCompat.LAYOUT_DIRECTION_LTR) {
|
if (ViewCompat.getLayoutDirection(view) == ViewCompat.LAYOUT_DIRECTION_LTR) {
|
||||||
mlpSwipe.leftMargin = leftInsets + spacingNavigationRail
|
left = leftInsets + spacingNavigationRail
|
||||||
mlpSwipe.rightMargin = rightInsets
|
right = rightInsets
|
||||||
} else {
|
} else {
|
||||||
mlpSwipe.leftMargin = leftInsets
|
left = leftInsets
|
||||||
mlpSwipe.rightMargin = rightInsets + spacingNavigationRail
|
right = rightInsets + spacingNavigationRail
|
||||||
}
|
}
|
||||||
binding.swipeRefresh.layoutParams = mlpSwipe
|
binding.swipeRefresh.updateMargins(left = left, right = right)
|
||||||
|
|
||||||
binding.noticeText.updatePadding(bottom = spacingNavigation)
|
binding.noticeText.updatePadding(bottom = spacingNavigation)
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
package org.yuzu.yuzu_emu.utils
|
package org.yuzu.yuzu_emu.utils
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
|
||||||
object ViewUtils {
|
object ViewUtils {
|
||||||
fun showView(view: View, length: Long = 300) {
|
fun showView(view: View, length: Long = 300) {
|
||||||
|
@ -32,4 +33,28 @@ object ViewUtils {
|
||||||
view.visibility = View.INVISIBLE
|
view.visibility = View.INVISIBLE
|
||||||
}.start()
|
}.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun View.updateMargins(
|
||||||
|
left: Int = -1,
|
||||||
|
top: Int = -1,
|
||||||
|
right: Int = -1,
|
||||||
|
bottom: Int = -1
|
||||||
|
) {
|
||||||
|
val layoutParams = this.layoutParams as ViewGroup.MarginLayoutParams
|
||||||
|
layoutParams.apply {
|
||||||
|
if (left != -1) {
|
||||||
|
leftMargin = left
|
||||||
|
}
|
||||||
|
if (top != -1) {
|
||||||
|
topMargin = top
|
||||||
|
}
|
||||||
|
if (right != -1) {
|
||||||
|
rightMargin = right
|
||||||
|
}
|
||||||
|
if (bottom != -1) {
|
||||||
|
bottomMargin = bottom
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.layoutParams = layoutParams
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,8 @@ struct Values {
|
||||||
Settings::Category::Overlay};
|
Settings::Category::Overlay};
|
||||||
Settings::Setting<bool> show_performance_overlay{linkage, true, "show_performance_overlay",
|
Settings::Setting<bool> show_performance_overlay{linkage, true, "show_performance_overlay",
|
||||||
Settings::Category::Overlay};
|
Settings::Category::Overlay};
|
||||||
|
Settings::Setting<bool> show_thermal_overlay{linkage, false, "show_thermal_overlay",
|
||||||
|
Settings::Category::Overlay};
|
||||||
Settings::Setting<bool> show_input_overlay{linkage, true, "show_input_overlay",
|
Settings::Setting<bool> show_input_overlay{linkage, true, "show_input_overlay",
|
||||||
Settings::Category::Overlay};
|
Settings::Category::Overlay};
|
||||||
Settings::Setting<bool> touchscreen{linkage, true, "touchscreen", Settings::Category::Overlay};
|
Settings::Setting<bool> touchscreen{linkage, true, "touchscreen", Settings::Category::Overlay};
|
||||||
|
|
|
@ -140,6 +140,7 @@
|
||||||
android:id="@+id/overlay_container"
|
android:id="@+id/overlay_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginHorizontal="20dp"
|
||||||
android:fitsSystemWindows="true">
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
@ -150,7 +151,19 @@
|
||||||
android:layout_gravity="left"
|
android:layout_gravity="left"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
android:paddingHorizontal="20dp"
|
android:textColor="@android:color/white"
|
||||||
|
android:shadowColor="@android:color/black"
|
||||||
|
android:shadowRadius="3"
|
||||||
|
tools:ignore="RtlHardcoded" />
|
||||||
|
|
||||||
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
android:id="@+id/show_thermals_text"
|
||||||
|
style="@style/TextAppearance.Material3.BodySmall"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="right"
|
||||||
|
android:clickable="false"
|
||||||
|
android:focusable="false"
|
||||||
android:textColor="@android:color/white"
|
android:textColor="@android:color/white"
|
||||||
android:shadowColor="@android:color/black"
|
android:shadowColor="@android:color/black"
|
||||||
android:shadowRadius="3"
|
android:shadowRadius="3"
|
||||||
|
|
|
@ -6,6 +6,11 @@
|
||||||
android:title="@string/emulation_fps_counter"
|
android:title="@string/emulation_fps_counter"
|
||||||
android:checkable="true" />
|
android:checkable="true" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/thermal_indicator"
|
||||||
|
android:title="@string/emulation_thermal_indicator"
|
||||||
|
android:checkable="true" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_edit_overlay"
|
android:id="@+id/menu_edit_overlay"
|
||||||
android:title="@string/emulation_touch_overlay_edit" />
|
android:title="@string/emulation_touch_overlay_edit" />
|
||||||
|
|
|
@ -376,6 +376,7 @@
|
||||||
<string name="emulation_exit">Exit emulation</string>
|
<string name="emulation_exit">Exit emulation</string>
|
||||||
<string name="emulation_done">Done</string>
|
<string name="emulation_done">Done</string>
|
||||||
<string name="emulation_fps_counter">FPS counter</string>
|
<string name="emulation_fps_counter">FPS counter</string>
|
||||||
|
<string name="emulation_thermal_indicator">Thermal indicator</string>
|
||||||
<string name="emulation_toggle_controls">Toggle controls</string>
|
<string name="emulation_toggle_controls">Toggle controls</string>
|
||||||
<string name="emulation_rel_stick_center">Relative stick center</string>
|
<string name="emulation_rel_stick_center">Relative stick center</string>
|
||||||
<string name="emulation_dpad_slide">D-pad slide</string>
|
<string name="emulation_dpad_slide">D-pad slide</string>
|
||||||
|
|
Loading…
Reference in a new issue