From 1c518740521bbb2ebf5ca0a0466cb7f704d960d3 Mon Sep 17 00:00:00 2001 From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> Date: Wed, 4 Oct 2023 17:01:21 -0400 Subject: Set off screen page limit to ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT in some activities. --- .../ml/docilealligator/infinityforreddit/activities/InboxActivity.java | 3 +-- .../ml/docilealligator/infinityforreddit/activities/MainActivity.java | 2 +- .../infinityforreddit/activities/SearchResultActivity.java | 2 +- .../infinityforreddit/activities/ViewSubredditDetailActivity.java | 2 +- .../infinityforreddit/activities/ViewUserDetailActivity.java | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) (limited to 'app/src') 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 15107cc3..38ecb45e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java @@ -50,7 +50,6 @@ import ml.docilealligator.infinityforreddit.apis.RedditAPI; import ml.docilealligator.infinityforreddit.asynctasks.SwitchAccount; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; -import ml.docilealligator.infinityforreddit.customviews.slidr.widget.SliderPanel; import ml.docilealligator.infinityforreddit.events.ChangeInboxCountEvent; import ml.docilealligator.infinityforreddit.events.PassPrivateMessageEvent; import ml.docilealligator.infinityforreddit.events.PassPrivateMessageIndexEvent; @@ -267,7 +266,7 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf } }); viewPager2.setAdapter(sectionsPagerAdapter); - viewPager2.setOffscreenPageLimit(2); + viewPager2.setOffscreenPageLimit(ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT); new TabLayoutMediator(tabLayout, viewPager2, (tab, position) -> { switch (position) { case 0: diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java index c08dbb68..870eb985 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java @@ -890,7 +890,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb sectionsPagerAdapter = new SectionsPagerAdapter(this, tabCount, mShowFavoriteMultiReddits, mShowMultiReddits, mShowFavoriteSubscribedSubreddits, mShowSubscribedSubreddits); viewPager2.setAdapter(sectionsPagerAdapter); - viewPager2.setOffscreenPageLimit(1); + viewPager2.setOffscreenPageLimit(ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT); viewPager2.setUserInputEnabled(!mDisableSwipingBetweenTabs); if (mMainActivityTabsSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.MAIN_PAGE_SHOW_TAB_NAMES, true)) { if (mShowFavoriteMultiReddits || mShowMultiReddits || mShowFavoriteSubscribedSubreddits || mShowSubscribedSubreddits) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java index ac70a198..dc3da1d5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java @@ -241,7 +241,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect private void bindView(Bundle savedInstanceState) { sectionsPagerAdapter = new SectionsPagerAdapter(this); viewPager2.setAdapter(sectionsPagerAdapter); - viewPager2.setOffscreenPageLimit(3); + viewPager2.setOffscreenPageLimit(ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT); viewPager2.setUserInputEnabled(!mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_SWIPING_BETWEEN_TABS, false)); viewPager2.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { @Override 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 367edb37..164817bc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java @@ -1096,7 +1096,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp } }); viewPager2.setAdapter(sectionsPagerAdapter); - viewPager2.setOffscreenPageLimit(2); + viewPager2.setOffscreenPageLimit(ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT); viewPager2.setUserInputEnabled(!mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_SWIPING_BETWEEN_TABS, false)); new TabLayoutMediator(tabLayout, viewPager2, (tab, position) -> { switch (position) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java index a9a2068c..66ea8eb9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java @@ -665,7 +665,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele private void initializeViewPager() { sectionsPagerAdapter = new SectionsPagerAdapter(this); viewPager2.setAdapter(sectionsPagerAdapter); - viewPager2.setOffscreenPageLimit(2); + viewPager2.setOffscreenPageLimit(ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT); viewPager2.setUserInputEnabled(!mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_SWIPING_BETWEEN_TABS, false)); new TabLayoutMediator(tabLayout, viewPager2, (tab, position) -> { switch (position) { -- cgit v1.2.3