From dc248735c707fe85ceb01899ff7bc73e3196ff08 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Wed, 11 Aug 2021 23:12:37 +0800 Subject: Try fixing ViewPager2's IllegalStateException. --- app/src/main/java/ml/docilealligator/infinityforreddit/Infinity.java | 2 +- .../docilealligator/infinityforreddit/activities/InboxActivity.java | 2 +- .../infinityforreddit/activities/SubscribedThingListingActivity.java | 2 +- .../infinityforreddit/adapters/CommentsRecyclerViewAdapter.java | 4 ++++ .../infinityforreddit/adapters/PostRecyclerViewAdapter.java | 2 ++ .../adapters/PrivateMessagesDetailRecyclerViewAdapter.java | 1 + app/src/main/res/layout/item_comment.xml | 1 + 7 files changed, 11 insertions(+), 3 deletions(-) (limited to 'app/src') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Infinity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Infinity.java index fafedeac..1c7c7649 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Infinity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Infinity.java @@ -33,7 +33,7 @@ import ml.docilealligator.infinityforreddit.utils.Utils; public class Infinity extends Application implements LifecycleObserver { private AppComponent mAppComponent; private NetworkWifiStatusReceiver mNetworkWifiStatusReceiver; - private boolean lock = false; + //private boolean lock = false; private boolean isSecureMode; @Inject @Named("default") diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java index 979b96ac..2437103f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java @@ -291,7 +291,7 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf } }).attach(); if (savedInstanceState == null && getIntent().getBooleanExtra(EXTRA_VIEW_MESSAGE, false)) { - viewPager2.setCurrentItem(1); + viewPager2.setCurrentItem(1, false); } fixViewPager2Sensitivity(viewPager2); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java index e5b2e225..7309c15f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java @@ -211,7 +211,7 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti tabLayout.setupWithViewPager(viewPager); if (showMultiReddits) { - viewPager.setCurrentItem(2); + viewPager.setCurrentItem(2, false); } loadSubscriptions(false); 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 d0b3cc82..0ca87693 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java @@ -1085,6 +1085,8 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter