1
0
Fork 0

For #2205: Updates collection title constraints

master
Sawyer Blatz 2019-05-21 14:31:45 -07:00 committed by Jeff Boek
parent 9509ce1b12
commit 220a843534
3 changed files with 31 additions and 33 deletions

View File

@ -82,13 +82,7 @@ class CollectionViewHolder(
} }
private fun updateCollectionUI() { private fun updateCollectionUI() {
val title = if (collection.title.length > maxTitleLength) { view.collection_title.text = collection.title
collection.title.substring(0, maxTitleLength) + "..."
} else {
collection.title
}
view.collection_title.text = title
var hostNameList = listOf<String>() var hostNameList = listOf<String>()
@ -116,12 +110,22 @@ class CollectionViewHolder(
collection_title.setPadding(0, 0, 0, EXPANDED_PADDING) collection_title.setPadding(0, 0, 0, EXPANDED_PADDING)
view.background = ContextCompat.getDrawable(view.context, R.drawable.rounded_top_corners) view.background = ContextCompat.getDrawable(view.context, R.drawable.rounded_top_corners)
view.collection_description.visibility = View.GONE view.collection_description.visibility = View.GONE
view.expand_button.setImageDrawable(ContextCompat.getDrawable(view.context, R.drawable.ic_chevron_up))
view.collection_title.setCompoundDrawablesWithIntrinsicBounds(
null,
null,
ContextCompat.getDrawable(view.context, R.drawable.ic_chevron_up),
null)
} else { } else {
(view.layoutParams as ViewGroup.MarginLayoutParams).bottomMargin = COLLAPSED_MARGIN (view.layoutParams as ViewGroup.MarginLayoutParams).bottomMargin = COLLAPSED_MARGIN
view.background = ContextCompat.getDrawable(view.context, R.drawable.rounded_all_corners) view.background = ContextCompat.getDrawable(view.context, R.drawable.rounded_all_corners)
view.collection_description.visibility = View.VISIBLE view.collection_description.visibility = View.VISIBLE
view.expand_button.setImageDrawable(ContextCompat.getDrawable(view.context, R.drawable.ic_chevron_down))
view.collection_title.setCompoundDrawablesWithIntrinsicBounds(
null,
null,
ContextCompat.getDrawable(view.context, R.drawable.ic_chevron_down),
null)
} }
view.collection_icon.setColorFilter( view.collection_icon.setColorFilter(

View File

@ -5,7 +5,7 @@
<LinearLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/item_collection" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/item_collection"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
@ -32,28 +32,21 @@
app:layout_constraintTop_toTopOf="parent"/> app:layout_constraintTop_toTopOf="parent"/>
<TextView <TextView
android:id="@+id/collection_title" android:id="@+id/collection_title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="17dp" android:layout_marginTop="17dp"
android:layout_marginStart="12dp" android:layout_marginStart="12dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:minLines="1" android:minLines="1"
android:textAppearance="@style/Header16TextStyle" android:textAppearance="@style/Header16TextStyle"
app:layout_constraintStart_toEndOf="@id/collection_icon" android:drawableEnd="@drawable/ic_chevron_down"
app:layout_constraintTop_toTopOf="parent"/> android:drawablePadding="8dp"
android:layout_marginEnd="16dp"
<ImageView app:layout_constraintStart_toEndOf="@id/collection_icon"
android:id="@+id/expand_button" app:layout_constraintEnd_toStartOf="@id/collection_share_button"
android:layout_width="wrap_content" app:layout_constraintTop_toTopOf="parent" android:text="The quick brown fox jumps over the lazy dog"/>
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="26dp"
android:layout_marginEnd="8dp"
android:src="@drawable/ic_chevron_down"
app:layout_constraintStart_toEndOf="@id/collection_title"
app:layout_constraintTop_toTopOf="parent"/>
<TextView <TextView
android:id="@+id/collection_description" android:id="@+id/collection_description"
@ -74,6 +67,7 @@
android:id="@+id/collection_share_button" android:id="@+id/collection_share_button"
android:layout_width="20dp" android:layout_width="20dp"
android:layout_height="20dp" android:layout_height="20dp"
android:layout_marginStart="16dp"
android:background="?android:attr/selectableItemBackgroundBorderless" android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/tab_menu" android:contentDescription="@string/tab_menu"
android:src="@drawable/ic_hollow_share" android:src="@drawable/ic_hollow_share"

View File

@ -37,7 +37,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginStart="14dp" android:layout_marginStart="14dp"
android:layout_marginEnd="48dp" android:layout_marginEnd="74dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:minLines="1" android:minLines="1"