From 2f2fbce0ba94aab4ac6fad3204a830445adee3ad Mon Sep 17 00:00:00 2001 From: bacowan Date: Wed, 15 May 2019 09:58:54 -0300 Subject: [PATCH] Long usernames no longer cover up likes in chat (#1130) * Switching the LinearLayout containing the username and likes with a table whose columns can stretch such that the username will word wrap, but the moderator or likes text will not word wrap or spill out. * - Fixing line endings (had it set to CRLF) - Removing a grivity=right since the table is now taking care of it * nevermind, that was just autoformatting :/ * Switching from wordwrap to elipses * Moving back to word wrap and shortened Mod tag * missed committing this * Not fully resolving LayoutParams for consistency --- Habitica/res/layout/tavern_chat_item.xml | 89 ++++++++++--------- Habitica/res/values/strings.xml | 2 +- .../habitica/ui/views/social/UsernameLabel.kt | 13 ++- 3 files changed, 55 insertions(+), 49 deletions(-) diff --git a/Habitica/res/layout/tavern_chat_item.xml b/Habitica/res/layout/tavern_chat_item.xml index c35b821d2..ee85c7df9 100644 --- a/Habitica/res/layout/tavern_chat_item.xml +++ b/Habitica/res/layout/tavern_chat_item.xml @@ -32,56 +32,57 @@ style="@style/CardContent.Compact" android:background="@drawable/layout_rounded_bg" android:padding="@dimen/spacing_medium"> - - - - - - - + + - - - + + + + + + + Try pinning items from the Market to your Rewards to help motivate you to earn them! You can change your task\'s difficulty to reward yourself more for hard tasks! If you\'re having a tough time, try breaking your tasks down into smaller parts. - Moderator + Mod Staff Read More Show Less diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/social/UsernameLabel.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/social/UsernameLabel.kt index 9188e73a2..d53bbb4c9 100644 --- a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/social/UsernameLabel.kt +++ b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/social/UsernameLabel.kt @@ -39,11 +39,12 @@ class UsernameLabel(context: Context?, attrs: AttributeSet?) : LinearLayout(cont } init { - val params = LayoutParams( + val textViewParams = LayoutParams( FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT) - params.gravity = Gravity.CENTER_VERTICAL - addView(textView, params) + textViewParams.gravity = Gravity.CENTER_VERTICAL + textViewParams.weight = 1.0f + addView(textView, textViewParams) val padding = context?.resources?.getDimension(R.dimen.spacing_small)?.toInt() ?: 0 textView.setPadding(0, 0, padding, 0) textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14f) @@ -52,6 +53,10 @@ class UsernameLabel(context: Context?, attrs: AttributeSet?) : LinearLayout(cont } else { textView.setTextAppearance(context, R.style.Body1) } - addView(tierIconView, params) + val iconViewParams = LayoutParams( + FrameLayout.LayoutParams.WRAP_CONTENT, + FrameLayout.LayoutParams.WRAP_CONTENT) + iconViewParams.gravity = Gravity.CENTER_VERTICAL + addView(tierIconView, iconViewParams) } } \ No newline at end of file