Twelve: HorizontalListItem: Add support for tertiary text

Change-Id: I9f6049967afe00ad93835b6d87605c314d80aca1
diff --git a/app/src/main/java/org/lineageos/twelve/ui/views/HorizontalListItem.kt b/app/src/main/java/org/lineageos/twelve/ui/views/HorizontalListItem.kt
index 63eff2c..7e02edd 100644
--- a/app/src/main/java/org/lineageos/twelve/ui/views/HorizontalListItem.kt
+++ b/app/src/main/java/org/lineageos/twelve/ui/views/HorizontalListItem.kt
@@ -29,6 +29,7 @@
     private val thumbnailImageView by lazy { findViewById<ImageView>(R.id.thumbnailImageView) }
     private val headlineTextView by lazy { findViewById<TextView>(R.id.headlineTextView) }
     private val supportingTextView by lazy { findViewById<TextView>(R.id.supportingTextView) }
+    private val tertiaryTextView by lazy { findViewById<TextView>(R.id.tertiaryTextView) }
 
     var thumbnailImage: Drawable?
         get() = thumbnailImageView.drawable
@@ -60,6 +61,18 @@
             supportingTextView.maxLines = value
         }
 
+    var tertiaryText: CharSequence?
+        get() = tertiaryTextView.text
+        set(value) {
+            tertiaryTextView.setTextAndUpdateVisibility(value)
+        }
+
+    var tertiaryMaxLines: Int
+        get() = tertiaryTextView.maxLines
+        set(value) {
+            tertiaryTextView.maxLines = value
+        }
+
     init {
         inflate(context, R.layout.horizontal_list_item, this)
     }
@@ -82,6 +95,10 @@
     fun setSupportingText(@StringRes resId: Int, vararg formatArgs: Any) =
         supportingTextView.setTextAndUpdateVisibility(resId, *formatArgs)
 
+    fun setTertiaryText(@StringRes resId: Int) = tertiaryTextView.setTextAndUpdateVisibility(resId)
+    fun setTertiaryText(@StringRes resId: Int, vararg formatArgs: Any) =
+        tertiaryTextView.setTextAndUpdateVisibility(resId, *formatArgs)
+
     // TextView utils
 
     private fun TextView.setTextAndUpdateVisibility(text: CharSequence?) {
diff --git a/app/src/main/res/layout/horizontal_list_item.xml b/app/src/main/res/layout/horizontal_list_item.xml
index e710770..45b34d6 100644
--- a/app/src/main/res/layout/horizontal_list_item.xml
+++ b/app/src/main/res/layout/horizontal_list_item.xml
@@ -47,4 +47,17 @@
         android:textColor="?attr/colorOnSurfaceVariant"
         tools:text="Supporting" />
 
+    <TextView
+        android:id="@+id/tertiaryTextView"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:ellipsize="end"
+        android:hyphenationFrequency="normal"
+        android:maxLines="1"
+        android:textAppearance="?attr/textAppearanceLabelMedium"
+        android:textColor="?attr/colorOnSurfaceVariant"
+        android:visibility="gone"
+        tools:text="Tertiary"
+        tools:visibility="visible" />
+
 </LinearLayout>