mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-02-19 11:48:43 +01:00
Compare commits
No commits in common. "82414bba55b1cbd807599cc5beb1b19277c88f63" and "b3c2f6213d6014af4ed2b3d0e77085a3d6bff030" have entirely different histories.
82414bba55
...
b3c2f6213d
@ -43,7 +43,7 @@ public class SortType {
|
||||
TOP_TWELVE_HOURS("TopTwelveHour", "Top"),
|
||||
TOP_DAY("TopDay", "Top"),
|
||||
TOP_WEEK("TopWeek", "Top"),
|
||||
TOP_MONTH("TopMonth", "Top"),
|
||||
TOP_MONTH("month", "Top"),
|
||||
TOP_THREE_MONTHS("TopThreeMonths", "Top"),
|
||||
TOP_SIX_MONTHS("TopSixMonths", "Top"),
|
||||
TOP_NINE_MONTHS("TopNineMonths", "Top"),
|
||||
|
@ -641,12 +641,9 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
|
||||
break;
|
||||
}
|
||||
|
||||
if (mPostType == PostPagingSource.TYPE_SUBREDDIT && !mDisplaySubredditName && post.isFeaturedInCommunity() || post.isFeaturedOnInstance()) {
|
||||
if (mPostType == PostPagingSource.TYPE_SUBREDDIT && !mDisplaySubredditName && post.isStickied()) {
|
||||
((PostBaseViewHolder) holder).stickiedPostImageView.setVisibility(View.VISIBLE);
|
||||
mGlide.load(R.drawable.ic_thumbtack_24dp).into(((PostBaseViewHolder) holder).stickiedPostImageView);
|
||||
if (post.isFeaturedOnInstance()) {
|
||||
((PostBaseViewHolder) holder).stickiedPostImageView.setColorFilter(mModeratorColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
}
|
||||
|
||||
if (post.isArchived()) {
|
||||
@ -1213,7 +1210,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
|
||||
}
|
||||
}
|
||||
|
||||
if (mPostType == PostPagingSource.TYPE_SUBREDDIT && !mDisplaySubredditName && post.isFeaturedInCommunity()) {
|
||||
if (mPostType == PostPagingSource.TYPE_SUBREDDIT && !mDisplaySubredditName && post.isStickied()) {
|
||||
((PostCompactBaseViewHolder) holder).stickiedPostImageView.setVisibility(View.VISIBLE);
|
||||
mGlide.load(R.drawable.ic_thumbtack_24dp).into(((PostCompactBaseViewHolder) holder).stickiedPostImageView);
|
||||
}
|
||||
|
@ -99,6 +99,7 @@ import eu.toldi.infinityforlemmy.markdown.MarkdownUtils;
|
||||
import eu.toldi.infinityforlemmy.post.Post;
|
||||
import eu.toldi.infinityforlemmy.post.PostPagingSource;
|
||||
import eu.toldi.infinityforlemmy.utils.APIUtils;
|
||||
import eu.toldi.infinityforlemmy.utils.LemmyUtils;
|
||||
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
|
||||
import eu.toldi.infinityforlemmy.utils.Utils;
|
||||
import eu.toldi.infinityforlemmy.videoautoplay.CacheManager;
|
||||
@ -585,7 +586,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
||||
((PostDetailBaseViewHolder) holder).mUserTextView.setText(mPost.getAuthor());
|
||||
}
|
||||
|
||||
if (mPost.isModerator() || mPost.isAdmin()) {
|
||||
if (mPost.isModerator()) {
|
||||
((PostDetailBaseViewHolder) holder).mUserTextView.setTextColor(mModeratorColor);
|
||||
Drawable moderatorDrawable = Utils.getTintedDrawable(mActivity, R.drawable.ic_verified_user_14dp, mModeratorColor);
|
||||
((PostDetailBaseViewHolder) holder).mUserTextView.setCompoundDrawablesWithIntrinsicBounds(
|
||||
|
@ -541,7 +541,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
}
|
||||
|
||||
((PostBaseViewHolder) holder).userTextView.setTextColor(
|
||||
post.isModerator() || post.isAdmin() ? mModeratorColor : mUsernameColor);
|
||||
post.isModerator() ? mModeratorColor : mUsernameColor);
|
||||
|
||||
if (mDisplaySubredditName) {
|
||||
if (authorPrefixed.equals(post.getSubredditNamePrefixed())) {
|
||||
@ -700,12 +700,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
((PostBaseViewHolder) holder).downvoteTextView.setTextColor(mPostIconAndInfoColor);
|
||||
}
|
||||
|
||||
if (mPostType == PostPagingSource.TYPE_SUBREDDIT && !mDisplaySubredditName && post.isFeaturedInCommunity() || post.isFeaturedOnInstance()) {
|
||||
if (mPostType == PostPagingSource.TYPE_SUBREDDIT && !mDisplaySubredditName && post.isStickied()) {
|
||||
((PostBaseViewHolder) holder).stickiedPostImageView.setVisibility(View.VISIBLE);
|
||||
mGlide.load(R.drawable.ic_thumbtack_24dp).into(((PostBaseViewHolder) holder).stickiedPostImageView);
|
||||
if (post.isFeaturedOnInstance()) {
|
||||
((PostBaseViewHolder) holder).stickiedPostImageView.setColorFilter(mModeratorColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
}
|
||||
|
||||
if (post.isArchived()) {
|
||||
@ -1242,7 +1239,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
}
|
||||
|
||||
((PostCompactBaseViewHolder) holder).nameTextView.setTextColor(
|
||||
post.isModerator() || post.isAdmin() ? mModeratorColor : mUsernameColor);
|
||||
post.isModerator() ? mModeratorColor : mUsernameColor);
|
||||
|
||||
if (mHideSubredditAndUserPrefix) {
|
||||
((PostCompactBaseViewHolder) holder).nameTextView.setText(post.getAuthor());
|
||||
@ -1336,7 +1333,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
}
|
||||
}
|
||||
|
||||
if (mPostType == PostPagingSource.TYPE_SUBREDDIT && !mDisplaySubredditName && post.isFeaturedInCommunity()) {
|
||||
if (mPostType == PostPagingSource.TYPE_SUBREDDIT && !mDisplaySubredditName && post.isStickied()) {
|
||||
((PostCompactBaseViewHolder) holder).stickiedPostImageView.setVisibility(View.VISIBLE);
|
||||
mGlide.load(R.drawable.ic_thumbtack_24dp).into(((PostCompactBaseViewHolder) holder).stickiedPostImageView);
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ import java.util.concurrent.Executor;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import eu.toldi.infinityforlemmy.markdown.MarkdownUtils;
|
||||
import eu.toldi.infinityforlemmy.postfilter.PostFilter;
|
||||
import eu.toldi.infinityforlemmy.utils.JSONUtils;
|
||||
import eu.toldi.infinityforlemmy.utils.LemmyUtils;
|
||||
@ -186,7 +187,7 @@ public class ParsePost {
|
||||
boolean nsfw = post.getBoolean("nsfw");
|
||||
boolean locked = post.getBoolean("locked");
|
||||
boolean saved = data.getBoolean("saved");
|
||||
String distinguished = (creator.getBoolean("admin") ? "admin" : "");
|
||||
String distinguished = "";
|
||||
String suggestedSort = "";
|
||||
ArrayList <Post.Preview> previews = new ArrayList<>();
|
||||
if(!post.isNull("thumbnail_url")) {
|
||||
@ -218,9 +219,6 @@ public class ParsePost {
|
||||
String authorAvatar = (!data.getJSONObject("creator").isNull("avatar")) ? data.getJSONObject("creator").getString("avatar") : null;
|
||||
|
||||
Uri uri = Uri.parse(url);
|
||||
if (uri.getAuthority() == null) {
|
||||
Log.e("ParsePost", "parseData:" + uri.toString());
|
||||
}
|
||||
String path = uri.getPath();
|
||||
boolean isVideo = path.endsWith(".mp4") || path.endsWith(".webm") || path.endsWith(".gifv");
|
||||
|
||||
@ -366,7 +364,7 @@ public class ParsePost {
|
||||
|
||||
post.setPreviews(previews);
|
||||
post.setVideoUrl(url);
|
||||
} else if (uri.getAuthority() != null && uri.getAuthority().contains("imgur.com") && (path.endsWith(".gifv") || path.endsWith(".mp4"))) {
|
||||
} else if (uri.getAuthority().contains("imgur.com") && (path.endsWith(".gifv") || path.endsWith(".mp4"))) {
|
||||
// Imgur gifv/mp4
|
||||
int postType = Post.VIDEO_TYPE;
|
||||
|
||||
@ -659,7 +657,7 @@ public class ParsePost {
|
||||
post.setVoteType(data.getInt("my_vote"));
|
||||
if(post.getVoteType() == 1)
|
||||
post.setUpvotes(post.getUpvotes() - 1);
|
||||
else if (post.getVoteType() == -1)
|
||||
else if(post.getVoteType() == -1)
|
||||
post.setDownvotes(post.getDownvotes() - 1);
|
||||
}
|
||||
if (!data.getJSONObject("post").isNull("body")) {
|
||||
@ -668,13 +666,7 @@ public class ParsePost {
|
||||
post.setSelfTextPlain(body);
|
||||
post.setSelfTextPlainTrimmed(body.trim());
|
||||
}
|
||||
if (data.getJSONObject("post").getBoolean("featured_community")) {
|
||||
post.setFeaturedInCommunity(true);
|
||||
}
|
||||
|
||||
if (data.getJSONObject("post").getBoolean("featured_local")) {
|
||||
post.setFeaturedOnInstance(true);
|
||||
}
|
||||
post.setAuthorIconUrl(authorAvatar);
|
||||
post.setSubredditIconUrl(communityURL);
|
||||
return post;
|
||||
|
@ -66,9 +66,7 @@ public class Post implements Parcelable {
|
||||
private int upvoteRatio;
|
||||
private boolean hidden;
|
||||
private boolean nsfw;
|
||||
private boolean featuredInCommunity;
|
||||
|
||||
private boolean featuredOnInstance;
|
||||
private boolean stickied;
|
||||
private boolean archived;
|
||||
private boolean locked;
|
||||
private boolean saved;
|
||||
@ -103,6 +101,7 @@ public class Post implements Parcelable {
|
||||
this.upvoteRatio = upvoteRatio;
|
||||
this.hidden = hidden;
|
||||
this.nsfw = nsfw;
|
||||
this.stickied = stickied;
|
||||
this.archived = archived;
|
||||
this.locked = locked;
|
||||
this.saved = saved;
|
||||
@ -135,6 +134,7 @@ public class Post implements Parcelable {
|
||||
this.upvoteRatio = upvoteRatio;
|
||||
this.hidden = hidden;
|
||||
this.nsfw = nsfw;
|
||||
this.stickied = stickied;
|
||||
this.archived = archived;
|
||||
this.locked = locked;
|
||||
this.saved = saved;
|
||||
@ -177,7 +177,7 @@ public class Post implements Parcelable {
|
||||
upvoteRatio = in.readInt();
|
||||
hidden = in.readByte() != 0;
|
||||
nsfw = in.readByte() != 0;
|
||||
featuredInCommunity = in.readByte() != 0;
|
||||
stickied = in.readByte() != 0;
|
||||
archived = in.readByte() != 0;
|
||||
locked = in.readByte() != 0;
|
||||
saved = in.readByte() != 0;
|
||||
@ -444,20 +444,8 @@ public class Post implements Parcelable {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean isFeaturedInCommunity() {
|
||||
return featuredInCommunity;
|
||||
}
|
||||
|
||||
public void setFeaturedInCommunity(boolean featuredInCommunity) {
|
||||
this.featuredInCommunity = featuredInCommunity;
|
||||
}
|
||||
|
||||
public boolean isFeaturedOnInstance() {
|
||||
return featuredOnInstance;
|
||||
}
|
||||
|
||||
public void setFeaturedOnInstance(boolean featuredOnInstance) {
|
||||
this.featuredOnInstance = featuredOnInstance;
|
||||
public boolean isStickied() {
|
||||
return stickied;
|
||||
}
|
||||
|
||||
public boolean isArchived() {
|
||||
@ -546,7 +534,7 @@ public class Post implements Parcelable {
|
||||
parcel.writeInt(upvoteRatio);
|
||||
parcel.writeByte((byte) (hidden ? 1 : 0));
|
||||
parcel.writeByte((byte) (nsfw ? 1 : 0));
|
||||
parcel.writeByte((byte) (featuredInCommunity ? 1 : 0));
|
||||
parcel.writeByte((byte) (stickied ? 1 : 0));
|
||||
parcel.writeByte((byte) (archived ? 1 : 0));
|
||||
parcel.writeByte((byte) (locked ? 1 : 0));
|
||||
parcel.writeByte((byte) (saved ? 1 : 0));
|
||||
|
@ -105,7 +105,7 @@ public class CrashReportsFragment extends Fragment {
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
return false;
|
||||
}
|
||||
Uri githubIssueUri = Uri.parse(String.format("https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy/issues/new?template=.gitea/issue_template/bug_report.md&body=%s", logs));
|
||||
Uri githubIssueUri = Uri.parse(String.format("https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy/issues/new?template=.gitea%2fissue_template%2fbug_report.md", model, appVersion, androidVersion, logs));
|
||||
intent.setData(githubIssueUri);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
|
@ -6,10 +6,7 @@ import android.text.SpannableStringBuilder
|
||||
import android.text.style.URLSpan
|
||||
import android.text.util.Linkify
|
||||
import eu.toldi.infinityforlemmy.utils.LemmyUtils
|
||||
import io.noties.markwon.AbstractMarkwonPlugin
|
||||
import io.noties.markwon.MarkwonPlugin
|
||||
import io.noties.markwon.MarkwonVisitor
|
||||
import io.noties.markwon.SpannableBuilder
|
||||
import io.noties.markwon.*
|
||||
import io.noties.markwon.core.CorePlugin
|
||||
import io.noties.markwon.core.CoreProps
|
||||
import org.commonmark.node.Link
|
||||
@ -39,13 +36,13 @@ class MarkwonLemmyLinkPlugin : AbstractMarkwonPlugin() {
|
||||
* Pattern to match lemmy's unique community pattern, e.g. !commmunity[@instance]
|
||||
*/
|
||||
val lemmyCommunityPattern: Pattern =
|
||||
Pattern.compile("(?<!\\S)!($communityPatternFragment)(?:@($instancePatternFragment))\\b")
|
||||
Pattern.compile("(?<!\\S)!($communityPatternFragment)(?:@($instancePatternFragment))?\\b")
|
||||
|
||||
/**
|
||||
* Pattern to match lemmy's unique user pattern, e.g. @user[@instance]
|
||||
*/
|
||||
val lemmyUserPattern: Pattern =
|
||||
Pattern.compile("(?<!\\S)@($userPatternFragment)(?:@($instancePatternFragment))\\b")
|
||||
Pattern.compile("(?<!\\S)@($userPatternFragment)(?:@($instancePatternFragment))?\\b")
|
||||
|
||||
}
|
||||
override fun configure(registry: MarkwonPlugin.Registry) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user