1
0
Fork 0

For #2205: Truncates tab collection titles

master
Sawyer Blatz 2019-05-17 14:44:11 -07:00
parent 4e6f9b9ef1
commit 7861a80715
3 changed files with 9 additions and 6 deletions

View File

@ -4,7 +4,6 @@ package org.mozilla.fenix.collections
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -81,7 +80,6 @@ class CollectionViewHolder(
fun bind(collection: TabCollection) {
this.collection = collection
view.collection_item.text = collection.title
Log.d("sawyer", "Binding collection: " + collection.title)
}
companion object {

View File

@ -87,7 +87,13 @@ class CollectionViewHolder(
}
private fun updateCollectionUI() {
view.collection_title.text = collection.title
val title = if (collection.title.length > maxTitleLength) {
collection.title.substring(0, maxTitleLength) + "..."
} else {
collection.title
}
view.collection_title.text = title
var hostNameList = listOf<String>()
@ -96,7 +102,7 @@ class CollectionViewHolder(
}
var tabsDisplayed = 0
val titleList = hostNameList.joinToString(", ") {
val tabTitlesList = hostNameList.joinToString(", ") {
if (it.length > maxTitleLength) {
it.substring(0,
maxTitleLength
@ -107,7 +113,7 @@ class CollectionViewHolder(
}
}
view.collection_description.text = titleList
view.collection_description.text = tabTitlesList
if (expanded) {
(view.layoutParams as ViewGroup.MarginLayoutParams).bottomMargin = 0

View File

@ -44,7 +44,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="5dp"
android:background="@color/photonGreen50"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/add_collection_button"
app:layout_constraintEnd_toEndOf="parent"