mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-04-08 01:05:39 +02:00
Compare commits
4 Commits
b4569d56e6
...
083bde8149
Author | SHA1 | Date | |
---|---|---|---|
|
083bde8149 | ||
|
ff3ccca3eb | ||
|
0b1171c5b2 | ||
|
48776d28bb |
@ -342,64 +342,6 @@ public class LinkResolverActivity extends AppCompatActivity {
|
||||
intent.putExtra(ViewVideoActivity.EXTRA_VIDEO_TYPE, ViewVideoActivity.VIDEO_TYPE_V_REDD_IT);
|
||||
intent.putExtra(ViewVideoActivity.EXTRA_V_REDD_IT_URL, uri.toString());
|
||||
startActivity(intent);
|
||||
} else if (authority.contains("reddit.com") || authority.contains("redd.it") || authority.contains("reddit.app")) {
|
||||
if (authority.equals("reddit.app.link") && path.isEmpty()) {
|
||||
String redirect = uri.getQueryParameter("$og_redirect");
|
||||
if (redirect != null) {
|
||||
handleUri(Uri.parse(redirect));
|
||||
} else {
|
||||
deepLinkError(uri);
|
||||
}
|
||||
} else if (path.isEmpty()) {
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
} else if (path.equals("/report")) {
|
||||
openInWebView(uri);
|
||||
} else if (path.matches(POST_PATTERN_3)) {
|
||||
Intent intent = new Intent(this, ViewPostDetailActivity.class);
|
||||
intent.putExtra(ViewPostDetailActivity.EXTRA_POST_ID, path.substring(1));
|
||||
intent.putExtra(ViewPostDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname);
|
||||
intent.putExtra(ViewPostDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName);
|
||||
startActivity(intent);
|
||||
} else if (path.matches(WIKI_PATTERN)) {
|
||||
String[] pathSegments = path.split("/");
|
||||
String wikiPage;
|
||||
if (pathSegments.length == 4) {
|
||||
wikiPage = "index";
|
||||
} else {
|
||||
int lengthThroughWiki = 0;
|
||||
for (int i = 1; i <= 3; ++i) {
|
||||
lengthThroughWiki += pathSegments[i].length() + 1;
|
||||
}
|
||||
wikiPage = path.substring(lengthThroughWiki);
|
||||
}
|
||||
Intent intent = new Intent(this, WikiActivity.class);
|
||||
intent.putExtra(WikiActivity.EXTRA_SUBREDDIT_NAME, segments.get(1));
|
||||
intent.putExtra(WikiActivity.EXTRA_WIKI_PATH, wikiPage);
|
||||
startActivity(intent);
|
||||
} else if (path.matches(SIDEBAR_PATTERN)) {
|
||||
Intent intent = new Intent(this, ViewSubredditDetailActivity.class);
|
||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, path.substring(3, path.length() - 14));
|
||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_VIEW_SIDEBAR, true);
|
||||
startActivity(intent);
|
||||
} else if (path.matches(MULTIREDDIT_PATTERN)) {
|
||||
Intent intent = new Intent(this, ViewMultiRedditDetailActivity.class);
|
||||
intent.putExtra(ViewMultiRedditDetailActivity.EXTRA_MULTIREDDIT_PATH, path);
|
||||
startActivity(intent);
|
||||
} else if (path.matches(MULTIREDDIT_PATTERN_2)) {
|
||||
String subredditName = path.substring(3);
|
||||
Intent intent = new Intent(this, ViewSubredditDetailActivity.class);
|
||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, subredditName);
|
||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname);
|
||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName);
|
||||
startActivity(intent);
|
||||
} else if (authority.equals("redd.it") && path.matches(REDD_IT_POST_PATTERN)) {
|
||||
Intent intent = new Intent(this, ViewPostDetailActivity.class);
|
||||
intent.putExtra(ViewPostDetailActivity.EXTRA_POST_ID, path.substring(1));
|
||||
startActivity(intent);
|
||||
} else {
|
||||
deepLinkError(uri);
|
||||
}
|
||||
} else if (authority.equals("click.redditmail.com")) {
|
||||
if (path.startsWith("/CL0/")) {
|
||||
handleUri(Uri.parse(path.substring("/CL0/".length())));
|
||||
|
@ -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);
|
||||
|
||||
|
@ -52,10 +52,11 @@ public class CommentFilter implements Parcelable {
|
||||
};
|
||||
|
||||
public static boolean isCommentAllowed(Comment comment, CommentFilter commentFilter) {
|
||||
if (commentFilter.maxVote > 0 && comment.getVoteType() + comment.getScore() > commentFilter.maxVote) {
|
||||
int score = comment.getScore() + comment.getVoteType();
|
||||
if (commentFilter.maxVote >= 0 && score > commentFilter.maxVote) {
|
||||
return false;
|
||||
}
|
||||
if (commentFilter.minVote > 0 && comment.getVoteType() + comment.getScore() < commentFilter.minVote) {
|
||||
if (commentFilter.minVote >= 0 && score < commentFilter.minVote) {
|
||||
return false;
|
||||
}
|
||||
if (commentFilter.excludeStrings != null && !commentFilter.excludeStrings.equals("")) {
|
||||
|
@ -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…
x
Reference in New Issue
Block a user