mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-03-27 20:15:28 +01:00
Do not load inline images in data-saving mode
This commit is contained in:
parent
6b09f0379c
commit
03ee3899d7
@ -205,7 +205,7 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
Markwon postBodyMarkwon = MarkdownUtils.createFullRedditMarkwon(this,
|
Markwon postBodyMarkwon = MarkdownUtils.createFullRedditMarkwon(this,
|
||||||
miscPlugin, parentTextColor, parentSpoilerBackgroundColor, null);
|
miscPlugin, parentTextColor, parentSpoilerBackgroundColor, null, mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_IMAGE_PREVIEW, false));
|
||||||
MarkwonAdapter markwonAdapter = MarkdownUtils.createTablesAdapter();
|
MarkwonAdapter markwonAdapter = MarkdownUtils.createTablesAdapter();
|
||||||
binding.commentContentMarkdownView.setLayoutManager(new LinearLayoutManagerBugFixed(this));
|
binding.commentContentMarkdownView.setLayoutManager(new LinearLayoutManagerBugFixed(this));
|
||||||
binding.commentContentMarkdownView.setAdapter(markwonAdapter);
|
binding.commentContentMarkdownView.setAdapter(markwonAdapter);
|
||||||
|
@ -139,7 +139,7 @@ public class FullMarkdownActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
Markwon markwon = MarkdownUtils.createFullRedditMarkwon(this,
|
Markwon markwon = MarkdownUtils.createFullRedditMarkwon(this,
|
||||||
miscPlugin, markdownColor, spoilerBackgroundColor, null);
|
miscPlugin, markdownColor, spoilerBackgroundColor, null, mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_IMAGE_PREVIEW, false));
|
||||||
|
|
||||||
MarkwonAdapter markwonAdapter = MarkdownUtils.createTablesAdapter();
|
MarkwonAdapter markwonAdapter = MarkdownUtils.createTablesAdapter();
|
||||||
LinearLayoutManagerBugFixed linearLayoutManager = new SwipeLockLinearLayoutManager(this, new SwipeLockInterface() {
|
LinearLayoutManagerBugFixed linearLayoutManager = new SwipeLockLinearLayoutManager(this, new SwipeLockInterface() {
|
||||||
|
@ -149,7 +149,7 @@ public class InstanceInfoActivity extends BaseActivity {
|
|||||||
};
|
};
|
||||||
|
|
||||||
mPostDetailMarkwon = MarkdownUtils.createFullRedditMarkwon(this,
|
mPostDetailMarkwon = MarkdownUtils.createFullRedditMarkwon(this,
|
||||||
miscPlugin, markdownColor, postSpoilerBackgroundColor, null);
|
miscPlugin, markdownColor, postSpoilerBackgroundColor, null, mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_IMAGE_PREVIEW, false));
|
||||||
mMarkwonAdapter = MarkdownUtils.createTablesAdapter();
|
mMarkwonAdapter = MarkdownUtils.createTablesAdapter();
|
||||||
mContentMarkdownView.setAdapter(mMarkwonAdapter);
|
mContentMarkdownView.setAdapter(mMarkwonAdapter);
|
||||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
|
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
|
||||||
|
@ -132,7 +132,7 @@ public class RulesActivity extends BaseActivity {
|
|||||||
|
|
||||||
mSubredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME);
|
mSubredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME);
|
||||||
|
|
||||||
mAdapter = new RulesRecyclerViewAdapter(this, mCustomThemeWrapper, sliderPanel);
|
mAdapter = new RulesRecyclerViewAdapter(this, mCustomThemeWrapper, sliderPanel, mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_IMAGE_PREVIEW, false));
|
||||||
recyclerView.setAdapter(mAdapter);
|
recyclerView.setAdapter(mAdapter);
|
||||||
FetchSubredditData.fetchSubredditData(mRetrofit.getRetrofit(), mSubredditName, mAccessToken, new FetchSubredditData.FetchSubredditDataListener() {
|
FetchSubredditData.fetchSubredditData(mRetrofit.getRetrofit(), mSubredditName, mAccessToken, new FetchSubredditData.FetchSubredditDataListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,8 +5,8 @@ import static android.graphics.BitmapFactory.decodeResource;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.graphics.PorterDuff;
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -271,6 +271,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
|
|
||||||
private boolean showStatistics;
|
private boolean showStatistics;
|
||||||
|
|
||||||
|
private boolean disableImagePreview;
|
||||||
|
|
||||||
private boolean hideSubredditDescription;
|
private boolean hideSubredditDescription;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -285,6 +287,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
|
|
||||||
hideFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_FAB_IN_POST_FEED, false);
|
hideFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_FAB_IN_POST_FEED, false);
|
||||||
showStatistics = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_STATISTICS, true);
|
showStatistics = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_STATISTICS, true);
|
||||||
|
disableImagePreview = mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_IMAGE_PREVIEW, false);
|
||||||
showBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY, false);
|
showBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY, false);
|
||||||
navigationWrapper = new NavigationWrapper(findViewById(R.id.bottom_app_bar_bottom_app_bar), findViewById(R.id.linear_layout_bottom_app_bar),
|
navigationWrapper = new NavigationWrapper(findViewById(R.id.bottom_app_bar_bottom_app_bar), findViewById(R.id.linear_layout_bottom_app_bar),
|
||||||
findViewById(R.id.option_1_bottom_app_bar), findViewById(R.id.option_2_bottom_app_bar),
|
findViewById(R.id.option_1_bottom_app_bar), findViewById(R.id.option_2_bottom_app_bar),
|
||||||
@ -546,7 +549,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
Markwon markwon = MarkdownUtils.createDescriptionMarkwon(this, miscPlugin, onLinkLongClickListener);
|
Markwon markwon = MarkdownUtils.createDescriptionMarkwon(this, miscPlugin, onLinkLongClickListener, mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_IMAGE_PREVIEW, false));
|
||||||
|
|
||||||
descriptionTextView.setOnLongClickListener(view -> {
|
descriptionTextView.setOnLongClickListener(view -> {
|
||||||
if (description != null && !description.equals("") && descriptionTextView.getSelectionStart() == -1 && descriptionTextView.getSelectionEnd() == -1) {
|
if (description != null && !description.equals("") && descriptionTextView.getSelectionStart() == -1 && descriptionTextView.getSelectionEnd() == -1) {
|
||||||
@ -1731,6 +1734,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
bundle.putString(SidebarFragment.EXTRA_SUBREDDIT_NAME, communityName);
|
bundle.putString(SidebarFragment.EXTRA_SUBREDDIT_NAME, communityName);
|
||||||
bundle.putString(SidebarFragment.EXTRA_COMMUNITY_QUALIFIED_NAME, qualifiedName);
|
bundle.putString(SidebarFragment.EXTRA_COMMUNITY_QUALIFIED_NAME, qualifiedName);
|
||||||
bundle.putBoolean(SidebarFragment.EXTRA_SHOW_STATISTICS, !showStatistics);
|
bundle.putBoolean(SidebarFragment.EXTRA_SHOW_STATISTICS, !showStatistics);
|
||||||
|
bundle.putBoolean(SidebarFragment.EXTRA_DISABLE_IMAGE_PREVIEW, disableImagePreview);
|
||||||
fragment.setArguments(bundle);
|
fragment.setArguments(bundle);
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
@ -472,7 +472,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
urlMenuBottomSheetFragment.show(getSupportFragmentManager(), null);
|
urlMenuBottomSheetFragment.show(getSupportFragmentManager(), null);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
Markwon markwon = MarkdownUtils.createDescriptionMarkwon(this, miscPlugin, onLinkLongClickListener);
|
Markwon markwon = MarkdownUtils.createDescriptionMarkwon(this, miscPlugin, onLinkLongClickListener, mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_IMAGE_PREVIEW, false));
|
||||||
|
|
||||||
descriptionTextView.setOnLongClickListener(view -> {
|
descriptionTextView.setOnLongClickListener(view -> {
|
||||||
if (description != null && !description.equals("") && descriptionTextView.getSelectionStart() == -1 && descriptionTextView.getSelectionEnd() == -1) {
|
if (description != null && !description.equals("") && descriptionTextView.getSelectionStart() == -1 && descriptionTextView.getSelectionEnd() == -1) {
|
||||||
|
@ -176,7 +176,7 @@ public class WikiActivity extends BaseActivity {
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
markwon = MarkdownUtils.createFullRedditMarkwon(this,
|
markwon = MarkdownUtils.createFullRedditMarkwon(this,
|
||||||
miscPlugin, markdownColor, spoilerBackgroundColor, onLinkLongClickListener);
|
miscPlugin, markdownColor, spoilerBackgroundColor, onLinkLongClickListener, mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_IMAGE_PREVIEW, false));
|
||||||
|
|
||||||
markwonAdapter = MarkdownUtils.createTablesAdapter();
|
markwonAdapter = MarkdownUtils.createTablesAdapter();
|
||||||
LinearLayoutManagerBugFixed linearLayoutManager = new SwipeLockLinearLayoutManager(this, new SwipeLockInterface() {
|
LinearLayoutManagerBugFixed linearLayoutManager = new SwipeLockLinearLayoutManager(this, new SwipeLockInterface() {
|
||||||
|
@ -170,7 +170,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
mMarkwon = MarkdownUtils.createFullRedditMarkwon(mActivity,
|
mMarkwon = MarkdownUtils.createFullRedditMarkwon(mActivity,
|
||||||
miscPlugin, mCommentColor, commentSpoilerBackgroundColor, onLinkLongClickListener);
|
miscPlugin, mCommentColor, commentSpoilerBackgroundColor, onLinkLongClickListener, sharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_IMAGE_PREVIEW, false));
|
||||||
recycledViewPool = new RecyclerView.RecycledViewPool();
|
recycledViewPool = new RecyclerView.RecycledViewPool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
mCommentMarkwon = MarkdownUtils.createFullRedditMarkwon(mActivity,
|
mCommentMarkwon = MarkdownUtils.createFullRedditMarkwon(mActivity,
|
||||||
miscPlugin, mCommentTextColor, commentSpoilerBackgroundColor, onLinkLongClickListener);
|
miscPlugin, mCommentTextColor, commentSpoilerBackgroundColor, onLinkLongClickListener, sharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_IMAGE_PREVIEW, false));
|
||||||
recycledViewPool = new RecyclerView.RecycledViewPool();
|
recycledViewPool = new RecyclerView.RecycledViewPool();
|
||||||
mAccessToken = accessToken;
|
mAccessToken = accessToken;
|
||||||
mAccountQualifiedName = accountName;
|
mAccountQualifiedName = accountName;
|
||||||
|
@ -299,7 +299,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
mPostDetailMarkwon = MarkdownUtils.createFullRedditMarkwon(mActivity,
|
mPostDetailMarkwon = MarkdownUtils.createFullRedditMarkwon(mActivity,
|
||||||
miscPlugin, markdownColor, postSpoilerBackgroundColor, onLinkLongClickListener);
|
miscPlugin, markdownColor, postSpoilerBackgroundColor, onLinkLongClickListener, sharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_IMAGE_PREVIEW, false));
|
||||||
mMarkwonAdapter = MarkdownUtils.createTablesAdapter();
|
mMarkwonAdapter = MarkdownUtils.createTablesAdapter();
|
||||||
|
|
||||||
mSeparatePostAndComments = separatePostAndComments;
|
mSeparatePostAndComments = separatePostAndComments;
|
||||||
|
@ -37,6 +37,7 @@ import me.saket.bettermovementmethod.BetterLinkMovementMethod;
|
|||||||
public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecyclerViewAdapter.RuleViewHolder> {
|
public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecyclerViewAdapter.RuleViewHolder> {
|
||||||
private BaseActivity activity;
|
private BaseActivity activity;
|
||||||
private Markwon markwon;
|
private Markwon markwon;
|
||||||
|
private boolean mDisableImagePreview;
|
||||||
@Nullable
|
@Nullable
|
||||||
private final SliderPanel sliderPanel;
|
private final SliderPanel sliderPanel;
|
||||||
private ArrayList<Rule> rules;
|
private ArrayList<Rule> rules;
|
||||||
@ -44,10 +45,11 @@ public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecycler
|
|||||||
|
|
||||||
public RulesRecyclerViewAdapter(@NonNull BaseActivity activity,
|
public RulesRecyclerViewAdapter(@NonNull BaseActivity activity,
|
||||||
@NonNull CustomThemeWrapper customThemeWrapper,
|
@NonNull CustomThemeWrapper customThemeWrapper,
|
||||||
@Nullable SliderPanel sliderPanel) {
|
@Nullable SliderPanel sliderPanel, boolean disableImagePreview) {
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
this.sliderPanel = sliderPanel;
|
this.sliderPanel = sliderPanel;
|
||||||
mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor();
|
mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor();
|
||||||
|
mDisableImagePreview = disableImagePreview;
|
||||||
int spoilerBackgroundColor = mPrimaryTextColor | 0xFF000000;
|
int spoilerBackgroundColor = mPrimaryTextColor | 0xFF000000;
|
||||||
MarkwonPlugin miscPlugin = new AbstractMarkwonPlugin() {
|
MarkwonPlugin miscPlugin = new AbstractMarkwonPlugin() {
|
||||||
@Override
|
@Override
|
||||||
@ -82,7 +84,7 @@ public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecycler
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
markwon = MarkdownUtils.createFullRedditMarkwon(activity,
|
markwon = MarkdownUtils.createFullRedditMarkwon(activity,
|
||||||
miscPlugin, mPrimaryTextColor, spoilerBackgroundColor, onLinkLongClickListener);
|
miscPlugin, mPrimaryTextColor, spoilerBackgroundColor, onLinkLongClickListener, mDisableImagePreview);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
@ -66,6 +66,7 @@ public class SidebarFragment extends Fragment {
|
|||||||
public static final String EXTRA_COMMUNITY_QUALIFIED_NAME = "ECQN";
|
public static final String EXTRA_COMMUNITY_QUALIFIED_NAME = "ECQN";
|
||||||
|
|
||||||
public static final String EXTRA_SHOW_STATISTICS = "ESS";
|
public static final String EXTRA_SHOW_STATISTICS = "ESS";
|
||||||
|
public static final String EXTRA_DISABLE_IMAGE_PREVIEW = "EDIP";
|
||||||
public SubredditViewModel mSubredditViewModel;
|
public SubredditViewModel mSubredditViewModel;
|
||||||
@BindView(R.id.swipe_refresh_layout_sidebar_fragment)
|
@BindView(R.id.swipe_refresh_layout_sidebar_fragment)
|
||||||
SwipeRefreshLayout swipeRefreshLayout;
|
SwipeRefreshLayout swipeRefreshLayout;
|
||||||
@ -126,6 +127,8 @@ public class SidebarFragment extends Fragment {
|
|||||||
|
|
||||||
private boolean mShowStatistics;
|
private boolean mShowStatistics;
|
||||||
|
|
||||||
|
private boolean mDisableImagePreview;
|
||||||
|
|
||||||
private String communityQualifiedName;
|
private String communityQualifiedName;
|
||||||
private LinearLayoutManagerBugFixed linearLayoutManager;
|
private LinearLayoutManagerBugFixed linearLayoutManager;
|
||||||
private int markdownColor;
|
private int markdownColor;
|
||||||
@ -153,6 +156,7 @@ public class SidebarFragment extends Fragment {
|
|||||||
subredditName = getArguments().getString(EXTRA_SUBREDDIT_NAME);
|
subredditName = getArguments().getString(EXTRA_SUBREDDIT_NAME);
|
||||||
communityQualifiedName = getArguments().getString(EXTRA_COMMUNITY_QUALIFIED_NAME);
|
communityQualifiedName = getArguments().getString(EXTRA_COMMUNITY_QUALIFIED_NAME);
|
||||||
mShowStatistics = getArguments().getBoolean(EXTRA_SHOW_STATISTICS, true);
|
mShowStatistics = getArguments().getBoolean(EXTRA_SHOW_STATISTICS, true);
|
||||||
|
mDisableImagePreview = getArguments().getBoolean(EXTRA_DISABLE_IMAGE_PREVIEW, false);
|
||||||
if (communityQualifiedName == null) {
|
if (communityQualifiedName == null) {
|
||||||
Toast.makeText(activity, R.string.error_getting_community_name, Toast.LENGTH_SHORT).show();
|
Toast.makeText(activity, R.string.error_getting_community_name, Toast.LENGTH_SHORT).show();
|
||||||
return rootView;
|
return rootView;
|
||||||
@ -224,7 +228,7 @@ public class SidebarFragment extends Fragment {
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
Markwon markwon = MarkdownUtils.createFullRedditMarkwon(activity,
|
Markwon markwon = MarkdownUtils.createFullRedditMarkwon(activity,
|
||||||
miscPlugin, markdownColor, spoilerBackgroundColor, onLinkLongClickListener);
|
miscPlugin, markdownColor, spoilerBackgroundColor, onLinkLongClickListener, mDisableImagePreview);
|
||||||
MarkwonAdapter markwonAdapter = MarkdownUtils.createTablesAdapter();
|
MarkwonAdapter markwonAdapter = MarkdownUtils.createTablesAdapter();
|
||||||
|
|
||||||
linearLayoutManager = new LinearLayoutManagerBugFixed(activity);
|
linearLayoutManager = new LinearLayoutManagerBugFixed(activity);
|
||||||
|
@ -38,44 +38,84 @@ public class MarkdownUtils {
|
|||||||
@NonNull MarkwonPlugin miscPlugin,
|
@NonNull MarkwonPlugin miscPlugin,
|
||||||
int markdownColor,
|
int markdownColor,
|
||||||
int spoilerBackgroundColor,
|
int spoilerBackgroundColor,
|
||||||
@Nullable BetterLinkMovementMethod.OnLinkLongClickListener onLinkLongClickListener) {
|
@Nullable BetterLinkMovementMethod.OnLinkLongClickListener onLinkLongClickListener, boolean dataSaverEnabled) {
|
||||||
return Markwon.builder(context)
|
Markwon result;
|
||||||
.usePlugin(GlideImagesPlugin.create(context.getApplicationContext()))
|
if (dataSaverEnabled) {
|
||||||
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
result = Markwon.builder(context)
|
||||||
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
||||||
}))
|
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
||||||
.usePlugin(miscPlugin)
|
}))
|
||||||
.usePlugin(SuperscriptPlugin.create())
|
.usePlugin(miscPlugin)
|
||||||
.usePlugin(SpoilerParserPlugin.create(markdownColor, spoilerBackgroundColor))
|
.usePlugin(SuperscriptPlugin.create())
|
||||||
.usePlugin(RedditHeadingPlugin.create())
|
.usePlugin(SpoilerParserPlugin.create(markdownColor, spoilerBackgroundColor))
|
||||||
.usePlugin(StrikethroughPlugin.create())
|
.usePlugin(RedditHeadingPlugin.create())
|
||||||
.usePlugin(MovementMethodPlugin.create(new SpoilerAwareMovementMethod()
|
.usePlugin(StrikethroughPlugin.create())
|
||||||
.setOnLinkLongClickListener(onLinkLongClickListener)))
|
.usePlugin(MovementMethodPlugin.create(new SpoilerAwareMovementMethod()
|
||||||
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
|
.setOnLinkLongClickListener(onLinkLongClickListener)))
|
||||||
.usePlugin(TableEntryPlugin.create(context))
|
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
|
||||||
.usePlugin(ClickableGlideImagesPlugin.create(context))
|
.usePlugin(TableEntryPlugin.create(context))
|
||||||
.usePlugin(new MarkwonLemmyLinkPlugin())
|
.usePlugin(new MarkwonLemmyLinkPlugin())
|
||||||
.build();
|
.build();
|
||||||
|
} else {
|
||||||
|
result = Markwon.builder(context)
|
||||||
|
.usePlugin(GlideImagesPlugin.create(context.getApplicationContext()))
|
||||||
|
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
||||||
|
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
||||||
|
}))
|
||||||
|
.usePlugin(miscPlugin)
|
||||||
|
.usePlugin(SuperscriptPlugin.create())
|
||||||
|
.usePlugin(SpoilerParserPlugin.create(markdownColor, spoilerBackgroundColor))
|
||||||
|
.usePlugin(RedditHeadingPlugin.create())
|
||||||
|
.usePlugin(StrikethroughPlugin.create())
|
||||||
|
.usePlugin(MovementMethodPlugin.create(new SpoilerAwareMovementMethod()
|
||||||
|
.setOnLinkLongClickListener(onLinkLongClickListener)))
|
||||||
|
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
|
||||||
|
.usePlugin(TableEntryPlugin.create(context))
|
||||||
|
.usePlugin(ClickableGlideImagesPlugin.create(context))
|
||||||
|
.usePlugin(new MarkwonLemmyLinkPlugin())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public static Markwon createDescriptionMarkwon(Activity context, MarkwonPlugin miscPlugin,
|
public static Markwon createDescriptionMarkwon(Activity context, MarkwonPlugin miscPlugin,
|
||||||
BetterLinkMovementMethod.OnLinkLongClickListener onLinkLongClickListener) {
|
BetterLinkMovementMethod.OnLinkLongClickListener onLinkLongClickListener, boolean dataSaverEnabled) {
|
||||||
return Markwon.builder(context)
|
Markwon result;
|
||||||
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
if (dataSaverEnabled) {
|
||||||
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
result = Markwon.builder(context)
|
||||||
}))
|
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
||||||
.usePlugin(miscPlugin)
|
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
||||||
.usePlugin(SuperscriptPlugin.create())
|
}))
|
||||||
.usePlugin(RedditHeadingPlugin.create())
|
.usePlugin(miscPlugin)
|
||||||
.usePlugin(StrikethroughPlugin.create())
|
.usePlugin(SuperscriptPlugin.create())
|
||||||
.usePlugin(MovementMethodPlugin.create(new SpoilerAwareMovementMethod()
|
.usePlugin(RedditHeadingPlugin.create())
|
||||||
.setOnLinkLongClickListener(onLinkLongClickListener)))
|
.usePlugin(StrikethroughPlugin.create())
|
||||||
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
|
.usePlugin(MovementMethodPlugin.create(new SpoilerAwareMovementMethod()
|
||||||
.usePlugin(TableEntryPlugin.create(context))
|
.setOnLinkLongClickListener(onLinkLongClickListener)))
|
||||||
.usePlugin(GlideImagesPlugin.create(context.getApplicationContext()))
|
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
|
||||||
.usePlugin(new MarkwonLemmyLinkPlugin())
|
.usePlugin(TableEntryPlugin.create(context))
|
||||||
.build();
|
.usePlugin(new MarkwonLemmyLinkPlugin())
|
||||||
|
.build();
|
||||||
|
} else {
|
||||||
|
result = Markwon.builder(context)
|
||||||
|
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
||||||
|
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
||||||
|
}))
|
||||||
|
.usePlugin(miscPlugin)
|
||||||
|
.usePlugin(SuperscriptPlugin.create())
|
||||||
|
.usePlugin(RedditHeadingPlugin.create())
|
||||||
|
.usePlugin(StrikethroughPlugin.create())
|
||||||
|
.usePlugin(MovementMethodPlugin.create(new SpoilerAwareMovementMethod()
|
||||||
|
.setOnLinkLongClickListener(onLinkLongClickListener)))
|
||||||
|
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
|
||||||
|
.usePlugin(TableEntryPlugin.create(context))
|
||||||
|
.usePlugin(GlideImagesPlugin.create(context.getApplicationContext()))
|
||||||
|
.usePlugin(new MarkwonLemmyLinkPlugin())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user