Commit 3fbd7451 authored by Eugene Shapovalov's avatar Eugene Shapovalov 💬

Add related merge request count for issue.

parent 8e4f6121
......@@ -7,5 +7,6 @@ enum class TargetBadgeIcon {
COMMENTS,
UP_VOTES,
DOWN_VOTES,
COMMITS;
COMMITS,
RELATED_MERGE_REQUESTS;
}
\ No newline at end of file
......@@ -29,5 +29,7 @@ data class Issue(
// This value will only be present for issues which were closed after GitLab 10.6 and
// when the user account that closed the issue still exists.
@SerializedName("closed_by") val closedBy: Author?,
@SerializedName("closed_at") val closedAt: LocalDateTime?
@SerializedName("closed_at") val closedAt: LocalDateTime?,
// The merge_requests_count attribute was introduced in GitLab 11.9.
@SerializedName("merge_requests_count") val relatedMergeRequestCount: Int
)
\ No newline at end of file
......@@ -103,6 +103,7 @@ class IssueRepository @Inject constructor(
badges.add(TargetBadge.Icon(TargetBadgeIcon.COMMENTS, issue.userNotesCount))
badges.add(TargetBadge.Icon(TargetBadgeIcon.UP_VOTES, issue.upvotes))
badges.add(TargetBadge.Icon(TargetBadgeIcon.DOWN_VOTES, issue.downvotes))
badges.add(TargetBadge.Icon(TargetBadgeIcon.RELATED_MERGE_REQUESTS, issue.relatedMergeRequestCount))
issue.labels.forEach { label -> badges.add(TargetBadge.Text(label)) }
return TargetHeader.Public(
......
......@@ -38,6 +38,9 @@ class TargetHeaderPublicAdapterDelegate(
commitsTextView.setStartDrawable(context.getTintDrawable(R.drawable.ic_commit, R.color.colorPrimary))
upVotesTextView.setStartDrawable(context.getTintDrawable(R.drawable.ic_thumb_up, R.color.colorPrimary))
downVotesTextView.setStartDrawable(context.getTintDrawable(R.drawable.ic_thumb_down, R.color.colorPrimary))
relatedMergeRequestCountTextView.setStartDrawable(
context.getTintDrawable(R.drawable.ic_merge_18dp, R.color.colorPrimary)
)
}
return ViewHolder(root)
}
......@@ -84,6 +87,7 @@ class TargetHeaderPublicAdapterDelegate(
commitsTextView.visible(false)
upVotesTextView.visible(false)
downVotesTextView.visible(false)
relatedMergeRequestCountTextView.visible(false)
val badgeViewsCount = badgesContainer.childCount
val textBadgesCount = badges.count { it !is TargetBadge.Icon }
......@@ -136,6 +140,10 @@ class TargetHeaderPublicAdapterDelegate(
downVotesTextView.text = badge.count.toString()
downVotesTextView.visible(true)
}
TargetBadgeIcon.RELATED_MERGE_REQUESTS -> {
relatedMergeRequestCountTextView.text = badge.count.toString()
relatedMergeRequestCountTextView.visible(true)
}
}
}
}
......
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="18dp"
android:height="18dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:name="63B6B0CD-29B9-4FED-BF15-BD512E184711"
android:fillColor="#000000"
android:fillType="evenOdd"
android:pathData="M5,23 C2.790861,23 1,21.209139 1,19 C1,16.790861 2.790861,15 5,15 C7.209139,15
9,16.790861 9,19 C9,21.209139 7.209139,23 5,23 Z M5,21 C6.1045695,21
7,20.1045695 7,19 C7,17.8954305 6.1045695,17 5,17 C3.8954305,17 3,17.8954305
3,19 C3,20.1045695 3.8954305,21 5,21 Z"
android:strokeWidth="1" />
<path
android:name="FC7B7C4F-AB25-4525-B8C5-276FDA615441"
android:fillColor="#000000"
android:fillType="evenOdd"
android:pathData="M19,23 C16.790861,23 15,21.209139 15,19 C15,16.790861 16.790861,15 19,15
C21.209139,15 23,16.790861 23,19 C23,21.209139 21.209139,23 19,23 Z M19,21
C20.1045695,21 21,20.1045695 21,19 C21,17.8954305 20.1045695,17 19,17
C17.8954305,17 17,17.8954305 17,19 C17,20.1045695 17.8954305,21 19,21 Z"
android:strokeWidth="1" />
<path
android:name="8BB6CF14-C6BC-4FD3-AE81-3EAE41A946F6"
android:fillColor="#000000"
android:fillType="evenOdd"
android:pathData="M5,9 C2.790861,9 1,7.209139 1,5 C1,2.790861 2.790861,1 5,1 C7.209139,1
9,2.790861 9,5 C9,7.209139 7.209139,9 5,9 Z M5,7 C6.1045695,7 7,6.1045695 7,5
C7,3.8954305 6.1045695,3 5,3 C3.8954305,3 3,3.8954305 3,5 C3,6.1045695
3.8954305,7 5,7 Z"
android:strokeWidth="1" />
<path
android:name="1D88206C-277B-40B8-8387-F22316ECD77B"
android:fillColor="#000000"
android:fillType="evenOdd"
android:pathData="M4,9 L4,15 C4,15.5522847 4.44771525,16 5,16 C5.55228475,16 6,15.5522847 6,15
L6,9 C6,8.44771525 5.55228475,8 5,8 C4.44771525,8 4,8.44771525 4,9 Z"
android:strokeWidth="1" />
<path
android:name="BF08C7F8-CEBD-44E9-A1CD-E1D9E06FD7E4"
android:fillColor="#000000"
android:fillType="evenOdd"
android:pathData="M18,15 C18,15.5522847 18.4477153,16 19,16 C19.5522847,16 20,15.5522847 20,15
L20,5 C20,4.44771525 19.5522847,4 19,4 L13,4 C12.4477153,4 12,4.44771525 12,5
C12,5.55228475 12.4477153,6 13,6 L18,6 L18,15 Z"
android:strokeWidth="1" />
<path
android:name="F546B3BF-B94A-4A27-9921-7562C49228DF"
android:fillColor="#000000"
android:fillType="evenOdd"
android:pathData="M15.7071068,2.70710678 C16.0976311,2.31658249 16.0976311,1.68341751
15.7071068,1.29289322 C15.3165825,0.902368927 14.6834175,0.902368927
14.2928932,1.29289322 L11.2928932,4.29289322 C10.9023689,4.68341751
10.9023689,5.31658249 11.2928932,5.70710678 L14.2928932,8.70710678
C14.6834175,9.09763107 15.3165825,9.09763107 15.7071068,8.70710678
C16.0976311,8.31658249 16.0976311,7.68341751 15.7071068,7.29289322 L13.4142136,5
L15.7071068,2.70710678 Z"
android:strokeWidth="1" />
</vector>
\ No newline at end of file
......@@ -133,6 +133,21 @@
tools:drawableTint="@color/colorPrimary"
tools:text="29" />
<TextView
android:id="@+id/relatedMergeRequestCountTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:drawablePadding="4dp"
android:gravity="center_vertical"
android:textColor="@color/colorPrimary"
android:textSize="14sp"
app:layout_constraintBaseline_toBaselineOf="@id/dateTextView"
app:layout_constraintRight_toLeftOf="@id/downVotesTextView"
tools:drawableStart="@drawable/ic_merge_18dp"
tools:drawableTint="@color/colorPrimary"
tools:text="29" />
<View
android:layout_width="0dp"
android:layout_height="@dimen/divider_size"
......
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