android: Display FPS with emulation on hinge
This commit is contained in:
parent
724823c193
commit
f34535f362
|
@ -327,8 +327,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
onConfigurationChanged(resources.configuration)
|
onConfigurationChanged(resources.configuration)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val Number.toPx get() = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, this.toFloat(), Resources.getSystem().displayMetrics).toInt()
|
|
||||||
|
|
||||||
private fun updateFoldableLayout(emulationActivity: EmulationActivity, newLayoutInfo: WindowLayoutInfo) {
|
private fun updateFoldableLayout(emulationActivity: EmulationActivity, newLayoutInfo: WindowLayoutInfo) {
|
||||||
val isFolding = (newLayoutInfo.displayFeatures.find { it is FoldingFeature } as? FoldingFeature)?.let {
|
val isFolding = (newLayoutInfo.displayFeatures.find { it is FoldingFeature } as? FoldingFeature)?.let {
|
||||||
if (it.isSeparating) {
|
if (it.isSeparating) {
|
||||||
|
@ -336,8 +334,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
if (it.orientation == FoldingFeature.Orientation.HORIZONTAL) {
|
if (it.orientation == FoldingFeature.Orientation.HORIZONTAL) {
|
||||||
binding.emulationContainer.layoutParams.height = it.bounds.top
|
binding.emulationContainer.layoutParams.height = it.bounds.top
|
||||||
// Prevent touch regions from being displayed in the hinge
|
// Prevent touch regions from being displayed in the hinge
|
||||||
binding.overlayContainer.layoutParams.height = it.bounds.bottom - 48.toPx
|
binding.overlayContainer.layoutParams.height = it.bounds.bottom
|
||||||
binding.overlayContainer.updatePadding(0, 0, 0, 24.toPx)
|
|
||||||
binding.inGameMenu.layoutParams.height = it.bounds.bottom
|
binding.inGameMenu.layoutParams.height = it.bounds.bottom
|
||||||
isInFoldableLayout = true
|
isInFoldableLayout = true
|
||||||
binding.surfaceInputOverlay.setOrientation(InputOverlay.FOLDABLE)
|
binding.surfaceInputOverlay.setOrientation(InputOverlay.FOLDABLE)
|
||||||
|
@ -349,7 +346,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
if (!isFolding) {
|
if (!isFolding) {
|
||||||
binding.emulationContainer.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
|
binding.emulationContainer.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
binding.overlayContainer.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
|
binding.overlayContainer.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
binding.overlayContainer.updatePadding(0, 0, 0, 0)
|
|
||||||
binding.inGameMenu.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
|
binding.inGameMenu.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
isInFoldableLayout = false
|
isInFoldableLayout = false
|
||||||
updateScreenLayout()
|
updateScreenLayout()
|
||||||
|
|
|
@ -26,6 +26,18 @@
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
android:focusableInTouchMode="false" />
|
android:focusableInTouchMode="false" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/show_fps_text"
|
||||||
|
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:textColor="@android:color/white"
|
||||||
|
android:textSize="12sp"
|
||||||
|
tools:ignore="RtlHardcoded" />
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
@ -43,18 +55,6 @@
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:focusableInTouchMode="true" />
|
android:focusableInTouchMode="true" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/show_fps_text"
|
|
||||||
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:textColor="@android:color/white"
|
|
||||||
android:textSize="12sp"
|
|
||||||
tools:ignore="RtlHardcoded" />
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
style="@style/Widget.Material3.Button.ElevatedButton"
|
style="@style/Widget.Material3.Button.ElevatedButton"
|
||||||
android:id="@+id/done_control_config"
|
android:id="@+id/done_control_config"
|
||||||
|
|
Reference in New Issue