Updated appbar design to be more android-like

This commit is contained in:
Viktor De Pasquale 2019-10-22 18:08:57 +02:00
parent d2e171eabc
commit fbfc4e72ca
7 changed files with 40 additions and 24 deletions

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="135"
android:endColor="?colorSecondary"
android:startColor="?colorPrimary" />
</shape>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="?colorSurfaceVariant" />
</shape>
</item>
<item android:bottom="2dp">
<shape android:shape="rectangle">
<solid android:color="?colorSurface" />
</shape>
</item>
</layer-list>

View File

@ -24,32 +24,41 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
<com.google.android.material.card.MaterialCardView <com.google.android.material.appbar.AppBarLayout
style="?styleCardElevated" android:id="@+id/main_toolbar_wrapper"
style="?styleAppbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/main_toolbar_wrapper" android:paddingTop="@{viewModel.insets.top}">
android:layout_marginStart="@dimen/l1"
android:layout_marginTop="@{(int) @dimen/l1 + viewModel.insets.top}"
android:layout_marginEnd="@dimen/l1"
tools:layout_marginTop="40dp">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/main_toolbar" android:id="@+id/main_toolbar"
style="?styleToolbar" style="?styleToolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:background="@android:color/transparent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_scrollFlags="noScroll" app:layout_scrollFlags="noScroll"
tools:layout_marginTop="24dp"
tools:title="Home" /> tools:title="Home" />
</com.google.android.material.appbar.AppBarLayout>
<!--<com.google.android.material.card.MaterialCardView
style="?styleCardElevated"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/main_toolbar_wrapper"
android:layout_marginStart="@dimen/l1"
android:layout_marginEnd="@dimen/l1">
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="3dp" android:layout_height="3dp"
android:layout_gravity="start|bottom" android:layout_gravity="start|bottom"
android:background="@drawable/bg_accent" /> android:background="@drawable/bg_accent" />
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>-->
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
android:id="@+id/main_bottom_bar" android:id="@+id/main_bottom_bar"

View File

@ -21,7 +21,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:clipToPadding="false" android:clipToPadding="false"
android:paddingTop="@{viewModel.insets.top + (int) @dimen/internal_action_bar_size + (int) @dimen/l2}" android:paddingTop="@{viewModel.insets.top + (int) @dimen/internal_action_bar_size}"
android:paddingBottom="@{viewModel.insets.bottom + (int) @dimen/l2}" android:paddingBottom="@{viewModel.insets.bottom + (int) @dimen/l2}"
tools:layout_marginTop="24dp"> tools:layout_marginTop="24dp">
@ -36,7 +36,7 @@
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/l1"> android:paddingTop="@dimen/l2">
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
android:id="@+id/home_magisk_wrapper" android:id="@+id/home_magisk_wrapper"

View File

@ -16,13 +16,14 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:clipToPadding="false" android:clipToPadding="false"
android:fillViewport="true" android:fillViewport="true"
android:paddingTop="@{viewModel.insets.top + (int) @dimen/internal_action_bar_size + (int) @dimen/l2}" android:paddingTop="@{viewModel.insets.top + (int) @dimen/internal_action_bar_size}"
android:paddingBottom="@{viewModel.insets.bottom + (int) @dimen/l2}" android:paddingBottom="@{viewModel.insets.bottom + (int) @dimen/l2}"
tools:layout_marginTop="24dp" tools:layout_marginTop="24dp"
tools:paddingTop="@dimen/l1"> tools:paddingTop="@dimen/l1">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:paddingTop="@dimen/l1"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView

View File

@ -18,7 +18,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:clipToPadding="false" android:clipToPadding="false"
android:fillViewport="true" android:fillViewport="true"
android:paddingTop="@{viewModel.insets.top + (int) @dimen/internal_action_bar_size + (int) @dimen/l2}" android:paddingTop="@{viewModel.insets.top + (int) @dimen/internal_action_bar_size}"
android:paddingBottom="@{viewModel.insets.bottom + (int) @dimen/l2}" android:paddingBottom="@{viewModel.insets.bottom + (int) @dimen/l2}"
tools:layout_marginTop="24dp" tools:layout_marginTop="24dp"
tools:paddingTop="@dimen/l1"> tools:paddingTop="@dimen/l1">
@ -26,6 +26,7 @@
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/l1"
android:orientation="vertical"> android:orientation="vertical">
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView

View File

@ -9,7 +9,7 @@ variant. Make sure to use style referenced by attribute defined it attrs.xml.
<style name="WidgetFoundation.Appbar" parent="Widget.MaterialComponents.AppBarLayout.Surface"> <style name="WidgetFoundation.Appbar" parent="Widget.MaterialComponents.AppBarLayout.Surface">
<item name="elevation">0dp</item> <item name="elevation">0dp</item>
<item name="android:background">?colorSurfaceVariant</item> <item name="android:background">@drawable/bg_appbar</item>
</style> </style>
<style name="WidgetFoundation.Toolbar" parent="Widget.MaterialComponents.Toolbar.Surface"> <style name="WidgetFoundation.Toolbar" parent="Widget.MaterialComponents.Toolbar.Surface">