Author: Adam <git@apiote.xyz>
shorten and cut result description
app/src/main/java/ml/adamsprogs/bimba/search/Results.kt | 4 ++-- app/src/main/res/layout/suggestion.xml | 6 +++---
diff --git a/app/src/main/java/ml/adamsprogs/bimba/search/Results.kt b/app/src/main/java/ml/adamsprogs/bimba/search/Results.kt index 42532933b71bfadaf09cdb132fb8a81224e58d7c..2feea303cf6eb8996b3741935e2b2945ee77c47c 100644 --- a/app/src/main/java/ml/adamsprogs/bimba/search/Results.kt +++ b/app/src/main/java/ml/adamsprogs/bimba/search/Results.kt @@ -35,7 +35,7 @@ is Stop -> { holder?.icon?.setImageResource(R.drawable.ic_stop_black_24dp) // todo stop icon // todo dark theme colour holder?.title?.text = "${item.name} [${item.code}]" holder?.description?.text = - item.changeOptions.joinToString { "${it.line} » ${it.headsign}" } + item.changeOptions.groupBy { it.line }.map{ Pair(it.key, it.value.joinToString { co-> co.headsign })}.joinToString { "${it.first} » ${it.second}" } } is Line -> { val icon = item.icon(context!!) @@ -121,7 +121,7 @@ val rowView = layoutInflater.inflate(R.layout.suggestion, parent, false) return BimbaViewHolder(rowView) } - override fun getSingleViewHeight(): Int = 64 // todo calculate actual height + override fun getSingleViewHeight(): Int = 72 // todo calculate actual height override fun onBindSuggestionHolder(item: Item, holder: BimbaViewHolder?, pos: Int) { BimbaViewHolder.bind(item, holder, context, onClickListener) diff --git a/app/src/main/res/layout/suggestion.xml b/app/src/main/res/layout/suggestion.xml index 9eff05aff67bae1f471373a73beb09ea30c57b0a..5124ef7550b5cd3f1ca31d167ca91fe333b587a2 100644 --- a/app/src/main/res/layout/suggestion.xml +++ b/app/src/main/res/layout/suggestion.xml @@ -3,7 +3,7 @@xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/suggestion" android:layout_width="match_parent" - android:layout_height="64dp"> <!-- todo wrap_content --> + android:layout_height="72dp"> <!-- todo wrap_content --> <ImageView android:id="@+id/suggestion_image" @@ -34,9 +34,9 @@ android:id="@+id/suggestion_description" style="@style/Theme.Bimba.SearchResult.Description" android:layout_width="0dp" android:layout_height="0dp" - android:layout_marginTop="4dp" android:layout_marginEnd="8dp" - android:layout_marginBottom="8dp" + android:maxLines="4" + android:ellipsize="end" android:text="" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent"