Skip to content

Commit c8b7a20

Browse files
authored
Merge pull request #17383 from wordpress-mobile/fix/long-title-issue-on-stats
Make all stats card titles multiline
2 parents 652093f + f599734 commit c8b7a20

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed

WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/TitleWithMoreViewHolder.kt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,12 @@ class TitleWithMoreViewHolder(parent: ViewGroup) : BlockListItemViewHolder(
1717
private val viewMore = itemView.findViewById<MaterialButton>(id.view_more_button)
1818

1919
fun bind(item: TitleWithMore) {
20-
title.multiLineText(item)
21-
title.setTextOrHide(item.textResource,item.text)
20+
title.setTextOrHide(item.textResource, item.text)
2221
if (item.navigationAction != null) {
2322
viewMore.isVisible = true
2423
viewMore.setOnClickListener { item.navigationAction.click() }
2524
} else {
2625
viewMore.visibility = View.GONE
2726
}
2827
}
29-
30-
fun TextView.multiLineText(item: TitleWithMore) {
31-
this.visibility = View.VISIBLE
32-
if(item.navigationAction == null){
33-
this.ellipsize = null
34-
this.maxLines = Int.MAX_VALUE
35-
}
36-
}
3728
}

WordPress/src/main/res/layout/stats_block_title_with_more_item.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010

1111
<com.google.android.material.textview.MaterialTextView
1212
android:id="@+id/text"
13-
android:layout_width="0dp"
1413
style="@style/StatsBlockTitle"
15-
android:layout_marginEnd="@dimen/margin_medium"
14+
android:layout_width="0dp"
1615
android:layout_height="wrap_content"
17-
android:text="@string/unknown"
16+
android:layout_marginEnd="@dimen/margin_medium"
1817
android:layout_weight="1"
18+
android:text="@string/unknown"
1919
tools:text="@string/stats_insights_views_and_visitors" />
2020

2121
<com.google.android.material.button.MaterialButton

WordPress/src/main/res/values/stats_styles.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,7 @@
4646
<item name="android:paddingStart">@dimen/margin_extra_large</item>
4747
</style>
4848

49-
<style name="StatsBlockTitle" parent="TextAppearance.MaterialComponents.Headline6">
50-
<item name="android:maxLines">1</item>
51-
<item name="android:ellipsize">end</item>
52-
</style>
49+
<style name="StatsBlockTitle" parent="TextAppearance.MaterialComponents.Headline6"/>
5350

5451
<style name="StatsDateSelectorTitle" parent="TextAppearance.MaterialComponents.Subtitle1">
5552
<item name="android:textStyle">bold</item>

0 commit comments

Comments
 (0)