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);
@@ -78,7 +78,7 @@
android:layout_alignLeft="@id/title"
android:layout_marginTop="8dp"
android:layout_marginRight="@dimen/keyline_margin"
android:background="?selectableItemBackgroundBorderless"
android:background="?selectableItemBackground"
android:ellipsize="end"
android:singleLine="true"
android:textColor="@android:color/white"
@@ -26,7 +26,8 @@
<TextView
android:id="@+id/user"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:background="?selectableItemBackground" />
<TextView
android:id="@+id/time"
+2 -1
View File
@@ -744,5 +744,6 @@
<string name="settings_e_ink_mode_summary">为墨水屏做一些优化</string>
<string name="settings_advanced_clear_memory_cache_done">完成内存缓存清理</string>
<string name="action_add_tag">添加标签</string>
<string name="action_add_tag_tip">添加新标签,用逗号「,」分割</string>
<string name="action_add_tag_tip">添加新标签,用逗号「,」分割</string>
<string name="comment_user_uploader">%s (上传者)</string>
</resources>
+1
View File
@@ -810,4 +810,5 @@
<string name="action_add_tag">Add tag</string>
<string name="action_add_tag_tip">Enter new tags, separated with comma</string>
<string name="error_no_webview">WebView is not available.</string>
<string name="comment_user_uploader">%s (Uploader)</string>
</resources>