Просмотр исходного кода

android: Simplify FPS counter padding

Charles Lombardo 2 лет назад
Родитель
Сommit
5191465b0a

+ 0 - 21
src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt

@@ -462,7 +462,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
                     if (it.orientation == FoldingFeature.Orientation.HORIZONTAL) {
                         // Restrict emulation and overlays to the top of the screen
                         binding.emulationContainer.layoutParams.height = it.bounds.top
-                        binding.overlayContainer.layoutParams.height = it.bounds.top
                         // Restrict input and menu drawer to the bottom of the screen
                         binding.inputContainer.layoutParams.height = it.bounds.bottom
                         binding.inGameMenu.layoutParams.height = it.bounds.bottom
@@ -476,7 +475,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
         if (!isFolding) {
             binding.emulationContainer.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
             binding.inputContainer.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
-            binding.overlayContainer.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
             binding.inGameMenu.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
             isInFoldableLayout = false
             updateOrientation()
@@ -484,7 +482,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
         }
         binding.emulationContainer.requestLayout()
         binding.inputContainer.requestLayout()
-        binding.overlayContainer.requestLayout()
         binding.inGameMenu.requestLayout()
     }
 
@@ -710,24 +707,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
             }
 
             v.setPadding(left, cutInsets.top, right, 0)
-
-            // Ensure FPS text doesn't get cut off by rounded display corners
-            val sidePadding = resources.getDimensionPixelSize(R.dimen.spacing_xtralarge)
-            if (cutInsets.left == 0) {
-                binding.showFpsText.setPadding(
-                    sidePadding,
-                    cutInsets.top,
-                    cutInsets.right,
-                    cutInsets.bottom
-                )
-            } else {
-                binding.showFpsText.setPadding(
-                    cutInsets.left,
-                    cutInsets.top,
-                    cutInsets.right,
-                    cutInsets.bottom
-                )
-            }
             windowInsets
         }
     }

+ 5 - 3
src/android/app/src/main/res/layout/fragment_emulation.xml

@@ -134,16 +134,18 @@
         <FrameLayout
             android:id="@+id/overlay_container"
             android:layout_width="match_parent"
-            android:layout_height="match_parent">
+            android:layout_height="match_parent"
+            android:fitsSystemWindows="true">
 
-            <TextView
+            <com.google.android.material.textview.MaterialTextView
                 android:id="@+id/show_fps_text"
+                style="@style/TextAppearance.Material3.BodyMedium"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_gravity="left"
                 android:clickable="false"
                 android:focusable="false"
-                android:shadowColor="@android:color/black"
+                android:paddingHorizontal="20dp"
                 android:textColor="@android:color/white"
                 android:textSize="12sp"
                 tools:ignore="RtlHardcoded" />