Add uploader label to uploader comments

This commit is contained in:
NekoInverter committed 2021-01-24 20:34:08 +08:00
1 parent 012bd72688
commit ac14fee3b4
8 files changed
+24 -5

No files matched your search

@@ -40,6 +40,7 @@ public class GalleryComment implements Parcelable {
public boolean voteUpEd;
public boolean voteDownAble;
public boolean voteDownEd;
public boolean uploader;
public String voteState;
public long time;
public String user;
@@ -57,6 +58,7 @@ public class GalleryComment implements Parcelable {
this.voteUpEd = in.readByte() != 0;
this.voteDownAble = in.readByte() != 0;
this.voteDownEd = in.readByte() != 0;
this.uploader = in.readByte() != 0;
this.voteState = in.readString();
this.time = in.readLong();
this.user = in.readString();
@@ -78,6 +80,7 @@ public class GalleryComment implements Parcelable {
dest.writeByte(voteUpEd ? (byte) 1 : (byte) 0);
dest.writeByte(voteDownAble ? (byte) 1 : (byte) 0);
dest.writeByte(voteDownEd ? (byte) 1 : (byte) 0);
dest.writeByte(uploader ? (byte) 1 : (byte) 0);
dest.writeString(this.voteState);
dest.writeLong(this.time);
dest.writeString(this.user);
@@ -16,6 +16,8 @@
package com.hippo.ehviewer.client.parser;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -440,6 +442,9 @@ public class GalleryDetailParser {
// Editable, vote up and vote down
Element c4 = JsoupUtils.getElementByClass(element, "c4");
if (null != c4) {
if ("Uploader Comment".equals(c4.text())) {
comment.uploader = true;
}
for (Element e : c4.children()) {
switch (e.text()) {
case "Vote+":
@@ -72,6 +72,7 @@ import com.hippo.ehviewer.client.EhUrl;
import com.hippo.ehviewer.client.data.GalleryComment;
import com.hippo.ehviewer.client.data.GalleryCommentList;
import com.hippo.ehviewer.client.data.GalleryDetail;
import com.hippo.ehviewer.client.data.ListUrlBuilder;
import com.hippo.ehviewer.client.parser.VoteCommentParser;
import com.hippo.ehviewer.ui.MainActivity;
import com.hippo.scene.SceneFragment;
@@ -926,7 +927,7 @@ public final class GalleryCommentsScene extends ToolbarScene
}
}
private static class ActualCommentHolder extends CommentHolder {
private class ActualCommentHolder extends CommentHolder {
private final TextView user;
private final TextView time;
@@ -970,7 +971,13 @@ public final class GalleryCommentsScene extends ToolbarScene
}
public void bind(GalleryComment value) {
user.setText(value.user);
user.setText(value.uploader ? getString(R.string.comment_user_uploader, value.user) : value.user);
user.setOnClickListener(v -> {
ListUrlBuilder lub = new ListUrlBuilder();
lub.setMode(ListUrlBuilder.MODE_UPLOADER);
lub.setKeyword(value.user);
GalleryListScene.startScene(GalleryCommentsScene.this, lub);
});
time.setText(ReadableTime.getTimeAgo(value.time));
comment.setText(generateComment(comment.getContext(), comment, value));
}
@@ -1029,6 +1029,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
mComments.addView(v, i);
TextView user = v.findViewById(R.id.user);
user.setText(comment.user);
user.setBackgroundColor(Color.TRANSPARENT);
TextView time = v.findViewById(R.id.time);
time.setText(ReadableTime.getTimeAgo(comment.time));
ObservedTextView c = v.findViewById(R.id.comment);