Configure the toolbar in the debug activity

This commit is contained in:
Benoit Marty 2021-06-10 15:36:26 +02:00 committed by Benoit Marty
parent 3f4e80992b
commit 0ccd8ba071
2 changed files with 382 additions and 365 deletions

View File

@ -33,6 +33,12 @@ abstract class DebugMaterialThemeActivity : AppCompatActivity() {
val views = ActivityTestMaterialThemeBinding.inflate(layoutInflater)
setContentView(views.root)
setSupportActionBar(views.debugToolbar)
supportActionBar?.let {
it.setDisplayShowHomeEnabled(true)
it.setDisplayHomeAsUpEnabled(true)
}
views.debugShowSnackbar.setOnClickListener {
Snackbar.make(views.coordinatorLayout, "Snackbar!", Snackbar.LENGTH_SHORT)
.setAction("Action") { }

View File

@ -8,10 +8,26 @@
tools:context=".features.debug.DebugMaterialThemeActivity"
tools:ignore="HardcodedText">
<androidx.core.widget.NestedScrollView
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/debug_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:subtitle="Toolbar Subtitle"
app:title="Toolbar Title" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/debug_toolbar">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -20,13 +36,6 @@
android:padding="16dp"
android:showDividers="middle">
<androidx.appcompat.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:subtitle="Toolbar Subtitle"
app:title="Toolbar Title" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -441,4 +450,6 @@
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>