Don't pass reduntant View arguments to linkify

When used as a plugin for Markwon; BetterLinkMovement iterates TextViews under the ViewGroup at the setMarkdown stage, so there is no need to for this argument.

Don't give a whole Activity as  an argument to this method, this causes bugs.
This commit is contained in:
scria1000 2021-11-28 03:27:35 +03:00
parent d8f6572262
commit f848dad466
5 changed files with 5 additions and 5 deletions

View File

@ -404,7 +404,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
builder.linkColor(mCustomThemeWrapper.getLinkColor());
}
})
.usePlugin(MovementMethodPlugin.create(BetterLinkMovementMethod.linkify(Linkify.WEB_URLS, descriptionTextView).setOnLinkLongClickListener((textView, url) -> {
.usePlugin(MovementMethodPlugin.create(BetterLinkMovementMethod.linkify(Linkify.WEB_URLS).setOnLinkLongClickListener((textView, url) -> {
UrlMenuBottomSheetFragment urlMenuBottomSheetFragment = new UrlMenuBottomSheetFragment();
Bundle bundle = new Bundle();
bundle.putString(UrlMenuBottomSheetFragment.EXTRA_URL, url);

View File

@ -400,7 +400,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
builder.linkColor(mCustomThemeWrapper.getLinkColor());
}
})
.usePlugin(MovementMethodPlugin.create(BetterLinkMovementMethod.linkify(Linkify.WEB_URLS, descriptionTextView).setOnLinkLongClickListener((textView, url) -> {
.usePlugin(MovementMethodPlugin.create(BetterLinkMovementMethod.linkify(Linkify.WEB_URLS).setOnLinkLongClickListener((textView, url) -> {
UrlMenuBottomSheetFragment urlMenuBottomSheetFragment = new UrlMenuBottomSheetFragment();
Bundle bundle = new Bundle();
bundle.putString(UrlMenuBottomSheetFragment.EXTRA_URL, url);

View File

@ -282,7 +282,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
})
.usePlugin(SpoilerParserPlugin.create(markdownColor, postSpoilerBackgroundColor))
.usePlugin(StrikethroughPlugin.create())
.usePlugin(MovementMethodPlugin.create(BetterLinkMovementMethod.linkify(Linkify.WEB_URLS, activity).setOnLinkLongClickListener((textView, url) -> {
.usePlugin(MovementMethodPlugin.create(BetterLinkMovementMethod.linkify(Linkify.WEB_URLS).setOnLinkLongClickListener((textView, url) -> {
if (activity != null && !activity.isDestroyed() && !activity.isFinishing()) {
UrlMenuBottomSheetFragment urlMenuBottomSheetFragment = new UrlMenuBottomSheetFragment();
Bundle bundle = new Bundle();

View File

@ -76,7 +76,7 @@ public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecycler
builder.linkColor(customThemeWrapper.getLinkColor());
}
})
.usePlugin(MovementMethodPlugin.create(BetterLinkMovementMethod.linkify(Linkify.WEB_URLS, activity).setOnLinkLongClickListener((textView, url) -> {
.usePlugin(MovementMethodPlugin.create(BetterLinkMovementMethod.linkify(Linkify.WEB_URLS).setOnLinkLongClickListener((textView, url) -> {
if (activity != null && !activity.isDestroyed() && !activity.isFinishing()) {
UrlMenuBottomSheetFragment urlMenuBottomSheetFragment = new UrlMenuBottomSheetFragment();
Bundle bundle = new Bundle();

View File

@ -157,7 +157,7 @@ public class SidebarFragment extends Fragment {
})
.usePlugin(StrikethroughPlugin.create())
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
.usePlugin(MovementMethodPlugin.create(BetterLinkMovementMethod.linkify(Linkify.WEB_URLS, recyclerView).setOnLinkLongClickListener((textView, url) -> {
.usePlugin(MovementMethodPlugin.create(BetterLinkMovementMethod.linkify(Linkify.WEB_URLS).setOnLinkLongClickListener((textView, url) -> {
UrlMenuBottomSheetFragment urlMenuBottomSheetFragment = new UrlMenuBottomSheetFragment();
Bundle bundle = new Bundle();
bundle.putString(UrlMenuBottomSheetFragment.EXTRA_URL, url);