-
-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a35887d
commit 408737d
Showing
6 changed files
with
182 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
app/src/main/java/ani/dantotsu/profile/activity/ActivityReplyItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package ani.dantotsu.profile.activity | ||
|
||
import android.view.View | ||
import androidx.core.content.ContextCompat | ||
import ani.dantotsu.R | ||
import ani.dantotsu.buildMarkwon | ||
import ani.dantotsu.connections.anilist.api.ActivityReply | ||
import ani.dantotsu.databinding.ItemActivityReplyBinding | ||
import ani.dantotsu.loadImage | ||
import ani.dantotsu.util.AniMarkdown.Companion.getBasicAniHTML | ||
import com.xwray.groupie.viewbinding.BindableItem | ||
|
||
class ActivityReplyItem( | ||
private val reply: ActivityReply | ||
) : BindableItem<ItemActivityReplyBinding>() { | ||
private lateinit var binding: ItemActivityReplyBinding | ||
|
||
override fun bind(viewBinding: ItemActivityReplyBinding, position: Int) { | ||
binding = viewBinding | ||
|
||
binding.activityUserAvatar.loadImage(reply.user.avatar?.medium) | ||
binding.activityUserName.text = reply.user.name | ||
binding.activityTime.text = ActivityItemBuilder.getDateTime(reply.createdAt) | ||
binding.activityLikeCount.text = reply.likeCount.toString() | ||
val likeColor = ContextCompat.getColor(binding.root.context, R.color.yt_red) | ||
val notLikeColor = ContextCompat.getColor(binding.root.context, R.color.bg_opp) | ||
binding.activityLike.setColorFilter(if (reply.isLiked) likeColor else notLikeColor) | ||
val markwon = buildMarkwon(binding.root.context) | ||
markwon.setMarkdown(binding.activityContent, getBasicAniHTML(reply.text)) | ||
|
||
} | ||
|
||
override fun getLayout(): Int { | ||
return R.layout.item_activity_reply | ||
} | ||
|
||
override fun initializeViewBinding(view: View): ItemActivityReplyBinding { | ||
return ItemActivityReplyBinding.bind(view) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginStart="8dp" | ||
android:background="?attr/colorSurface" | ||
android:orientation="vertical"> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="horizontal"> | ||
|
||
<com.google.android.material.card.MaterialCardView | ||
android:id="@+id/activityAvatarContainer" | ||
android:layout_width="64dp" | ||
android:layout_height="64dp" | ||
android:layout_gravity="start|center_vertical" | ||
android:layout_marginStart="16dp" | ||
android:backgroundTint="@color/transparent" | ||
app:cardCornerRadius="64dp" | ||
app:strokeColor="@color/transparent"> | ||
|
||
<com.google.android.material.imageview.ShapeableImageView | ||
android:id="@+id/activityUserAvatar" | ||
android:layout_width="64dp" | ||
android:layout_height="64dp" | ||
android:layout_gravity="center" | ||
app:srcCompat="@drawable/ic_round_add_circle_24" | ||
tools:ignore="ContentDescription,ImageContrastCheck" | ||
tools:tint="@color/transparent" /> | ||
|
||
</com.google.android.material.card.MaterialCardView> | ||
|
||
<LinearLayout | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center_vertical" | ||
android:layout_marginStart="8dp" | ||
android:layout_weight="1" | ||
android:orientation="vertical"> | ||
|
||
<TextView | ||
android:id="@+id/activityUserName" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:fontFamily="@font/poppins_semi_bold" | ||
android:text="Username" | ||
android:textSize="15sp" | ||
tools:ignore="HardcodedText,RtlSymmetry" /> | ||
|
||
<TextView | ||
android:id="@+id/activityTime" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:fontFamily="@font/poppins_semi_bold" | ||
android:text="Wed,06 March 2024, 7:00PM" | ||
android:textSize="14sp" | ||
tools:ignore="HardcodedText" /> | ||
|
||
</LinearLayout> | ||
|
||
<LinearLayout | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="end|center" | ||
android:layout_marginEnd="16dp" | ||
android:orientation="vertical"> | ||
|
||
<ImageView | ||
android:id="@+id/activityLike" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:src="@drawable/ic_round_favorite_24" | ||
tools:ignore="ContentDescription" /> | ||
|
||
<TextView | ||
android:id="@+id/activityLikeCount" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center" | ||
android:fontFamily="@font/poppins_semi_bold" | ||
android:textSize="15sp" | ||
tools:text="12" /> | ||
</LinearLayout> | ||
|
||
</LinearLayout> | ||
|
||
<TextView | ||
android:id="@+id/activityContent" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="16dp" | ||
android:layout_marginTop="8dp" | ||
android:layout_marginEnd="16dp" | ||
android:fontFamily="@font/poppins_semi_bold" | ||
android:text="@string/lorem_ipsum" | ||
android:textAlignment="center" | ||
android:textSize="14sp" /> | ||
|
||
</LinearLayout> |