Fix clicking tab text does not change page in ViewUserDetailActivity, ViewSubredditDetailActivity or AccoundSavedThingActivity.

This commit is contained in:
Alex Ning 2021-11-07 14:43:34 +08:00
parent 23368c89a8
commit eb34cfecce
4 changed files with 13 additions and 16 deletions

View File

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

View File

@ -43,7 +43,6 @@ import io.noties.markwon.core.MarkwonTheme;
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin; import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
import io.noties.markwon.html.HtmlPlugin; import io.noties.markwon.html.HtmlPlugin;
import io.noties.markwon.linkify.LinkifyPlugin; import io.noties.markwon.linkify.LinkifyPlugin;
import io.noties.markwon.movement.MovementMethodPlugin;
import me.saket.bettermovementmethod.BetterLinkMovementMethod; import me.saket.bettermovementmethod.BetterLinkMovementMethod;
import ml.docilealligator.infinityforreddit.NetworkState; import ml.docilealligator.infinityforreddit.NetworkState;
import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.R;
@ -192,16 +191,6 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
} }
}) })
.usePlugin(MovementMethodPlugin.create(BetterLinkMovementMethod.linkify(Linkify.WEB_URLS, activity).setOnLinkLongClickListener((textView, url) -> {
if (activity != null && !activity.isDestroyed() && !activity.isFinishing()) {
UrlMenuBottomSheetFragment urlMenuBottomSheetFragment = new UrlMenuBottomSheetFragment();
Bundle bundle = new Bundle();
bundle.putString(UrlMenuBottomSheetFragment.EXTRA_URL, url);
urlMenuBottomSheetFragment.setArguments(bundle);
urlMenuBottomSheetFragment.show(activity.getSupportFragmentManager(), urlMenuBottomSheetFragment.getTag());
}
return true;
})))
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS)) .usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
.usePlugin(StrikethroughPlugin.create()) .usePlugin(StrikethroughPlugin.create())
.build(); .build();
@ -541,6 +530,16 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
} }
}); });
commentMarkdownView.setMovementMethod(BetterLinkMovementMethod.linkify(Linkify.WEB_URLS, commentMarkdownView).setOnLinkLongClickListener((textView, url) -> {
if (mActivity != null && !mActivity.isDestroyed() && !mActivity.isFinishing()) {
UrlMenuBottomSheetFragment urlMenuBottomSheetFragment = new UrlMenuBottomSheetFragment();
Bundle bundle = new Bundle();
bundle.putString(UrlMenuBottomSheetFragment.EXTRA_URL, url);
urlMenuBottomSheetFragment.setArguments(bundle);
urlMenuBottomSheetFragment.show(mActivity.getSupportFragmentManager(), urlMenuBottomSheetFragment.getTag());
}
return true;
}));
upvoteButton.setOnClickListener(view -> { upvoteButton.setOnClickListener(view -> {
if (mAccessToken == null) { if (mAccessToken == null) {
Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show(); Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();

View File

@ -307,9 +307,7 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni
if (hasComment) { if (hasComment) {
mFetchCommentInfoLinearLayout.setVisibility(View.GONE); mFetchCommentInfoLinearLayout.setVisibility(View.GONE);
} else { } else {
mFetchCommentInfoLinearLayout.setOnClickListener(view -> { mFetchCommentInfoLinearLayout.setOnClickListener(null);
//Do nothing
});
showErrorView(R.string.no_comments); showErrorView(R.string.no_comments);
} }
}); });

View File

@ -137,6 +137,7 @@ public class SidebarFragment extends Fragment {
} }
}) })
.usePlugin(StrikethroughPlugin.create()) .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, recyclerView).setOnLinkLongClickListener((textView, url) -> {
UrlMenuBottomSheetFragment urlMenuBottomSheetFragment = new UrlMenuBottomSheetFragment(); UrlMenuBottomSheetFragment urlMenuBottomSheetFragment = new UrlMenuBottomSheetFragment();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
@ -145,7 +146,6 @@ public class SidebarFragment extends Fragment {
urlMenuBottomSheetFragment.show(getChildFragmentManager(), urlMenuBottomSheetFragment.getTag()); urlMenuBottomSheetFragment.show(getChildFragmentManager(), urlMenuBottomSheetFragment.getTag());
return true; return true;
}))) })))
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
.usePlugin(TableEntryPlugin.create(activity)) .usePlugin(TableEntryPlugin.create(activity))
.build(); .build();
MarkwonAdapter markwonAdapter = MarkwonAdapter.builder(R.layout.adapter_default_entry, R.id.text) MarkwonAdapter markwonAdapter = MarkwonAdapter.builder(R.layout.adapter_default_entry, R.id.text)