fixed bug in settings_actions (related to #36)

This commit is contained in:
Josia Pietsch 2024-09-14 13:44:22 +02:00
parent b0e4a0347a
commit 5cd3d62e1a
Signed by: jrpie
GPG key ID: E70B571D66986A2D
2 changed files with 11 additions and 9 deletions

View file

@ -33,7 +33,6 @@ SettingsFragmentActions : Fragment(), UIObject {
): View { ): View {
binding = SettingsActionsBinding.inflate(inflater, container, false) binding = SettingsActionsBinding.inflate(inflater, container, false)
return binding!!.root return binding!!.root
} }
@ -42,14 +41,15 @@ SettingsFragmentActions : Fragment(), UIObject {
super<UIObject>.onStart() super<UIObject>.onStart()
binding?.root?.viewTreeObserver?.addOnGlobalLayoutListener { binding?.root?.viewTreeObserver?.addOnGlobalLayoutListener {
val buttonHeight = binding?.settingsActionsButtons?.height!! binding?.settingsActionsButtons?.height?.let { buttonHeight ->
val height = binding?.root?.height!! binding?.root?.height?.let { height ->
if (buttonHeight > 0.2 * height) { if (buttonHeight > 0.2 * height) {
binding?.settingsActionsButtons?.visibility = View.GONE binding?.settingsActionsButtons?.visibility = View.GONE
} else { } else {
binding?.settingsActionsButtons?.visibility = View.VISIBLE binding?.settingsActionsButtons?.visibility = View.VISIBLE
} }
}
}
} }

View file

@ -1,12 +1,14 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/settings_actions_container" android:id="@+id/settings_actions_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingLeft="32sp" android:paddingLeft="32sp"
android:paddingTop="16sp" android:paddingTop="16sp"
android:paddingRight="32sp"> android:paddingRight="32sp"
tools:context=".ui.settings.actions.SettingsFragmentActions">
<androidx.fragment.app.FragmentContainerView <androidx.fragment.app.FragmentContainerView
android:id="@+id/settings_actions_rview_fragment" android:id="@+id/settings_actions_rview_fragment"