Skip to content

Commit

Permalink
Merge pull request #620 from LoxiaLiSA/master
Browse files Browse the repository at this point in the history
comment stamp
  • Loading branch information
CeuiLiSA authored Jul 28, 2024
2 parents e65ec4b + 270700f commit d334153
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
applicationId "ceui.lisa.pixiv"
minSdkVersion 21
targetSdkVersion 33
versionCode 280
versionName "3.4.0"
versionCode 282
versionName "3.4.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

javaCompileOptions {
Expand Down
21 changes: 19 additions & 2 deletions app/src/main/java/ceui/lisa/adapters/CommentAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.view.View;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.model.GlideUrl;

import java.util.List;

Expand All @@ -19,6 +21,7 @@
import ceui.lisa.databinding.RecyCommentListBinding;
import ceui.lisa.models.ReplyCommentBean;
import ceui.lisa.utils.Common;
import ceui.lisa.utils.GlideUrlChild;
import ceui.lisa.utils.GlideUtil;

/**
Expand All @@ -43,8 +46,14 @@ public void bindData(ReplyCommentBean target, ViewHolder<RecyCommentListBinding>
.into(bindView.baseBind.userHead);
bindView.baseBind.userName.setText(allItems.get(position).getUser().getName());
bindView.baseBind.time.setText(Common.getLocalYYYYMMDDHHMMSSString(allItems.get(position).getDate()));
bindView.baseBind.content.setHtml(allItems.get(position).getCommentWithConvertedEmoji(),
new ImgGetter(bindView.baseBind.content));

if (!TextUtils.isEmpty(allItems.get(position).getComment())) {
bindView.baseBind.content.setVisibility(View.VISIBLE);
bindView.baseBind.content.setHtml(allItems.get(position).getCommentWithConvertedEmoji(),
new ImgGetter(bindView.baseBind.content));
} else {
bindView.baseBind.content.setVisibility(View.GONE);
}

if (allItems.get(position).getParent_comment() != null &&
allItems.get(position).getParent_comment().getUser() != null) {
Expand Down Expand Up @@ -85,6 +94,14 @@ public void updateDrawState(TextPaint ds) {
bindView.baseBind.replyContent.setVisibility(View.GONE);
}

if (allItems.get(position).getStamp() != null && !TextUtils.isEmpty(allItems.get(position).getStamp().getStamp_url())) {
bindView.baseBind.commentImage.setVisibility(View.VISIBLE);
Glide.with(mContext).load(new GlideUrlChild(allItems.get(position).getStamp().getStamp_url()))
.into(bindView.baseBind.commentImage);
} else {
bindView.baseBind.commentImage.setVisibility(View.GONE);
}


if (mOnItemClickListener != null) {
bindView.itemView.setOnClickListener(v ->
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/image_place_holder.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/image_background"/>
<corners android:radius="6dp" />
</shape>
16 changes: 14 additions & 2 deletions app/src/main/res/layout/recy_comment_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,26 @@
android:layout_alignStart="@+id/user_name"
android:layout_marginTop="@dimen/eight_dp"
android:textColor="@color/comment_content"
android:textSize="14sp"
android:textSize="15sp"
android:textIsSelectable="true" />

<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/comment_image"
android:visibility="gone"
android:layout_width="100dp"
android:layout_marginTop="@dimen/eight_dp"
android:layout_alignStart="@id/user_name"
android:layout_below="@+id/content"
app:riv_corner_radius="6dp"
android:background="@drawable/image_place_holder"
android:scaleType="centerCrop"
android:layout_height="100dp"/>

<org.sufficientlysecure.htmltextview.HtmlTextView
android:id="@+id/reply_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/content"
android:layout_below="@+id/comment_image"
android:layout_alignStart="@id/user_name"
android:layout_marginTop="@dimen/eight_dp"
android:background="@color/light_bg"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,6 @@
<color name="pixivision_logo_2">#AAAAAA</color>
<color name="delivery_header_cloud">#465B70</color>
<color name="panel_bg">#2A2A2A</color>
<color name="image_background">#1AFFFFFF</color>

</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
<color name="event_sample_color_9">#8633FF</color>
<color name="event_sample_color_10">#C500FF</color>
<color name="event_sample_color_11">#F234C6</color>
<color name="image_background">#1AFFFFFF</color>

</resources>

9 changes: 9 additions & 0 deletions models/src/main/java/ceui/lisa/models/CommentBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@ public class CommentBean extends UserHolder {

private String comment;
private String date;
private CommentStamp stamp;
private int id;
private String commentWithConvertedEmoji;

public String getComment() {
return this.comment;
}

public CommentStamp getStamp() {
return stamp;
}

public void setStamp(CommentStamp stamp) {
this.stamp = stamp;
}

public void setComment(String comment) {
this.comment = comment;
}
Expand Down
25 changes: 25 additions & 0 deletions models/src/main/java/ceui/lisa/models/CommentStamp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package ceui.lisa.models;

import java.io.Serializable;

public class CommentStamp implements Serializable {

private Long stamp_id;
private String stamp_url;

public Long getStamp_id() {
return stamp_id;
}

public void setStamp_id(Long stamp_id) {
this.stamp_id = stamp_id;
}

public String getStamp_url() {
return stamp_url;
}

public void setStamp_url(String stamp_url) {
this.stamp_url = stamp_url;
}
}

0 comments on commit d334153

Please sign in to comment.