diff options
| author | 2023-06-13 06:36:48 -0400 | |
|---|---|---|
| committer | 2023-06-14 16:35:57 -0400 | |
| commit | f34535f3626549a7cb527d6ecd98251195cd7a5e (patch) | |
| tree | fe9e27ab9eec023d28ce2472b44cf28e761831c1 | |
| parent | android: Remove PiP reliance on fragment (diff) | |
| download | yuzu-f34535f3626549a7cb527d6ecd98251195cd7a5e.tar.gz yuzu-f34535f3626549a7cb527d6ecd98251195cd7a5e.tar.xz yuzu-f34535f3626549a7cb527d6ecd98251195cd7a5e.zip | |
android: Display FPS with emulation on hinge
Diffstat (limited to '')
| -rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt | 6 | ||||
| -rw-r--r-- | src/android/app/src/main/res/layout/fragment_emulation.xml | 24 |
2 files changed, 13 insertions, 17 deletions
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 2f1a16f00..7db89aef0 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 | |||
| @@ -327,8 +327,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback { | |||
| 327 | onConfigurationChanged(resources.configuration) | 327 | onConfigurationChanged(resources.configuration) |
| 328 | } | 328 | } |
| 329 | 329 | ||
| 330 | private val Number.toPx get() = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, this.toFloat(), Resources.getSystem().displayMetrics).toInt() | ||
| 331 | |||
| 332 | private fun updateFoldableLayout(emulationActivity: EmulationActivity, newLayoutInfo: WindowLayoutInfo) { | 330 | private fun updateFoldableLayout(emulationActivity: EmulationActivity, newLayoutInfo: WindowLayoutInfo) { |
| 333 | val isFolding = (newLayoutInfo.displayFeatures.find { it is FoldingFeature } as? FoldingFeature)?.let { | 331 | val isFolding = (newLayoutInfo.displayFeatures.find { it is FoldingFeature } as? FoldingFeature)?.let { |
| 334 | if (it.isSeparating) { | 332 | if (it.isSeparating) { |
| @@ -336,8 +334,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback { | |||
| 336 | if (it.orientation == FoldingFeature.Orientation.HORIZONTAL) { | 334 | if (it.orientation == FoldingFeature.Orientation.HORIZONTAL) { |
| 337 | binding.emulationContainer.layoutParams.height = it.bounds.top | 335 | binding.emulationContainer.layoutParams.height = it.bounds.top |
| 338 | // Prevent touch regions from being displayed in the hinge | 336 | // Prevent touch regions from being displayed in the hinge |
| 339 | binding.overlayContainer.layoutParams.height = it.bounds.bottom - 48.toPx | 337 | binding.overlayContainer.layoutParams.height = it.bounds.bottom |
| 340 | binding.overlayContainer.updatePadding(0, 0, 0, 24.toPx) | ||
| 341 | binding.inGameMenu.layoutParams.height = it.bounds.bottom | 338 | binding.inGameMenu.layoutParams.height = it.bounds.bottom |
| 342 | isInFoldableLayout = true | 339 | isInFoldableLayout = true |
| 343 | binding.surfaceInputOverlay.setOrientation(InputOverlay.FOLDABLE) | 340 | binding.surfaceInputOverlay.setOrientation(InputOverlay.FOLDABLE) |
| @@ -349,7 +346,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback { | |||
| 349 | if (!isFolding) { | 346 | if (!isFolding) { |
| 350 | binding.emulationContainer.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT | 347 | binding.emulationContainer.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT |
| 351 | binding.overlayContainer.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT | 348 | binding.overlayContainer.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT |
| 352 | binding.overlayContainer.updatePadding(0, 0, 0, 0) | ||
| 353 | binding.inGameMenu.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT | 349 | binding.inGameMenu.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT |
| 354 | isInFoldableLayout = false | 350 | isInFoldableLayout = false |
| 355 | updateScreenLayout() | 351 | updateScreenLayout() |
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 01f6b9fe4..ffe5f4882 100644 --- a/src/android/app/src/main/res/layout/fragment_emulation.xml +++ b/src/android/app/src/main/res/layout/fragment_emulation.xml | |||
| @@ -26,6 +26,18 @@ | |||
| 26 | android:focusable="false" | 26 | android:focusable="false" |
| 27 | android:focusableInTouchMode="false" /> | 27 | android:focusableInTouchMode="false" /> |
| 28 | 28 | ||
| 29 | <TextView | ||
| 30 | android:id="@+id/show_fps_text" | ||
| 31 | android:layout_width="wrap_content" | ||
| 32 | android:layout_height="wrap_content" | ||
| 33 | android:layout_gravity="left" | ||
| 34 | android:clickable="false" | ||
| 35 | android:focusable="false" | ||
| 36 | android:shadowColor="@android:color/black" | ||
| 37 | android:textColor="@android:color/white" | ||
| 38 | android:textSize="12sp" | ||
| 39 | tools:ignore="RtlHardcoded" /> | ||
| 40 | |||
| 29 | </FrameLayout> | 41 | </FrameLayout> |
| 30 | 42 | ||
| 31 | <FrameLayout | 43 | <FrameLayout |
| @@ -43,18 +55,6 @@ | |||
| 43 | android:focusable="true" | 55 | android:focusable="true" |
| 44 | android:focusableInTouchMode="true" /> | 56 | android:focusableInTouchMode="true" /> |
| 45 | 57 | ||
| 46 | <TextView | ||
| 47 | android:id="@+id/show_fps_text" | ||
| 48 | android:layout_width="wrap_content" | ||
| 49 | android:layout_height="wrap_content" | ||
| 50 | android:layout_gravity="left" | ||
| 51 | android:clickable="false" | ||
| 52 | android:focusable="false" | ||
| 53 | android:shadowColor="@android:color/black" | ||
| 54 | android:textColor="@android:color/white" | ||
| 55 | android:textSize="12sp" | ||
| 56 | tools:ignore="RtlHardcoded" /> | ||
| 57 | |||
| 58 | <Button | 58 | <Button |
| 59 | style="@style/Widget.Material3.Button.ElevatedButton" | 59 | style="@style/Widget.Material3.Button.ElevatedButton" |
| 60 | android:id="@+id/done_control_config" | 60 | android:id="@+id/done_control_config" |