Visual changes

This commit is contained in:
RikkaW 2021-11-13 00:08:36 +08:00 committed by topjohnwu
parent 82a01c22d3
commit 28b5faab0c
4 changed files with 51 additions and 23 deletions

View File

@ -25,6 +25,9 @@ import me.tatarka.bindingcollectionadapter2.collections.MergeObservableList
class ModuleViewModel : BaseViewModel(), Queryable {
val bottomBarBarrierIds =
intArrayOf(R.id.module_info, R.id.module_remove)
override val queryDelay = 1000L
@get:Bindable

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?colorSurfaceVariant" android:state_enabled="true" />
<item android:alpha="0.68" android:color="?colorSurfaceVariant" />
</selector>

View File

@ -25,11 +25,12 @@
<com.google.android.material.card.MaterialCardView
style="@style/WidgetFoundation.Card"
isEnabled="@{!item.removed}"
isEnabled="@{!item.removed &amp;&amp; item.enabled &amp;&amp; !item.suspended}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="@{(item.enabled &amp;&amp; !item.suspended) ? 1f : .5f}"
android:nextFocusRight="@id/module_indicator"
app:cardBackgroundColor="@color/color_card_background_color_selector"
tools:isEnabled="false"
tools:layout_gravity="center"
tools:layout_margin="@dimen/l1">
@ -43,6 +44,7 @@
android:adjustViewBounds="true"
android:alpha=".05"
android:background="@null"
android:duplicateParentState="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
@ -52,7 +54,8 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true">
android:animateLayoutChanges="true"
android:duplicateParentState="true">
<TextView
android:id="@+id/module_title"
@ -62,8 +65,10 @@
android:layout_marginStart="@dimen/l1"
android:layout_marginTop="@dimen/l1"
android:layout_marginEnd="@dimen/l_50"
android:duplicateParentState="true"
android:text="@{item.item.name}"
android:textAppearance="@style/AppearanceFoundation.Body"
android:textColor="?android:textColorPrimary"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/module_indicator"
app:layout_constraintStart_toStartOf="parent"
@ -75,12 +80,14 @@
strikeThrough="@{item.removed}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:duplicateParentState="true"
android:text="@{@string/module_version_author(item.item.version, item.item.author)}"
android:textAppearance="@style/AppearanceFoundation.Caption.Variant"
android:textColor="?android:textColorSecondary"
app:layout_constraintEnd_toEndOf="@+id/module_title"
app:layout_constraintStart_toStartOf="@+id/module_title"
app:layout_constraintTop_toBottomOf="@+id/module_title"
tools:text="v1 by topjohnwu" />
tools:text="@tools:sample/lorem" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/module_indicator"
@ -94,22 +101,6 @@
app:layout_constraintStart_toEndOf="@+id/module_info"
app:layout_constraintTop_toTopOf="@+id/module_title" />
<TextView
android:id="@+id/module_suspend_text"
goneUnless="@{item.suspended}"
strikeThrough="@{item.removed}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/l1"
android:layout_marginTop="@dimen/l_50"
android:layout_marginEnd="@dimen/l1"
android:text="@{item.suspendText}"
android:textAppearance="@style/AppearanceFoundation.Tiny.Bold"
android:textColor="?colorError"
app:layout_constraintTop_toBottomOf="@+id/module_version_author"
tools:lines="1"
tools:text="@tools:sample/lorem/random" />
<TextView
android:id="@+id/module_description"
gone="@{item.item.description.empty}"
@ -119,9 +110,11 @@
android:layout_marginStart="@dimen/l1"
android:layout_marginTop="@dimen/l1"
android:layout_marginEnd="@dimen/l1"
android:duplicateParentState="true"
android:text="@{item.item.description}"
android:textAppearance="@style/AppearanceFoundation.Caption.Variant"
app:layout_constraintTop_toBottomOf="@+id/module_suspend_text"
android:textColor="?android:textColorSecondary"
app:layout_constraintTop_toBottomOf="@+id/module_version_author"
tools:lines="4"
tools:text="@tools:sample/lorem/random" />
@ -166,6 +159,33 @@
tools:icon="@drawable/ic_delete_md2"
tools:text="Remove" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/bottom_bar_barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="start"
app:referencedIds="@{viewModel.bottomBarBarrierIds}"
tools:constraint_referenced_ids="module_info,module_remove" />
<TextView
android:id="@+id/module_suspend_text"
goneUnless="@{item.suspended}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/l1"
android:layout_marginEnd="@dimen/l_50"
android:fontFamily="sans-serif-medium"
android:text="@{item.suspendText}"
android:textAppearance="@style/AppearanceFoundation.Caption.Primary"
android:textColor="?colorError"
app:layout_constraintBottom_toBottomOf="@+id/module_remove"
app:layout_constraintEnd_toStartOf="@+id/bottom_bar_barrier"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/module_remove"
tools:lines="2"
tools:text="@tools:sample/lorem/random"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>

View File

@ -48,7 +48,7 @@
<item name="colorSecondary">#3E78AF</item>
<item name="colorSecondaryVariant">#803E78AF</item>
<item name="colorSurface">#F9F9F9</item>
<item name="colorSurfaceVariant">#E8E8E8</item>
<item name="colorSurfaceVariant">#EEEEEE</item>
<item name="colorSurfaceSurfaceVariant">?colorSurface</item>
<item name="colorOnPrimary">#F9F9F9</item>
<item name="colorOnPrimaryVariant">#D9E6E6E6</item>