mirror of
https://github.com/skyline-emu/skyline.git
synced 2025-01-03 20:31:50 +01:00
Changed work with layout
Fixes behavior on Galaxy Z Fold and other devices with FoldingFeature.Orientation.HORIZONTAL in landscape orientation.
This commit is contained in:
parent
8376705832
commit
c78f20e450
@ -128,19 +128,6 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo
|
||||
|
||||
private var gameSurface : Surface? = null
|
||||
|
||||
private val displayHeight by lazy {
|
||||
with (windowManager) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
maximumWindowMetrics.bounds.height()
|
||||
} else {
|
||||
val displayMetrics = DisplayMetrics()
|
||||
@Suppress("DEPRECATION")
|
||||
defaultDisplay.getMetrics(displayMetrics)
|
||||
displayMetrics.heightPixels
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the entry point into the emulation code for libskyline
|
||||
*
|
||||
@ -516,15 +503,15 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo
|
||||
* Updating the layout depending on type and state of device
|
||||
*/
|
||||
private fun updateCurrentLayout(newLayoutInfo: WindowLayoutInfo) {
|
||||
binding.onScreenGameView.minimumHeight = displayHeight
|
||||
if (!emulationSettings.supportFoldableScreen) return
|
||||
binding.onScreenGameView.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
|
||||
requestedOrientation = emulationSettings.orientation
|
||||
val foldingFeature = newLayoutInfo.displayFeatures.find { it is FoldingFeature }
|
||||
(foldingFeature as? FoldingFeature)?.let {
|
||||
if (it.isSeparating) {
|
||||
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
|
||||
if (it.orientation == FoldingFeature.Orientation.HORIZONTAL)
|
||||
binding.onScreenGameView.minimumHeight = it.bounds.top
|
||||
binding.onScreenGameView.layoutParams.height = it.bounds.top
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
<FrameLayout
|
||||
android:id="@+id/on_screen_game_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<emu.skyline.views.FixedRatioSurfaceView
|
||||
android:id="@+id/game_view"
|
||||
|
Loading…
Reference in New Issue
Block a user