From eb34cfecce0d1ce7af01783b1c0eacb487cc342f Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Sun, 7 Nov 2021 14:43:34 +0800 Subject: Fix clicking tab text does not change page in ViewUserDetailActivity, ViewSubredditDetailActivity or AccoundSavedThingActivity. --- .../activities/ViewSubredditDetailActivity.java | 2 +- .../CommentsListingRecyclerViewAdapter.java | 21 ++++++++++----------- .../fragments/CommentsListingFragment.java | 4 +--- .../fragments/SidebarFragment.java | 2 +- 4 files changed, 13 insertions(+), 16 deletions(-) (limited to 'app/src/main/java/ml/docilealligator/infinityforreddit') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java index 18f16d5d..2f534fb0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java @@ -396,7 +396,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp 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(); Bundle bundle = new Bundle(); bundle.putString(UrlMenuBottomSheetFragment.EXTRA_URL, url); 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 15dce401..78fb5796 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java @@ -43,7 +43,6 @@ import io.noties.markwon.core.MarkwonTheme; import io.noties.markwon.ext.strikethrough.StrikethroughPlugin; import io.noties.markwon.html.HtmlPlugin; import io.noties.markwon.linkify.LinkifyPlugin; -import io.noties.markwon.movement.MovementMethodPlugin; import me.saket.bettermovementmethod.BetterLinkMovementMethod; import ml.docilealligator.infinityforreddit.NetworkState; import ml.docilealligator.infinityforreddit.R; @@ -192,16 +191,6 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter { - 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(StrikethroughPlugin.create()) .build(); @@ -541,6 +530,16 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter { + 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 -> { if (mAccessToken == null) { Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/CommentsListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/CommentsListingFragment.java index 04cabb7a..34c67ecd 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/CommentsListingFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/CommentsListingFragment.java @@ -307,9 +307,7 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni if (hasComment) { mFetchCommentInfoLinearLayout.setVisibility(View.GONE); } else { - mFetchCommentInfoLinearLayout.setOnClickListener(view -> { - //Do nothing - }); + mFetchCommentInfoLinearLayout.setOnClickListener(null); showErrorView(R.string.no_comments); } }); 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 d7a77b07..ef3d6925 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java @@ -137,6 +137,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) -> { UrlMenuBottomSheetFragment urlMenuBottomSheetFragment = new UrlMenuBottomSheetFragment(); Bundle bundle = new Bundle(); @@ -145,7 +146,6 @@ public class SidebarFragment extends Fragment { urlMenuBottomSheetFragment.show(getChildFragmentManager(), urlMenuBottomSheetFragment.getTag()); return true; }))) - .usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS)) .usePlugin(TableEntryPlugin.create(activity)) .build(); MarkwonAdapter markwonAdapter = MarkwonAdapter.builder(R.layout.adapter_default_entry, R.id.text) -- cgit v1.2.3