AppListItem misc tweaks

* Restore text marquee on all layouts
* Text size and color tweaks
* List layout image has round corners
* Clean up unneeded attributes
This commit is contained in:
lynxnb 2022-01-21 12:19:39 +01:00
parent 6ee5e7e629
commit 74d75505e9
8 changed files with 29 additions and 24 deletions

View File

@ -87,6 +87,9 @@ class AppViewItem(var layoutType : LayoutType, private val item : AppItem, priva
override fun bind(binding : LayoutBinding<*>, position : Int) { override fun bind(binding : LayoutBinding<*>, position : Int) {
binding.textTitle.text = item.title binding.textTitle.text = item.title
binding.textSubtitle.text = item.subTitle ?: item.loaderResultString(binding.root.context) binding.textSubtitle.text = item.subTitle ?: item.loaderResultString(binding.root.context)
// Make the title text view selected for marquee to work
binding.textTitle.isSelected = true
binding.textSubtitle.isSelected = true
binding.icon.setImageBitmap(item.icon ?: missingIcon) binding.icon.setImageBitmap(item.icon ?: missingIcon)

View File

@ -37,7 +37,8 @@
android:marqueeRepeatLimit="marquee_forever" android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true" android:singleLine="true"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
android:textSize="12sp" android:textAppearance="?android:attr/textAppearanceListItem"
android:textSize="14sp"
tools:text="Title" /> tools:text="Title" />
<TextView <TextView
@ -50,6 +51,8 @@
android:ellipsize="marquee" android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever" android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true" android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp" android:textSize="12sp"
tools:text="Subtitle" /> tools:text="Subtitle" />
</LinearLayout> </LinearLayout>

View File

@ -33,16 +33,14 @@
android:id="@+id/text_title" android:id="@+id/text_title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:alpha="242.25" android:paddingHorizontal="8dp"
android:ellipsize="marquee" android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever" android:marqueeRepeatLimit="marquee_forever"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:singleLine="true" android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceListItem" android:textAppearance="?android:attr/textAppearanceListItem"
android:textSize="14sp"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textStyle="bold" android:textStyle="bold"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toTopOf="@id/text_subtitle" app:layout_constraintBottom_toTopOf="@id/text_subtitle"
app:layout_constraintEnd_toEndOf="@id/icon" app:layout_constraintEnd_toEndOf="@id/icon"
app:layout_constraintStart_toStartOf="@id/icon" app:layout_constraintStart_toStartOf="@id/icon"
@ -52,16 +50,15 @@
android:id="@+id/text_subtitle" android:id="@+id/text_subtitle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingHorizontal="8dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:alpha="242.25"
android:ellipsize="marquee" android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:marqueeRepeatLimit="marquee_forever" android:marqueeRepeatLimit="marquee_forever"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:singleLine="true" android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceListItemSecondary" android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textSize="12sp"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:alpha="0.95"
app:layout_constraintBottom_toBottomOf="@id/icon" app:layout_constraintBottom_toBottomOf="@id/icon"
app:layout_constraintEnd_toEndOf="@id/icon" app:layout_constraintEnd_toEndOf="@id/icon"
app:layout_constraintStart_toStartOf="@id/icon" app:layout_constraintStart_toStartOf="@id/icon"

View File

@ -10,7 +10,7 @@
android:focusable="true" android:focusable="true"
android:padding="16dp"> android:padding="16dp">
<ImageView <com.google.android.material.imageview.ShapeableImageView
android:id="@+id/icon" android:id="@+id/icon"
android:layout_width="56dp" android:layout_width="56dp"
android:layout_height="56dp" android:layout_height="56dp"
@ -18,14 +18,16 @@
android:focusable="false" android:focusable="false"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:shapeAppearanceOverlay="@style/RoundedAppImage"
tools:src="@drawable/default_icon" /> tools:src="@drawable/default_icon" />
<TextView <TextView
android:id="@+id/text_title" android:id="@+id/text_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginStart="12dp"
android:ellipsize="end" android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true" android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceListItem" android:textAppearance="?android:attr/textAppearanceListItem"
app:layout_constrainedWidth="true" app:layout_constrainedWidth="true"
@ -40,14 +42,16 @@
android:id="@+id/text_subtitle" android:id="@+id/text_subtitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceListItemSecondary" android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textColor="@android:color/tertiary_text_light" android:textColor="@android:color/tertiary_text_light"
app:layout_constrainedWidth="true" app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0" app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toEndOf="@id/icon" app:layout_constraintStart_toStartOf="@+id/text_title"
app:layout_constraintTop_toBottomOf="@+id/text_title" app:layout_constraintTop_toBottomOf="@+id/text_title"
tools:text="SubTitle" /> tools:text="SubTitle" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,9 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<attr name="chipChoiceStyle" format="reference" />
<declare-styleable name="CustomEditTextPreference"> <declare-styleable name="CustomEditTextPreference">
<attr name="limit" format="integer" /> <attr name="limit" format="integer" />
</declare-styleable> </declare-styleable>
<attr name="chipChoiceStyle" format="reference" />
<declare-styleable name="IntegerListPreference"> <declare-styleable name="IntegerListPreference">
<!-- The human-readable array to present as a list. Each entry must have a corresponding <!-- The human-readable array to present as a list. Each entry must have a corresponding
index in entryValues. --> index in entryValues. -->

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<dimen name="grid_padding">8dp</dimen> <dimen name="grid_padding">8dp</dimen>
<dimen name="corner_radius">8dp</dimen>
</resources> </resources>

View File

@ -3,19 +3,13 @@
<style name="RoundedAppImage"> <style name="RoundedAppImage">
<item name="cornerFamily">rounded</item> <item name="cornerFamily">rounded</item>
<item name="cornerSize">6dp</item> <item name="cornerSize">@dimen/corner_radius</item>
</style>
<style name="ChipChoice.Material">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorOnPrimary">@color/colorPrimary</item>
</style> </style>
<style name="ChipChoice" parent="Widget.MaterialComponents.Chip.Choice"> <style name="ChipChoice" parent="Widget.MaterialComponents.Chip.Choice">
<item name="android:textAllCaps">true</item> <item name="android:textAllCaps">true</item>
<item name="chipStartPadding">8dp</item> <item name="chipStartPadding">8dp</item>
<item name="chipEndPadding">8dp</item> <item name="chipEndPadding">8dp</item>
<item name="materialThemeOverlay">@style/ChipChoice.Material</item>
<item name="shapeAppearance">@style/ShapeAppearance.MaterialComponents.LargeComponent</item> <item name="shapeAppearance">@style/ShapeAppearance.MaterialComponents.LargeComponent</item>
</style> </style>
</resources> </resources>

View File

@ -3,9 +3,10 @@
<style name="BaseAppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar"> <style name="BaseAppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorOnPrimary">@color/colorPrimary</item> <item name="colorOnPrimary">@android:color/white</item>
<item name="colorSecondary">@color/colorPrimary</item> <item name="colorSecondary">@color/colorPrimary</item>
<item name="colorOnSecondary">@color/colorPrimary</item> <item name="colorOnSecondary">@android:color/white</item>
<item name="android:statusBarColor">@color/backgroundColor</item> <item name="android:statusBarColor">@color/backgroundColor</item>
<item name="android:navigationBarColor">@color/backgroundColor</item> <item name="android:navigationBarColor">@color/backgroundColor</item>
<item name="android:colorBackground">@color/backgroundColor</item> <item name="android:colorBackground">@color/backgroundColor</item>