Skip to content

Commit

Permalink
feat: reply count in story
Browse files Browse the repository at this point in the history
  • Loading branch information
rebelonion committed May 13, 2024
1 parent 001c384 commit b0b51c4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
8 changes: 7 additions & 1 deletion app/src/main/java/ani/dantotsu/home/status/Stories.kt
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,15 @@ class Stories @JvmOverloads constructor(
}
val likeColor = ContextCompat.getColor(context, R.color.yt_red)
val notLikeColor = ContextCompat.getColor(context, R.color.bg_opp)
binding.activityReplies.setOnClickListener {
binding.activityRepliesContainer.setOnClickListener {
RepliesBottomDialog.newInstance(story.id).show(activity.supportFragmentManager, "replies")
}
if (story.replyCount > 0) {
binding.replyCount.text = story.replyCount.toString()
binding.replyCount.visibility = View.VISIBLE
} else {
binding.replyCount.visibility = View.GONE
}
binding.activityLikeCount.text = story.likeCount.toString()
binding.activityLike.setColorFilter(if (story.isLiked == true) likeColor else notLikeColor)
binding.activityLikeContainer.setOnClickListener {
Expand Down
38 changes: 31 additions & 7 deletions app/src/main/res/layout/fragment_status.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
android:id="@+id/textActivityContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="center">
android:gravity="center"
android:orientation="horizontal">

<TextView
android:id="@+id/textActivity"
Expand Down Expand Up @@ -176,15 +176,39 @@
tools:srcCompat="@tools:sample/backgrounds/scenic" />
</androidx.cardview.widget.CardView>

<ImageView
android:id="@+id/activityReplies"
<FrameLayout
android:id="@+id/activityRepliesContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="-8dp"
android:layout_marginBottom="16dp"
android:src="@drawable/ic_round_comment_24"
app:layout_constraintBottom_toTopOf="@+id/linearLayout"
app:layout_constraintEnd_toEndOf="@+id/linearLayout"
tools:ignore="ContentDescription" />
app:layout_constraintEnd_toEndOf="@+id/linearLayout">

<ImageView
android:id="@+id/activityReplies"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:src="@drawable/ic_round_comment_24"
tools:ignore="ContentDescription" />

<TextView
android:id="@+id/replyCount"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_gravity="end|bottom"
android:background="@drawable/notification_circle"
android:fontFamily="@font/poppins_semi_bold"
android:gravity="center"
android:textColor="#F3F3F3"
android:textSize="12sp"
android:visibility="gone"
tools:ignore="SmallSp"
tools:text="1"
tools:visibility="visible" />

</FrameLayout>

<LinearLayout
android:id="@+id/linearLayout"
Expand Down

0 comments on commit b0b51c4

Please sign in to comment.