Show last edited time of comments
This commit is contained in:
1 parent
2e56ba4ed0
commit
e68d4ad2c4
7 files changed
+25
No files matched your search
@@ -33,6 +33,7 @@ public class GalleryComment implements Parcelable {
|
||||
public long time;
|
||||
public String user;
|
||||
public String comment;
|
||||
public long lastEdited;
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
@@ -52,6 +53,7 @@ public class GalleryComment implements Parcelable {
|
||||
dest.writeLong(this.time);
|
||||
dest.writeString(this.user);
|
||||
dest.writeString(this.comment);
|
||||
dest.writeLong(this.lastEdited);
|
||||
}
|
||||
|
||||
public GalleryComment() {
|
||||
@@ -69,6 +71,7 @@ public class GalleryComment implements Parcelable {
|
||||
this.time = in.readLong();
|
||||
this.user = in.readString();
|
||||
this.comment = in.readString();
|
||||
this.lastEdited = in.readLong();
|
||||
}
|
||||
|
||||
public static final Creator<GalleryComment> CREATOR = new Creator<GalleryComment>() {
|
||||
|
||||
@@ -444,6 +444,14 @@ public class GalleryDetailParser {
|
||||
comment.user = c3.child(0).text();
|
||||
// comment
|
||||
comment.comment = JsoupUtils.getElementByClass(element, "c6").html();
|
||||
// last edited
|
||||
Element c8 = JsoupUtils.getElementByClass(element, "c8");
|
||||
if (c8 != null) {
|
||||
Element e = c8.children().first();
|
||||
if (e != null) {
|
||||
comment.lastEdited = WEB_COMMENT_DATE_FORMAT.parse(temp).getTime();
|
||||
}
|
||||
}
|
||||
return comment;
|
||||
} catch (Throwable e) {
|
||||
ExceptionUtils.throwIfFatal(e);
|
||||
|
||||
@@ -687,6 +687,16 @@ public final class GalleryCommentsScene extends ToolbarScene
|
||||
ssb.append(" ").append(ss);
|
||||
}
|
||||
|
||||
if (comment.lastEdited != 0) {
|
||||
String str = context.getString(R.string.last_edited, ReadableTime.getTimeAgo(comment.lastEdited));
|
||||
SpannableString ss = new SpannableString(str);
|
||||
ss.setSpan(new RelativeSizeSpan(0.8f), 0, str.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
ss.setSpan(new StyleSpan(Typeface.BOLD), 0, str.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
ss.setSpan(new ForegroundColorSpan(AttrResources.getAttrColor(context, android.R.attr.textColorSecondary)),
|
||||
0, str.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
ssb.append("\n\n").append(ss);
|
||||
}
|
||||
|
||||
return TextUrl.handleTextUrl(ssb);
|
||||
}
|
||||
|
||||
|
||||
@@ -293,6 +293,7 @@
|
||||
<string name="vote_failed">投票失败</string>
|
||||
<string name="check_vote_status">查看投票情况</string>
|
||||
<string name="click_more_comments">点击加载更多评论</string>
|
||||
<string name="last_edited">上次修改时间:%s</string>
|
||||
|
||||
<!-- Gallery Previews -->
|
||||
<string name="gallery_previews">画廊预览</string>
|
||||
|
||||
@@ -293,6 +293,7 @@
|
||||
<string name="vote_failed">投票失敗</string>
|
||||
<string name="check_vote_status">查看投票情況</string>
|
||||
<string name="click_more_comments">點擊加載更多評論</string>
|
||||
<string name="last_edited">上次修改時間:%s</string>
|
||||
|
||||
<!-- Gallery Previews -->
|
||||
<string name="gallery_previews">畫廊預覽</string>
|
||||
|
||||
@@ -292,6 +292,7 @@
|
||||
<string name="vote_failed">推噓失敗</string>
|
||||
<string name="check_vote_status">檢視推噓狀態</string>
|
||||
<string name="click_more_comments">點選載入更多留言</string>
|
||||
<string name="last_edited">上次修改時間:%s</string>
|
||||
|
||||
<!-- Gallery Previews -->
|
||||
<string name="gallery_previews">圖庫預覽</string>
|
||||
|
||||
@@ -339,6 +339,7 @@
|
||||
<string name="vote_failed">Vote failed</string>
|
||||
<string name="check_vote_status">View vote details</string>
|
||||
<string name="click_more_comments">Click to load more comments</string>
|
||||
<string name="last_edited">Last edited: %s</string>
|
||||
|
||||
<!-- Gallery Previews -->
|
||||
<string name="gallery_previews">Gallery Previews</string>
|
||||
|
||||
Reference in new issue
Block a user