mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-13 17:51:57 +00:00
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
This commit is contained in:
parent
38952f1078
commit
2f2fbce0ba
3 changed files with 55 additions and 49 deletions
|
|
@ -32,56 +32,57 @@
|
||||||
style="@style/CardContent.Compact"
|
style="@style/CardContent.Compact"
|
||||||
android:background="@drawable/layout_rounded_bg"
|
android:background="@drawable/layout_rounded_bg"
|
||||||
android:padding="@dimen/spacing_medium">
|
android:padding="@dimen/spacing_medium">
|
||||||
<LinearLayout
|
<TableLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:weightSum="1.0"
|
|
||||||
android:baselineAligned="false"
|
android:baselineAligned="false"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical"
|
||||||
<com.habitrpg.android.habitica.ui.views.social.UsernameLabel
|
android:shrinkColumns="0"
|
||||||
android:id="@+id/user_label"
|
android:stretchColumns="2">
|
||||||
style="@style/ChatMessageUserTextViewStyle"
|
<TableRow
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent">
|
||||||
android:clickable="true"
|
<com.habitrpg.android.habitica.ui.views.social.UsernameLabel
|
||||||
tools:text="Username"
|
android:id="@+id/user_label"
|
||||||
android:focusable="true" />
|
style="@style/ChatMessageUserTextViewStyle"
|
||||||
<TextView
|
|
||||||
android:id="@+id/mod_view"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:textSize="12sp"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
style="@style/Pill.Purple"
|
|
||||||
tools:text="Moderator"
|
|
||||||
android:layout_marginLeft="@dimen/spacing_small"/>
|
|
||||||
<View
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/like_background_layout"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical|right"
|
|
||||||
|
|
||||||
android:layout_marginLeft="5dp"
|
|
||||||
android:layout_marginStart="5dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="@drawable/layout_rounded_bg">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvLikes"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="5dp"
|
android:layout_gravity="center_vertical"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:gravity="center_vertical"
|
tools:text="Username"
|
||||||
android:focusable="true" />
|
android:focusable="true" />
|
||||||
</LinearLayout>
|
<TextView
|
||||||
</LinearLayout>
|
android:id="@+id/mod_view"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
style="@style/Pill.Purple"
|
||||||
|
tools:text="Moderator"
|
||||||
|
android:layout_marginLeft="@dimen/spacing_small"/>
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"/>
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/like_background_layout"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:background="@drawable/layout_rounded_bg">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvLikes"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:clickable="true"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:focusable="true" />
|
||||||
|
</LinearLayout>
|
||||||
|
</TableRow>
|
||||||
|
</TableLayout>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/subline_textview"
|
android:id="@+id/subline_textview"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
|
||||||
|
|
@ -807,7 +807,7 @@
|
||||||
<string name="daily_tip_7">Try pinning items from the Market to your Rewards to help motivate you to earn them!</string>
|
<string name="daily_tip_7">Try pinning items from the Market to your Rewards to help motivate you to earn them!</string>
|
||||||
<string name="daily_tip_8">You can change your task\'s difficulty to reward yourself more for hard tasks!</string>
|
<string name="daily_tip_8">You can change your task\'s difficulty to reward yourself more for hard tasks!</string>
|
||||||
<string name="daily_tip_9">If you\'re having a tough time, try breaking your tasks down into smaller parts.</string>
|
<string name="daily_tip_9">If you\'re having a tough time, try breaking your tasks down into smaller parts.</string>
|
||||||
<string name="moderator">Moderator</string>
|
<string name="moderator">Mod</string>
|
||||||
<string name="staff">Staff</string>
|
<string name="staff">Staff</string>
|
||||||
<string name="expand_notes">Read More</string>
|
<string name="expand_notes">Read More</string>
|
||||||
<string name="collapse_notes">Show Less</string>
|
<string name="collapse_notes">Show Less</string>
|
||||||
|
|
|
||||||
|
|
@ -39,11 +39,12 @@ class UsernameLabel(context: Context?, attrs: AttributeSet?) : LinearLayout(cont
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val params = LayoutParams(
|
val textViewParams = LayoutParams(
|
||||||
FrameLayout.LayoutParams.WRAP_CONTENT,
|
FrameLayout.LayoutParams.WRAP_CONTENT,
|
||||||
FrameLayout.LayoutParams.WRAP_CONTENT)
|
FrameLayout.LayoutParams.WRAP_CONTENT)
|
||||||
params.gravity = Gravity.CENTER_VERTICAL
|
textViewParams.gravity = Gravity.CENTER_VERTICAL
|
||||||
addView(textView, params)
|
textViewParams.weight = 1.0f
|
||||||
|
addView(textView, textViewParams)
|
||||||
val padding = context?.resources?.getDimension(R.dimen.spacing_small)?.toInt() ?: 0
|
val padding = context?.resources?.getDimension(R.dimen.spacing_small)?.toInt() ?: 0
|
||||||
textView.setPadding(0, 0, padding, 0)
|
textView.setPadding(0, 0, padding, 0)
|
||||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14f)
|
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14f)
|
||||||
|
|
@ -52,6 +53,10 @@ class UsernameLabel(context: Context?, attrs: AttributeSet?) : LinearLayout(cont
|
||||||
} else {
|
} else {
|
||||||
textView.setTextAppearance(context, R.style.Body1)
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue