Updated card design on homepage

This commit is contained in:
Viktor De Pasquale 2019-10-12 16:10:44 +02:00
parent 700c51f95c
commit ff24bc0b68
5 changed files with 195 additions and 174 deletions

View File

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

View File

@ -38,13 +38,23 @@
android:layout_height="wrap_content"
android:paddingTop="@dimen/l1">
<androidx.constraintlayout.widget.ConstraintLayout
<com.google.android.material.card.MaterialCardView
android:id="@+id/home_magisk_wrapper"
android:layout_width="0dp"
style="?styleCardVariant"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="200dp"
app:layout_constrainedWidth="true"
app:layout_constraintEnd_toStartOf="@+id/home_manager_wrapper"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:paddingStart="@dimen/l1"
android:paddingEnd="@dimen/l1"
android:background="@drawable/bg_card"
android:padding="@dimen/l1"
app:layout_constraintEnd_toStartOf="@+id/home_manager_wrapper"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
@ -94,7 +104,7 @@
<FrameLayout
gone="@{viewModel.stateMagisk == MagiskState.LOADING || !viewModel.isConnected}"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/l1"
android:animateLayoutChanges="true"
@ -135,24 +145,25 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<View
android:layout_width="1dp"
android:layout_height="0dp"
android:layout_marginTop="@dimen/l2"
android:layout_marginBottom="@dimen/l2"
android:background="?colorSurfaceVariant"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/home_manager_wrapper"
app:layout_constraintStart_toEndOf="@+id/home_magisk_wrapper"
app:layout_constraintTop_toTopOf="parent" />
</com.google.android.material.card.MaterialCardView>
<androidx.constraintlayout.widget.ConstraintLayout
<com.google.android.material.card.MaterialCardView
android:id="@+id/home_manager_wrapper"
android:layout_width="0dp"
style="?styleCardVariant"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/l1"
android:paddingStart="@dimen/l1"
android:paddingEnd="@dimen/l1"
android:maxWidth="200dp"
app:layout_constrainedWidth="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/home_magisk_wrapper"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_card"
android:padding="@dimen/l1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/home_magisk_wrapper"
app:layout_constraintTop_toTopOf="parent">
@ -235,19 +246,14 @@
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="@dimen/l1"
android:layout_marginTop="@dimen/l2"
android:layout_marginEnd="@dimen/l1"
android:layout_marginBottom="@dimen/l2"
android:background="?colorSurfaceVariant" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_marginTop="@dimen/l2"
android:layout_height="wrap_content">
<androidx.appcompat.widget.AppCompatImageView
@ -436,10 +442,10 @@
tools:text="7.3.4 (12345)" />
<androidx.appcompat.widget.AppCompatTextView
gone="@{Info.magiskVersionCode &lt; 0}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
gone="@{Info.magiskVersionCode &lt; 0}"
android:text="@{String.format(`%s (%s)`, Info.magiskVersionString, Info.magiskVersionCode)}"
android:textAppearance="?appearanceTextCaptionVariant"
tools:text="19.5 (12345)" />

View File

@ -17,6 +17,7 @@
<!--Card-->
<attr name="styleCardNormal" format="reference" />
<attr name="styleCardVariant" format="reference" />
<attr name="styleCardElevated" format="reference" />
<attr name="styleCardOnPrimary" format="reference" />

View File

@ -30,6 +30,7 @@
<item name="styleToolbar">@style/WidgetFoundation.Toolbar</item>
<item name="styleCardNormal">@style/WidgetFoundation.Card</item>
<item name="styleCardVariant">@style/WidgetFoundation.Card.Variant</item>
<item name="styleCardElevated">@style/WidgetFoundation.Card.Elevated</item>
<item name="styleCardOnPrimary">@style/WidgetFoundation.Card.OnPrimary</item>

View File

@ -30,6 +30,11 @@ variant. Make sure to use style referenced by attribute defined it attrs.xml.
<item name="cardPreventCornerOverlap">true</item>
</style>
<style name="WidgetFoundation.Card.Variant">
<item name="cardBackgroundColor">?colorSurface</item>
<item name="strokeColor">?colorSurfaceVariant</item>
<item name="strokeWidth">1dp</item>
</style>
<style name="WidgetFoundation.Card.Elevated" parent="Widget.MaterialComponents.CardView">
<item name="cardBackgroundColor">?colorSurface</item>