diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-07-17 23:52:57 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-07-17 23:52:57 +0000 |
commit | 6bbfa4f85ae8e3e66fa90df263be2a018e73a8f5 (patch) | |
tree | 0198eca8f5df55998db5ae3559ee9ef9fb95447b /app/src | |
parent | c7479f3fdbfb175f5757218c6b1395c36bb573aa (diff) | |
download | infinity-for-reddit-6bbfa4f85ae8e3e66fa90df263be2a018e73a8f5.tar infinity-for-reddit-6bbfa4f85ae8e3e66fa90df263be2a018e73a8f5.tar.gz infinity-for-reddit-6bbfa4f85ae8e3e66fa90df263be2a018e73a8f5.tar.bz2 infinity-for-reddit-6bbfa4f85ae8e3e66fa90df263be2a018e73a8f5.tar.lz infinity-for-reddit-6bbfa4f85ae8e3e66fa90df263be2a018e73a8f5.tar.xz infinity-for-reddit-6bbfa4f85ae8e3e66fa90df263be2a018e73a8f5.tar.zst infinity-for-reddit-6bbfa4f85ae8e3e66fa90df263be2a018e73a8f5.zip |
Apply embedded media type setting to EmotePlugin.
Diffstat (limited to 'app/src')
11 files changed, 116 insertions, 100 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java index 0261eae5..bfa5dc1d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java @@ -216,16 +216,17 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA } }; EmoteCloseBracketInlineProcessor emoteCloseBracketInlineProcessor = new EmoteCloseBracketInlineProcessor(); - emotePlugin = EmotePlugin.create(this, mediaMetadata -> { - Intent imageIntent = new Intent(this, ViewImageOrGifActivity.class); - if (mediaMetadata.isGIF) { - imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_GIF_URL_KEY, mediaMetadata.original.url); - } else { - imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_IMAGE_URL_KEY, mediaMetadata.original.url); - } - imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_SUBREDDIT_OR_USERNAME_KEY, intent.getStringExtra(EXTRA_SUBREDDIT_NAME_KEY)); - imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, mediaMetadata.fileName); - }); + emotePlugin = EmotePlugin.create(this, SharedPreferencesUtils.EMBEDDED_MEDIA_ALL, + mediaMetadata -> { + Intent imageIntent = new Intent(this, ViewImageOrGifActivity.class); + if (mediaMetadata.isGIF) { + imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_GIF_URL_KEY, mediaMetadata.original.url); + } else { + imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_IMAGE_URL_KEY, mediaMetadata.original.url); + } + imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_SUBREDDIT_OR_USERNAME_KEY, intent.getStringExtra(EXTRA_SUBREDDIT_NAME_KEY)); + imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, mediaMetadata.fileName); + }); ImageAndGifPlugin imageAndGifPlugin = new ImageAndGifPlugin(); imageAndGifEntry = new ImageAndGifEntry(this, mGlide, SharedPreferencesUtils.EMBEDDED_MEDIA_ALL, mediaMetadata -> { Intent imageIntent = new Intent(this, ViewImageOrGifActivity.class); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java index 691b411d..976b5e24 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java @@ -164,16 +164,17 @@ public class WikiActivity extends BaseActivity { return true; }; emoteCloseBracketInlineProcessor = new EmoteCloseBracketInlineProcessor(); - emotePlugin = EmotePlugin.create(this, mediaMetadata -> { - Intent intent = new Intent(this, ViewImageOrGifActivity.class); - if (mediaMetadata.isGIF) { - intent.putExtra(ViewImageOrGifActivity.EXTRA_GIF_URL_KEY, mediaMetadata.original.url); - } else { - intent.putExtra(ViewImageOrGifActivity.EXTRA_IMAGE_URL_KEY, mediaMetadata.original.url); - } - intent.putExtra(ViewImageOrGifActivity.EXTRA_SUBREDDIT_OR_USERNAME_KEY, mSubredditName); - intent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, mediaMetadata.fileName); - }); + emotePlugin = EmotePlugin.create(this, SharedPreferencesUtils.EMBEDDED_MEDIA_ALL, + mediaMetadata -> { + Intent intent = new Intent(this, ViewImageOrGifActivity.class); + if (mediaMetadata.isGIF) { + intent.putExtra(ViewImageOrGifActivity.EXTRA_GIF_URL_KEY, mediaMetadata.original.url); + } else { + intent.putExtra(ViewImageOrGifActivity.EXTRA_IMAGE_URL_KEY, mediaMetadata.original.url); + } + intent.putExtra(ViewImageOrGifActivity.EXTRA_SUBREDDIT_OR_USERNAME_KEY, mSubredditName); + intent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, mediaMetadata.fileName); + }); imageAndGifPlugin = new ImageAndGifPlugin(); imageAndGifEntry = new ImageAndGifEntry(this, mGlide, SharedPreferencesUtils.EMBEDDED_MEDIA_ALL, mediaMetadata -> { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java index 95ad046c..b6178dc1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java @@ -180,20 +180,22 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment return true; }; mEmoteCloseBracketInlineProcessor = new EmoteCloseBracketInlineProcessor(); - mEmotePlugin = EmotePlugin.create(activity, mediaMetadata -> { - Intent intent = new Intent(activity, ViewImageOrGifActivity.class); - if (mediaMetadata.isGIF) { - intent.putExtra(ViewImageOrGifActivity.EXTRA_GIF_URL_KEY, mediaMetadata.original.url); - } else { - intent.putExtra(ViewImageOrGifActivity.EXTRA_IMAGE_URL_KEY, mediaMetadata.original.url); - } - intent.putExtra(ViewImageOrGifActivity.EXTRA_SUBREDDIT_OR_USERNAME_KEY, username); - intent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, mediaMetadata.fileName); - if (canStartActivity) { - canStartActivity = false; - activity.startActivity(intent); - } - }); + mEmotePlugin = EmotePlugin.create(activity, + Integer.parseInt(sharedPreferences.getString(SharedPreferencesUtils.EMBEDDED_MEDIA_TYPE, "15")), + mediaMetadata -> { + Intent intent = new Intent(activity, ViewImageOrGifActivity.class); + if (mediaMetadata.isGIF) { + intent.putExtra(ViewImageOrGifActivity.EXTRA_GIF_URL_KEY, mediaMetadata.original.url); + } else { + intent.putExtra(ViewImageOrGifActivity.EXTRA_IMAGE_URL_KEY, mediaMetadata.original.url); + } + intent.putExtra(ViewImageOrGifActivity.EXTRA_SUBREDDIT_OR_USERNAME_KEY, username); + intent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, mediaMetadata.fileName); + if (canStartActivity) { + canStartActivity = false; + activity.startActivity(intent); + } + }); mImageAndGifPlugin = new ImageAndGifPlugin(); mMarkwon = MarkdownUtils.createFullRedditMarkwon(mActivity, miscPlugin, mEmoteCloseBracketInlineProcessor, mEmotePlugin, mImageAndGifPlugin, mCommentColor, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java index f4000e5c..65628bea 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java @@ -220,21 +220,23 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi return true; }; mEmoteCloseBracketInlineProcessor = new EmoteCloseBracketInlineProcessor(); - mEmotePlugin = EmotePlugin.create(activity, mediaMetadata -> { - Intent intent = new Intent(activity, ViewImageOrGifActivity.class); - if (mediaMetadata.isGIF) { - intent.putExtra(ViewImageOrGifActivity.EXTRA_GIF_URL_KEY, mediaMetadata.original.url); - } else { - intent.putExtra(ViewImageOrGifActivity.EXTRA_IMAGE_URL_KEY, mediaMetadata.original.url); - } - intent.putExtra(ViewImageOrGifActivity.EXTRA_IS_NSFW, post.isNSFW()); - intent.putExtra(ViewImageOrGifActivity.EXTRA_SUBREDDIT_OR_USERNAME_KEY, post.getSubredditName()); - intent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, mediaMetadata.fileName); - if (canStartActivity) { - canStartActivity = false; - activity.startActivity(intent); - } - }); + mEmotePlugin = EmotePlugin.create(activity, + Integer.parseInt(sharedPreferences.getString(SharedPreferencesUtils.EMBEDDED_MEDIA_TYPE, "15")), + mediaMetadata -> { + Intent intent = new Intent(activity, ViewImageOrGifActivity.class); + if (mediaMetadata.isGIF) { + intent.putExtra(ViewImageOrGifActivity.EXTRA_GIF_URL_KEY, mediaMetadata.original.url); + } else { + intent.putExtra(ViewImageOrGifActivity.EXTRA_IMAGE_URL_KEY, mediaMetadata.original.url); + } + intent.putExtra(ViewImageOrGifActivity.EXTRA_IS_NSFW, post.isNSFW()); + intent.putExtra(ViewImageOrGifActivity.EXTRA_SUBREDDIT_OR_USERNAME_KEY, post.getSubredditName()); + intent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, mediaMetadata.fileName); + if (canStartActivity) { + canStartActivity = false; + activity.startActivity(intent); + } + }); mImageAndGifPlugin = new ImageAndGifPlugin(); mCommentMarkwon = MarkdownUtils.createFullRedditMarkwon(mActivity, miscPlugin, mEmoteCloseBracketInlineProcessor, mEmotePlugin, mImageAndGifPlugin, mCommentTextColor, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java index 5f5c7cd7..bfe7a333 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java @@ -384,21 +384,23 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler return true; }; mEmoteCloseBracketInlineProcessor = new EmoteCloseBracketInlineProcessor(); - mEmotePlugin = EmotePlugin.create(activity, mDataSavingMode, mDisableImagePreview, mediaMetadata -> { - Intent intent = new Intent(activity, ViewImageOrGifActivity.class); - if (mediaMetadata.isGIF) { - intent.putExtra(ViewImageOrGifActivity.EXTRA_GIF_URL_KEY, mediaMetadata.original.url); - } else { - intent.putExtra(ViewImageOrGifActivity.EXTRA_IMAGE_URL_KEY, mediaMetadata.original.url); - } - intent.putExtra(ViewImageOrGifActivity.EXTRA_IS_NSFW, post.isNSFW()); - intent.putExtra(ViewImageOrGifActivity.EXTRA_SUBREDDIT_OR_USERNAME_KEY, post.getSubredditName()); - intent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, mediaMetadata.fileName); - if (canStartActivity) { - canStartActivity = false; - activity.startActivity(intent); - } - }); + mEmotePlugin = EmotePlugin.create(activity, + Integer.parseInt(sharedPreferences.getString(SharedPreferencesUtils.EMBEDDED_MEDIA_TYPE, "15")), + mDataSavingMode, mDisableImagePreview, mediaMetadata -> { + Intent intent = new Intent(activity, ViewImageOrGifActivity.class); + if (mediaMetadata.isGIF) { + intent.putExtra(ViewImageOrGifActivity.EXTRA_GIF_URL_KEY, mediaMetadata.original.url); + } else { + intent.putExtra(ViewImageOrGifActivity.EXTRA_IMAGE_URL_KEY, mediaMetadata.original.url); + } + intent.putExtra(ViewImageOrGifActivity.EXTRA_IS_NSFW, post.isNSFW()); + intent.putExtra(ViewImageOrGifActivity.EXTRA_SUBREDDIT_OR_USERNAME_KEY, post.getSubredditName()); + intent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, mediaMetadata.fileName); + if (canStartActivity) { + canStartActivity = false; + activity.startActivity(intent); + } + }); mImageAndGifPlugin = new ImageAndGifPlugin(); mPostDetailMarkwon = MarkdownUtils.createFullRedditMarkwon(mActivity, miscPlugin, mEmoteCloseBracketInlineProcessor, mEmotePlugin, mImageAndGifPlugin, markdownColor, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java index 3be31942..3aefb319 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java @@ -92,16 +92,17 @@ public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecycler return true; }; emoteCloseBracketInlineProcessor = new EmoteCloseBracketInlineProcessor(); - emotePlugin = EmotePlugin.create(activity, mediaMetadata -> { - Intent imageIntent = new Intent(activity, ViewImageOrGifActivity.class); - if (mediaMetadata.isGIF) { - imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_GIF_URL_KEY, mediaMetadata.original.url); - } else { - imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_IMAGE_URL_KEY, mediaMetadata.original.url); - } - imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_SUBREDDIT_OR_USERNAME_KEY, subredditName); - imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, mediaMetadata.fileName); - }); + emotePlugin = EmotePlugin.create(activity, SharedPreferencesUtils.EMBEDDED_MEDIA_ALL, + mediaMetadata -> { + Intent imageIntent = new Intent(activity, ViewImageOrGifActivity.class); + if (mediaMetadata.isGIF) { + imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_GIF_URL_KEY, mediaMetadata.original.url); + } else { + imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_IMAGE_URL_KEY, mediaMetadata.original.url); + } + imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_SUBREDDIT_OR_USERNAME_KEY, subredditName); + imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, mediaMetadata.fileName); + }); imageAndGifPlugin = new ImageAndGifPlugin(); imageAndGifEntry = new ImageAndGifEntry(activity, Glide.with(activity), SharedPreferencesUtils.EMBEDDED_MEDIA_ALL, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java index e1a1f13d..96628942 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java @@ -151,16 +151,17 @@ public class SidebarFragment extends Fragment { return true; }; EmoteCloseBracketInlineProcessor emoteCloseBracketInlineProcessor = new EmoteCloseBracketInlineProcessor(); - emotePlugin = EmotePlugin.create(activity, mediaMetadata -> { - Intent imageIntent = new Intent(activity, ViewImageOrGifActivity.class); - if (mediaMetadata.isGIF) { - imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_GIF_URL_KEY, mediaMetadata.original.url); - } else { - imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_IMAGE_URL_KEY, mediaMetadata.original.url); - } - imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_SUBREDDIT_OR_USERNAME_KEY, subredditName); - imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, mediaMetadata.fileName); - }); + emotePlugin = EmotePlugin.create(activity, SharedPreferencesUtils.EMBEDDED_MEDIA_ALL, + mediaMetadata -> { + Intent imageIntent = new Intent(activity, ViewImageOrGifActivity.class); + if (mediaMetadata.isGIF) { + imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_GIF_URL_KEY, mediaMetadata.original.url); + } else { + imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_IMAGE_URL_KEY, mediaMetadata.original.url); + } + imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_SUBREDDIT_OR_USERNAME_KEY, subredditName); + imageIntent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, mediaMetadata.fileName); + }); ImageAndGifPlugin imageAndGifPlugin = new ImageAndGifPlugin(); imageAndGifEntry = new ImageAndGifEntry(activity, Glide.with(this), SharedPreferencesUtils.EMBEDDED_MEDIA_ALL, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/EmotePlugin.java b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/EmotePlugin.java index b0bc199c..1fbc68d4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/EmotePlugin.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/EmotePlugin.java @@ -44,6 +44,7 @@ public class EmotePlugin extends AbstractMarkwonPlugin { private final GlideAsyncDrawableLoader glideAsyncDrawableLoader; private boolean dataSavingMode; private final boolean disableImagePreview; + private final boolean canShowEmote; private final OnEmoteClickListener onEmoteClickListener; public interface GlideStore { @@ -59,7 +60,8 @@ public class EmotePlugin extends AbstractMarkwonPlugin { } @NonNull - public static EmotePlugin create(@NonNull final BaseActivity baseActivity, @NonNull final OnEmoteClickListener onEmoteClickListener) { + public static EmotePlugin create(@NonNull final BaseActivity baseActivity, int embeddedMediaType, + @NonNull final OnEmoteClickListener onEmoteClickListener) { // @since 4.5.0 cache RequestManager // sometimes `cancel` would be called after activity is destroyed, // so `Glide.with(baseActivity)` will throw an exception @@ -75,12 +77,12 @@ public class EmotePlugin extends AbstractMarkwonPlugin { public void cancel(@NonNull Target<?> target) { requestManager.clear(target); } - }, onEmoteClickListener); + }, embeddedMediaType, onEmoteClickListener); } @NonNull - public static EmotePlugin create(@NonNull final BaseActivity baseActivity, boolean dataSavingMode, - boolean disableImagePreview, + public static EmotePlugin create(@NonNull final BaseActivity baseActivity, int embeddedMediaType, + boolean dataSavingMode, boolean disableImagePreview, @NonNull final OnEmoteClickListener onEmoteClickListener) { // @since 4.5.0 cache RequestManager // sometimes `cancel` would be called after activity is destroyed, @@ -97,11 +99,12 @@ public class EmotePlugin extends AbstractMarkwonPlugin { public void cancel(@NonNull Target<?> target) { requestManager.clear(target); } - }, dataSavingMode, disableImagePreview, onEmoteClickListener); + }, embeddedMediaType, dataSavingMode, disableImagePreview, onEmoteClickListener); } @SuppressWarnings("WeakerAccess") - EmotePlugin(@NonNull final BaseActivity baseActivity, @NonNull GlideStore glideStore, + EmotePlugin(@NonNull final BaseActivity baseActivity, + @NonNull GlideStore glideStore, int embeddedMediaType, @NonNull final OnEmoteClickListener onEmoteClickListener) { this.glideAsyncDrawableLoader = new GlideAsyncDrawableLoader(glideStore); String dataSavingModeString = baseActivity.getDefaultSharedPreferences().getString(SharedPreferencesUtils.DATA_SAVING_MODE, SharedPreferencesUtils.DATA_SAVING_MODE_OFF); @@ -111,15 +114,18 @@ public class EmotePlugin extends AbstractMarkwonPlugin { dataSavingMode = Utils.getConnectedNetwork(baseActivity) == Utils.NETWORK_TYPE_CELLULAR; } disableImagePreview = baseActivity.getDefaultSharedPreferences().getBoolean(SharedPreferencesUtils.DISABLE_IMAGE_PREVIEW, false); + canShowEmote = SharedPreferencesUtils.canShowEmote(embeddedMediaType); this.onEmoteClickListener = onEmoteClickListener; } @SuppressWarnings("WeakerAccess") - EmotePlugin(@NonNull final BaseActivity baseActivity, @NonNull GlideStore glideStore, boolean dataSavingMode, - boolean disableImagePreview, @NonNull final OnEmoteClickListener onEmoteClickListener) { + EmotePlugin(@NonNull final BaseActivity baseActivity, @NonNull GlideStore glideStore, + int embeddedMediaType, boolean dataSavingMode, boolean disableImagePreview, + @NonNull final OnEmoteClickListener onEmoteClickListener) { this.glideAsyncDrawableLoader = new GlideAsyncDrawableLoader(glideStore); this.dataSavingMode = dataSavingMode; this.disableImagePreview = disableImagePreview; + canShowEmote = SharedPreferencesUtils.canShowEmote(embeddedMediaType); this.onEmoteClickListener = onEmoteClickListener; } @@ -136,7 +142,7 @@ public class EmotePlugin extends AbstractMarkwonPlugin { @Override public void configureVisitor(@NonNull MarkwonVisitor.Builder builder) { builder.on(Emote.class, (visitor, emote) -> { - if (dataSavingMode && disableImagePreview) { + if ((dataSavingMode && disableImagePreview) || !canShowEmote) { Link link = new Link(emote.getMediaMetadata().original.url, emote.getTitle()); final int length = visitor.length(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java index ff2f800e..b5bb598a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java @@ -267,7 +267,7 @@ public class SharedPreferencesUtils { return embeddedMediaType == 15 || embeddedMediaType == 7 || embeddedMediaType == 5 || embeddedMediaType == 2; } - public static boolean canShowEmoji(int embeddedMediaType) { + public static boolean canShowEmote(int embeddedMediaType) { return embeddedMediaType == 15 || embeddedMediaType == 6 || embeddedMediaType == 5 || embeddedMediaType == 1; } diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 3b94b241..8da3ffdb 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -701,11 +701,11 @@ <string-array name="settings_embedded_media_type"> <item>@string/all</item> <item>@string/image_and_gif</item> - <item>@string/image_and_emoji</item> - <item>@string/gif_and_emoji</item> + <item>@string/image_and_emote</item> + <item>@string/gif_and_emote</item> <item>@string/image_embedded_media</item> <item>@string/gif</item> - <item>@string/emoji</item> + <item>@string/emote</item> <item>@string/none</item> </string-array> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 833411b2..039627dd 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1395,10 +1395,10 @@ <string name="online">Online</string> <string name="image_and_gif">Image and GIF</string> - <string name="image_and_emoji">Image and emoji</string> - <string name="gif_and_emoji">GIF and emoji</string> + <string name="image_and_emote">Image and emote</string> + <string name="gif_and_emote">GIF and emote</string> <string name="image_embedded_media">Image</string> - <string name="emoji">Emoji</string> + <string name="emote">Emote</string> <string name="none">None</string> |