Commit 55e8815f authored by Maxim Myalkin's avatar Maxim Myalkin

Add label empty description text.

parent de73573c
......@@ -41,11 +41,18 @@ class ProjectLabelAdapterDelegate : AdapterDelegate<MutableList<Any>>() {
@SuppressLint("SetTextI18n")
fun bind(item: Label) = with(itemView) {
labelTitleTextView.text = item.name
labelDescriptionTextView.text = item.description
val descriptionIsEmpty = item.description.isNullOrBlank()
labelDescriptionTextView.text = if (descriptionIsEmpty) {
context.getString(R.string.label_description_empty)
} else {
item.description
}
labelDescriptionTextView.isEnabled = descriptionIsEmpty.not()
labelIssueCountTextView.text = "${item.closedIssuesCount + item.openIssuesCount}"
labelMrCountTextView.text = "${item.openMergeRequestsCount}"
setLabelColor(item.color)
}
private fun setLabelColor(color: String) = with(itemView.labelTitleTextView) {
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/primary_text" android:state_enabled="true" />
<item android:color="@color/secondary_text" />
</selector>
\ No newline at end of file
......@@ -15,9 +15,9 @@
android:background="@drawable/bg_label"
android:ellipsize="end"
android:maxLines="1"
android:paddingBottom="2dp"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:paddingBottom="2dp"
android:singleLine="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
......@@ -33,20 +33,18 @@
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="16dp"
android:textColor="@color/primary_text"
android:textColor="@color/selector_enabled_text"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/labelMrCountImageView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/labelTitleTextView"
tools:text="123123123 123 123 12 3" />
<TextView
android:id="@+id/labelIssueCountTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:textColor="@color/primary_text"
app:layout_constraintBottom_toBottomOf="@+id/labelIssueCountImageView"
app:layout_constraintEnd_toEndOf="parent"
......
......@@ -179,4 +179,8 @@
<!--Privacy policy screen-->
<string name="privacy_policy">Privacy policy</string>
<!--Label screen-->
<string name="label_description_empty">No description</string>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment