Remove: Collapsing toolbar layout

This commit is contained in:
machiav3lli 2022-04-02 03:05:48 +02:00
parent c1a4feb927
commit 68a13c39ee
4 changed files with 46 additions and 70 deletions

View File

@ -106,7 +106,6 @@ class MainActivityX : AppCompatActivity() {
toolbar.menu.setGroupDividerEnabled(true) toolbar.menu.setGroupDividerEnabled(true)
} }
toolbar.isFocusableInTouchMode = true toolbar.isFocusableInTouchMode = true
toolbar.title = getString(R.string.application_name)
supportFragmentManager.addFragmentOnAttachListener { _, _ -> supportFragmentManager.addFragmentOnAttachListener { _, _ ->
hideKeyboard() hideKeyboard()

View File

@ -78,7 +78,6 @@ class PrefsActivityX : AppCompatActivity() {
super.onStart() super.onStart()
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
toolbar.isFocusableInTouchMode = true toolbar.isFocusableInTouchMode = true
binding.collapsingToolbar.title = getString(R.string.settings)
val navHostFragment = val navHostFragment =
supportFragmentManager.findFragmentById(R.id.fragment_content) as NavHostFragment supportFragmentManager.findFragmentById(R.id.fragment_content) as NavHostFragment

View File

@ -10,52 +10,41 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<androidx.coordinatorlayout.widget.CoordinatorLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/coordinator" android:id="@+id/appbar_layout"
style="?attr/appBarLayoutStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@id/bottom_navigation" app:layout_constraintBottom_toTopOf="@id/fragment_content"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/appbar_layout" android:id="@+id/toolbar"
style="?attr/appBarLayoutStyle" style="?attr/toolbarStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="?actionBarSize"
app:menu="@menu/menu_main"
app:title="@string/application_name" />
</com.google.android.material.appbar.AppBarLayout>
<com.google.android.material.appbar.CollapsingToolbarLayout <androidx.fragment.app.FragmentContainerView
android:id="@+id/collapsing_toolbar" android:id="@+id/fragment_content"
style="?attr/collapsingToolbarLayoutLargeStyle" android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/collapsingToolbarLayoutLargeSize" android:layout_height="0dp"
app:layout_scrollFlags="scroll|snap|exitUntilCollapsed"> app:defaultNavHost="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
<com.google.android.material.appbar.MaterialToolbar app:layout_constraintBottom_toTopOf="@id/bottom_navigation"
android:id="@+id/toolbar" app:layout_constraintTop_toBottomOf="@id/appbar_layout"
style="?attr/toolbarStyle" app:navGraph="@navigation/navigation_graph_main" />
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
app:menu="@menu/menu_main" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragment_content"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
app:navGraph="@navigation/navigation_graph_main" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<com.google.android.material.bottomnavigation.BottomNavigationView <com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation" android:id="@+id/bottom_navigation"
style="?bottomNavigationStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/coordinator" app:layout_constraintTop_toBottomOf="@id/fragment_content"
style="?bottomNavigationStyle"
app:menu="@menu/navigation_menu_main" /> app:menu="@menu/navigation_menu_main" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>

View File

@ -10,50 +10,39 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<androidx.coordinatorlayout.widget.CoordinatorLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/coordinator" android:id="@+id/appbar_layout"
style="?attr/appBarLayoutStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@id/bottom_navigation" app:layout_constraintBottom_toTopOf="@id/fragment_content"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/appbar_layout" android:id="@+id/toolbar"
style="?attr/appBarLayoutStyle" style="?attr/toolbarStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="?actionBarSize"
app:title="@string/settings" />
</com.google.android.material.appbar.AppBarLayout>
<com.google.android.material.appbar.CollapsingToolbarLayout <androidx.fragment.app.FragmentContainerView
android:id="@+id/collapsing_toolbar" android:id="@+id/fragment_content"
style="?attr/collapsingToolbarLayoutLargeStyle" android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/collapsingToolbarLayoutLargeSize" android:layout_height="0dp"
app:layout_scrollFlags="scroll|snap|exitUntilCollapsed"> app:defaultNavHost="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
<com.google.android.material.appbar.MaterialToolbar app:layout_constraintBottom_toTopOf="@id/bottom_navigation"
android:id="@+id/toolbar" app:layout_constraintTop_toBottomOf="@id/appbar_layout"
style="?attr/toolbarStyle" app:navGraph="@navigation/navigation_graph_prefs" />
android:layout_width="match_parent"
android:layout_height="?actionBarSize" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragment_content"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
app:navGraph="@navigation/navigation_graph_prefs" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<com.google.android.material.bottomnavigation.BottomNavigationView <com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation" android:id="@+id/bottom_navigation"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/coordinator" app:layout_constraintTop_toBottomOf="@id/fragment_content"
app:menu="@menu/navigation_menu_prefs" /> app:menu="@menu/navigation_menu_prefs" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>