simplify list_item layout

This commit is contained in:
Conny Duck 2018-02-03 13:24:12 +01:00
parent 1bf977b80a
commit 3524a67a7f
2 changed files with 11 additions and 22 deletions

View file

@ -169,13 +169,10 @@ class ListsActivity : BaseActivity(), ListsView {
.let(this::ListViewHolder) .let(this::ListViewHolder)
.apply { .apply {
val context = nameTextView.context val context = nameTextView.context
val icon = IconicsDrawable(context, GoogleMaterial.Icon.gmd_list) val icon = IconicsDrawable(context, GoogleMaterial.Icon.gmd_list).sizeDp(20)
val size = Utils.dpToPx(context, 20)
ThemeUtils.setDrawableTint(context, icon, android.R.attr.textColorTertiary) ThemeUtils.setDrawableTint(context, icon, android.R.attr.textColorTertiary)
icon.setBounds(0, 0, size, size) TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(nameTextView, icon, null, null, null)
nameTextView.compoundDrawablePadding = Utils.dpToPx(context, 8)
TextViewCompat.setCompoundDrawablesRelative(
nameTextView, icon, null, null, null)
} }
} }

View file

@ -1,21 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/list_name_textview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="60dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:background="?selectableItemBackground" android:background="?selectableItemBackground"
android:clickable="true"> android:drawablePadding="8dp"
android:gravity="center_vertical"
<TextView android:textSize="?attr/status_text_medium"
android:id="@+id/list_name_textview" tools:text="Example list" />
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:textSize="?attr/status_text_medium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Example list" />
</android.support.constraint.ConstraintLayout>