diff options
Diffstat (limited to 'src')
3 files changed, 88 insertions, 63 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt index 8ca768dcf..e00013c1b 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt | |||
| @@ -19,6 +19,7 @@ import androidx.core.content.ContextCompat | |||
| 19 | import androidx.core.view.ViewCompat | 19 | import androidx.core.view.ViewCompat |
| 20 | import androidx.core.view.WindowInsetsCompat | 20 | import androidx.core.view.WindowInsetsCompat |
| 21 | import androidx.core.view.isVisible | 21 | import androidx.core.view.isVisible |
| 22 | import androidx.core.view.updatePadding | ||
| 22 | import androidx.fragment.app.Fragment | 23 | import androidx.fragment.app.Fragment |
| 23 | import androidx.fragment.app.activityViewModels | 24 | import androidx.fragment.app.activityViewModels |
| 24 | import androidx.navigation.findNavController | 25 | import androidx.navigation.findNavController |
| @@ -351,15 +352,29 @@ class SetupFragment : Fragment() { | |||
| 351 | private fun setInsets() = | 352 | private fun setInsets() = |
| 352 | ViewCompat.setOnApplyWindowInsetsListener( | 353 | ViewCompat.setOnApplyWindowInsetsListener( |
| 353 | binding.root | 354 | binding.root |
| 354 | ) { view: View, windowInsets: WindowInsetsCompat -> | 355 | ) { _: View, windowInsets: WindowInsetsCompat -> |
| 355 | val barInsets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) | 356 | val barInsets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) |
| 356 | val cutoutInsets = windowInsets.getInsets(WindowInsetsCompat.Type.displayCutout()) | 357 | val cutoutInsets = windowInsets.getInsets(WindowInsetsCompat.Type.displayCutout()) |
| 357 | view.setPadding( | 358 | |
| 358 | barInsets.left + cutoutInsets.left, | 359 | val leftPadding = barInsets.left + cutoutInsets.left |
| 359 | barInsets.top + cutoutInsets.top, | 360 | val topPadding = barInsets.top + cutoutInsets.top |
| 360 | barInsets.right + cutoutInsets.right, | 361 | val rightPadding = barInsets.right + cutoutInsets.right |
| 361 | barInsets.bottom + cutoutInsets.bottom | 362 | val bottomPadding = barInsets.bottom + cutoutInsets.bottom |
| 362 | ) | 363 | |
| 364 | if (resources.getBoolean(R.bool.small_layout)) { | ||
| 365 | binding.viewPager2 | ||
| 366 | .updatePadding(left = leftPadding, top = topPadding, right = rightPadding) | ||
| 367 | binding.constraintButtons | ||
| 368 | .updatePadding(left = leftPadding, right = rightPadding, bottom = bottomPadding) | ||
| 369 | } else { | ||
| 370 | binding.viewPager2.updatePadding(top = topPadding, bottom = bottomPadding) | ||
| 371 | binding.constraintButtons | ||
| 372 | .updatePadding( | ||
| 373 | left = leftPadding, | ||
| 374 | right = rightPadding, | ||
| 375 | bottom = bottomPadding | ||
| 376 | ) | ||
| 377 | } | ||
| 363 | windowInsets | 378 | windowInsets |
| 364 | } | 379 | } |
| 365 | } | 380 | } |
diff --git a/src/android/app/src/main/res/layout-w600dp/fragment_setup.xml b/src/android/app/src/main/res/layout-w600dp/fragment_setup.xml index cbe631d88..406df9eab 100644 --- a/src/android/app/src/main/res/layout-w600dp/fragment_setup.xml +++ b/src/android/app/src/main/res/layout-w600dp/fragment_setup.xml | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <androidx.constraintlayout.widget.ConstraintLayout | 2 | <RelativeLayout |
| 3 | xmlns:android="http://schemas.android.com/apk/res/android" | 3 | xmlns:android="http://schemas.android.com/apk/res/android" |
| 4 | xmlns:app="http://schemas.android.com/apk/res-auto" | 4 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 5 | android:id="@+id/setup_root" | 5 | android:id="@+id/setup_root" |
| @@ -8,33 +8,39 @@ | |||
| 8 | 8 | ||
| 9 | <androidx.viewpager2.widget.ViewPager2 | 9 | <androidx.viewpager2.widget.ViewPager2 |
| 10 | android:id="@+id/viewPager2" | 10 | android:id="@+id/viewPager2" |
| 11 | android:layout_width="0dp" | 11 | android:layout_width="match_parent" |
| 12 | android:layout_height="0dp" | 12 | android:layout_height="match_parent" |
| 13 | app:layout_constraintBottom_toBottomOf="parent" | 13 | android:layout_alignParentTop="true" |
| 14 | app:layout_constraintEnd_toEndOf="parent" | 14 | android:layout_alignParentBottom="true" |
| 15 | app:layout_constraintStart_toStartOf="parent" | 15 | android:clipToPadding="false" /> |
| 16 | app:layout_constraintTop_toTopOf="parent" /> | ||
| 17 | 16 | ||
| 18 | <com.google.android.material.button.MaterialButton | 17 | <androidx.constraintlayout.widget.ConstraintLayout |
| 19 | style="@style/Widget.Material3.Button.TextButton" | 18 | android:id="@+id/constraint_buttons" |
| 20 | android:id="@+id/button_next" | 19 | android:layout_width="match_parent" |
| 21 | android:layout_width="wrap_content" | ||
| 22 | android:layout_height="wrap_content" | 20 | android:layout_height="wrap_content" |
| 23 | android:layout_margin="16dp" | 21 | android:layout_alignParentBottom="true" |
| 24 | android:text="@string/next" | 22 | android:layout_margin="8dp"> |
| 25 | android:visibility="invisible" | ||
| 26 | app:layout_constraintBottom_toBottomOf="parent" | ||
| 27 | app:layout_constraintEnd_toEndOf="parent" /> | ||
| 28 | 23 | ||
| 29 | <com.google.android.material.button.MaterialButton | 24 | <com.google.android.material.button.MaterialButton |
| 30 | android:id="@+id/button_back" | 25 | android:id="@+id/button_next" |
| 31 | style="@style/Widget.Material3.Button.TextButton" | 26 | style="@style/Widget.Material3.Button.TextButton" |
| 32 | android:layout_width="wrap_content" | 27 | android:layout_width="wrap_content" |
| 33 | android:layout_height="wrap_content" | 28 | android:layout_height="wrap_content" |
| 34 | android:layout_margin="16dp" | 29 | android:text="@string/next" |
| 35 | android:text="@string/back" | 30 | android:visibility="invisible" |
| 36 | android:visibility="invisible" | 31 | app:layout_constraintBottom_toBottomOf="parent" |
| 37 | app:layout_constraintBottom_toBottomOf="parent" | 32 | app:layout_constraintEnd_toEndOf="parent" /> |
| 38 | app:layout_constraintStart_toStartOf="parent" /> | 33 | |
| 34 | <com.google.android.material.button.MaterialButton | ||
| 35 | android:id="@+id/button_back" | ||
| 36 | style="@style/Widget.Material3.Button.TextButton" | ||
| 37 | android:layout_width="wrap_content" | ||
| 38 | android:layout_height="wrap_content" | ||
| 39 | android:text="@string/back" | ||
| 40 | android:visibility="invisible" | ||
| 41 | app:layout_constraintBottom_toBottomOf="parent" | ||
| 42 | app:layout_constraintStart_toStartOf="parent" /> | ||
| 43 | |||
| 44 | </androidx.constraintlayout.widget.ConstraintLayout> | ||
| 39 | 45 | ||
| 40 | </androidx.constraintlayout.widget.ConstraintLayout> | 46 | </RelativeLayout> |
diff --git a/src/android/app/src/main/res/layout/fragment_setup.xml b/src/android/app/src/main/res/layout/fragment_setup.xml index d7bafaea2..9499f6463 100644 --- a/src/android/app/src/main/res/layout/fragment_setup.xml +++ b/src/android/app/src/main/res/layout/fragment_setup.xml | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <androidx.constraintlayout.widget.ConstraintLayout | 2 | <RelativeLayout |
| 3 | xmlns:android="http://schemas.android.com/apk/res/android" | 3 | xmlns:android="http://schemas.android.com/apk/res/android" |
| 4 | xmlns:app="http://schemas.android.com/apk/res-auto" | 4 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 5 | android:id="@+id/setup_root" | 5 | android:id="@+id/setup_root" |
| @@ -8,35 +8,39 @@ | |||
| 8 | 8 | ||
| 9 | <androidx.viewpager2.widget.ViewPager2 | 9 | <androidx.viewpager2.widget.ViewPager2 |
| 10 | android:id="@+id/viewPager2" | 10 | android:id="@+id/viewPager2" |
| 11 | android:layout_width="0dp" | 11 | android:layout_width="match_parent" |
| 12 | android:layout_height="0dp" | ||
| 13 | android:clipToPadding="false" | ||
| 14 | android:layout_marginBottom="16dp" | ||
| 15 | app:layout_constraintBottom_toTopOf="@+id/button_next" | ||
| 16 | app:layout_constraintEnd_toEndOf="parent" | ||
| 17 | app:layout_constraintStart_toStartOf="parent" | ||
| 18 | app:layout_constraintTop_toTopOf="parent" /> | ||
| 19 | |||
| 20 | <com.google.android.material.button.MaterialButton | ||
| 21 | style="@style/Widget.Material3.Button.TextButton" | ||
| 22 | android:id="@+id/button_next" | ||
| 23 | android:layout_width="wrap_content" | ||
| 24 | android:layout_height="wrap_content" | 12 | android:layout_height="wrap_content" |
| 25 | android:layout_margin="12dp" | 13 | android:layout_above="@+id/constraint_buttons" |
| 26 | android:text="@string/next" | 14 | android:layout_alignParentTop="true" |
| 27 | android:visibility="invisible" | 15 | android:clipToPadding="false" /> |
| 28 | app:layout_constraintBottom_toBottomOf="parent" | ||
| 29 | app:layout_constraintEnd_toEndOf="parent" /> | ||
| 30 | 16 | ||
| 31 | <com.google.android.material.button.MaterialButton | 17 | <androidx.constraintlayout.widget.ConstraintLayout |
| 32 | style="@style/Widget.Material3.Button.TextButton" | 18 | android:id="@+id/constraint_buttons" |
| 33 | android:id="@+id/button_back" | 19 | android:layout_width="match_parent" |
| 34 | android:layout_width="wrap_content" | ||
| 35 | android:layout_height="wrap_content" | 20 | android:layout_height="wrap_content" |
| 36 | android:layout_margin="12dp" | 21 | android:layout_margin="8dp" |
| 37 | android:text="@string/back" | 22 | android:layout_alignParentBottom="true"> |
| 38 | android:visibility="invisible" | 23 | |
| 39 | app:layout_constraintBottom_toBottomOf="parent" | 24 | <com.google.android.material.button.MaterialButton |
| 40 | app:layout_constraintStart_toStartOf="parent" /> | 25 | android:id="@+id/button_next" |
| 26 | style="@style/Widget.Material3.Button.TextButton" | ||
| 27 | android:layout_width="wrap_content" | ||
| 28 | android:layout_height="wrap_content" | ||
| 29 | android:text="@string/next" | ||
| 30 | android:visibility="invisible" | ||
| 31 | app:layout_constraintBottom_toBottomOf="parent" | ||
| 32 | app:layout_constraintEnd_toEndOf="parent" /> | ||
| 33 | |||
| 34 | <com.google.android.material.button.MaterialButton | ||
| 35 | android:id="@+id/button_back" | ||
| 36 | style="@style/Widget.Material3.Button.TextButton" | ||
| 37 | android:layout_width="wrap_content" | ||
| 38 | android:layout_height="wrap_content" | ||
| 39 | android:text="@string/back" | ||
| 40 | android:visibility="invisible" | ||
| 41 | app:layout_constraintBottom_toBottomOf="parent" | ||
| 42 | app:layout_constraintStart_toStartOf="parent" /> | ||
| 43 | |||
| 44 | </androidx.constraintlayout.widget.ConstraintLayout> | ||
| 41 | 45 | ||
| 42 | </androidx.constraintlayout.widget.ConstraintLayout> | 46 | </RelativeLayout> |