mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 04:37:25 +01:00
Show a bin icon on deleted posts
This commit is contained in:
parent
25495b737a
commit
48776d28bb
@ -53,7 +53,6 @@ import com.google.android.exoplayer2.ui.DefaultTimeBar;
|
||||
import com.google.android.exoplayer2.ui.PlayerView;
|
||||
import com.google.android.exoplayer2.ui.TimeBar;
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
import com.google.android.material.button.MaterialButtonToggleGroup;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.libRG.CustomTextView;
|
||||
|
||||
@ -808,6 +807,12 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
}
|
||||
}
|
||||
|
||||
if (post.isDeleted()) {
|
||||
mGlide.load(R.drawable.ic_delete_outline_24).into(((PostBaseViewHolder) holder).stickiedPostImageView);
|
||||
((PostBaseViewHolder) holder).stickiedPostImageView.setVisibility(View.VISIBLE);
|
||||
((PostBaseViewHolder) holder).stickiedPostImageView.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
|
||||
if (post.isArchived()) {
|
||||
((PostBaseViewHolder) holder).archivedImageView.setVisibility(View.VISIBLE);
|
||||
|
||||
|
@ -181,6 +181,7 @@ public class ParsePost {
|
||||
boolean nsfw = post.getBoolean("nsfw");
|
||||
boolean locked = post.getBoolean("locked");
|
||||
boolean saved = data.getBoolean("saved");
|
||||
boolean deleted = post.getBoolean("deleted");
|
||||
String distinguished = creator.optBoolean("admin") ? "admin" : "";
|
||||
String suggestedSort = "";
|
||||
ArrayList<Post.Preview> previews = new ArrayList<>();
|
||||
@ -194,7 +195,7 @@ public class ParsePost {
|
||||
|
||||
return parseData(data, permalink, id, communityInfo,
|
||||
authorInfo, postTimeMillis, title, previews,
|
||||
downvotes, upvotes, voteType, nComments, upvoteRatio, nsfw, locked, saved,
|
||||
downvotes, upvotes, voteType, nComments, upvoteRatio, nsfw, locked, saved, deleted,
|
||||
distinguished, suggestedSort);
|
||||
|
||||
}
|
||||
@ -203,7 +204,7 @@ public class ParsePost {
|
||||
long postTimeMillis, String title, ArrayList<Post.Preview> previews,
|
||||
int downvotes, int upvotes, int voteType, int nComments, int upvoteRatio,
|
||||
boolean nsfw, boolean locked,
|
||||
boolean saved,
|
||||
boolean saved, boolean deleted,
|
||||
String distinguished, String suggestedSort) throws JSONException {
|
||||
Post post;
|
||||
|
||||
@ -223,7 +224,7 @@ public class ParsePost {
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw,
|
||||
locked, saved, distinguished, suggestedSort);
|
||||
locked, saved, deleted, distinguished, suggestedSort);
|
||||
String body = data.getJSONObject("post").getString("body");
|
||||
post.setSelfText(body);
|
||||
post.setSelfTextPlain(body);
|
||||
@ -235,7 +236,7 @@ public class ParsePost {
|
||||
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, deleted, distinguished, suggestedSort);
|
||||
|
||||
if (previews.isEmpty()) {
|
||||
previews.add(new Post.Preview(url, 0, 0, "", ""));
|
||||
@ -247,7 +248,7 @@ public class ParsePost {
|
||||
int postType = Post.VIDEO_TYPE;
|
||||
|
||||
post = new Post(id, communityInfo, author, postTimeMillis, title, permalink, downvotes, upvotes, postType, voteType,
|
||||
nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||
nComments, upvoteRatio, nsfw, locked, saved, deleted, distinguished, suggestedSort);
|
||||
|
||||
post.setVideoUrl(url);
|
||||
post.setVideoDownloadUrl(url);
|
||||
@ -256,7 +257,7 @@ public class ParsePost {
|
||||
int postType = Post.NO_PREVIEW_LINK_TYPE;
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, deleted, distinguished, suggestedSort);
|
||||
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
||||
post.setSelfText("");
|
||||
} else {
|
||||
@ -291,7 +292,7 @@ public class ParsePost {
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw,
|
||||
locked, saved, distinguished, suggestedSort);
|
||||
locked, saved, deleted, distinguished, suggestedSort);
|
||||
String body = "";
|
||||
post.setSelfText(body);
|
||||
post.setSelfTextPlain(body);
|
||||
@ -328,7 +329,7 @@ public class ParsePost {
|
||||
String videoDownloadUrl = redditVideoObject.getString(JSONUtils.FALLBACK_URL_KEY);
|
||||
|
||||
post = new Post(id, communityInfo, author, postTimeMillis, title, permalink, downvotes, upvotes, postType, voteType,
|
||||
nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||
nComments, upvoteRatio, nsfw, locked, saved, deleted, distinguished, suggestedSort);
|
||||
|
||||
post.setPreviews(previews);
|
||||
post.setVideoUrl(videoUrl);
|
||||
@ -340,7 +341,7 @@ public class ParsePost {
|
||||
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, deleted,
|
||||
distinguished, suggestedSort);
|
||||
|
||||
if (previews.isEmpty()) {
|
||||
@ -353,7 +354,7 @@ public class ParsePost {
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio,
|
||||
nsfw, locked, saved,
|
||||
nsfw, locked, saved, deleted,
|
||||
distinguished, suggestedSort);
|
||||
|
||||
post.setPreviews(previews);
|
||||
@ -369,7 +370,7 @@ public class ParsePost {
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio,
|
||||
nsfw, locked, saved,
|
||||
nsfw, locked, saved, deleted,
|
||||
distinguished, suggestedSort);
|
||||
post.setPreviews(previews);
|
||||
post.setVideoUrl(url);
|
||||
@ -381,7 +382,7 @@ public class ParsePost {
|
||||
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, deleted,
|
||||
distinguished, suggestedSort);
|
||||
post.setPreviews(previews);
|
||||
post.setVideoUrl(url);
|
||||
@ -392,7 +393,7 @@ public class ParsePost {
|
||||
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, deleted,
|
||||
distinguished, suggestedSort);
|
||||
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
||||
post.setSelfText("");
|
||||
@ -433,7 +434,7 @@ public class ParsePost {
|
||||
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, deleted, distinguished, suggestedSort);
|
||||
|
||||
if (previews.isEmpty()) {
|
||||
previews.add(new Post.Preview(url, 0, 0, "", ""));
|
||||
@ -445,7 +446,7 @@ public class ParsePost {
|
||||
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, deleted, distinguished, suggestedSort);
|
||||
post.setPreviews(previews);
|
||||
post.setVideoUrl(url);
|
||||
post.setVideoDownloadUrl(url);
|
||||
@ -455,7 +456,7 @@ public class ParsePost {
|
||||
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, deleted, distinguished, suggestedSort);
|
||||
//Need attention
|
||||
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
||||
post.setSelfText("");
|
||||
|
@ -72,6 +72,8 @@ public class Post implements Parcelable {
|
||||
private boolean saved;
|
||||
private boolean isCrosspost;
|
||||
private boolean isRead;
|
||||
|
||||
private boolean deleted;
|
||||
private String crosspostParentId;
|
||||
private String distinguished;
|
||||
private String suggestedSort;
|
||||
@ -82,7 +84,7 @@ public class Post implements Parcelable {
|
||||
BasicUserInfo userInfo, long postTimeMillis,
|
||||
String title, String permalink, int downvotes, int upvotes, int postType, int voteType, int nComments,
|
||||
int upvoteRatio,
|
||||
boolean nsfw, boolean locked, boolean saved,
|
||||
boolean nsfw, boolean locked, boolean saved, boolean deleted,
|
||||
String distinguished, String suggestedSort) {
|
||||
this.id = id;
|
||||
this.communityInfo = communityInfo;
|
||||
@ -99,6 +101,7 @@ public class Post implements Parcelable {
|
||||
this.hidden = hidden;
|
||||
this.nsfw = nsfw;
|
||||
this.archived = archived;
|
||||
this.deleted = deleted;
|
||||
this.locked = locked;
|
||||
this.saved = saved;
|
||||
this.isCrosspost = isCrosspost;
|
||||
@ -111,7 +114,7 @@ public class Post implements Parcelable {
|
||||
BasicUserInfo author, long postTimeMillis, String title,
|
||||
String url, String permalink, int downvotes, int upvotes, int postType, int voteType, int nComments,
|
||||
int upvoteRatio,
|
||||
boolean nsfw, boolean locked, boolean saved, String distinguished, String suggestedSort) {
|
||||
boolean nsfw, boolean locked, boolean saved, boolean deleted, String distinguished, String suggestedSort) {
|
||||
this.id = id;
|
||||
this.communityInfo = communityInfo;
|
||||
this.author = author;
|
||||
@ -130,6 +133,7 @@ public class Post implements Parcelable {
|
||||
this.archived = archived;
|
||||
this.locked = locked;
|
||||
this.saved = saved;
|
||||
this.deleted = deleted;
|
||||
this.isCrosspost = isCrosspost;
|
||||
this.distinguished = distinguished;
|
||||
this.suggestedSort = suggestedSort;
|
||||
@ -168,6 +172,7 @@ public class Post implements Parcelable {
|
||||
archived = in.readByte() != 0;
|
||||
locked = in.readByte() != 0;
|
||||
saved = in.readByte() != 0;
|
||||
deleted = in.readByte() != 0;
|
||||
isCrosspost = in.readByte() != 0;
|
||||
isRead = in.readByte() != 0;
|
||||
crosspostParentId = in.readString();
|
||||
@ -503,6 +508,10 @@ public class Post implements Parcelable {
|
||||
return author;
|
||||
}
|
||||
|
||||
public boolean isDeleted() {
|
||||
return deleted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeInt(id);
|
||||
@ -536,6 +545,7 @@ public class Post implements Parcelable {
|
||||
parcel.writeByte((byte) (archived ? 1 : 0));
|
||||
parcel.writeByte((byte) (locked ? 1 : 0));
|
||||
parcel.writeByte((byte) (saved ? 1 : 0));
|
||||
parcel.writeByte((byte) (deleted ? 1 : 0));
|
||||
parcel.writeByte((byte) (isCrosspost ? 1 : 0));
|
||||
parcel.writeByte((byte) (isRead ? 1 : 0));
|
||||
parcel.writeString(crosspostParentId);
|
||||
|
10
app/src/main/res/drawable/ic_delete_outline_24.xml
Normal file
10
app/src/main/res/drawable/ic_delete_outline_24.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector android:height="24dp"
|
||||
android:tint="#000000"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24"
|
||||
android:width="24dp"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2L18,7L6,7v12zM8,9h8v10L8,19L8,9zM15.5,4l-1,-1h-5l-1,1L5,4v2h14L19,4z" />
|
||||
</vector>
|
Loading…
Reference in New Issue
Block a user