diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-08-18 19:33:37 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-08-18 19:33:37 +0000 |
commit | bc243c3d06c560e686654fe883d36de32f3ed372 (patch) | |
tree | 219d43acfd9f1dce331503225ec5fa2f73b8bca4 | |
parent | 9e74c39106a7b9d8c61b3d89c3a7183ae3acf06f (diff) | |
download | infinity-for-reddit-bc243c3d06c560e686654fe883d36de32f3ed372.tar infinity-for-reddit-bc243c3d06c560e686654fe883d36de32f3ed372.tar.gz infinity-for-reddit-bc243c3d06c560e686654fe883d36de32f3ed372.tar.bz2 infinity-for-reddit-bc243c3d06c560e686654fe883d36de32f3ed372.tar.lz infinity-for-reddit-bc243c3d06c560e686654fe883d36de32f3ed372.tar.xz infinity-for-reddit-bc243c3d06c560e686654fe883d36de32f3ed372.tar.zst infinity-for-reddit-bc243c3d06c560e686654fe883d36de32f3ed372.zip |
Some changes related to SectionsPagerAdapter.
11 files changed, 14 insertions, 14 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/HistoryActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/HistoryActivity.java index 67cb0482..a9b141bb 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/HistoryActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/HistoryActivity.java @@ -137,7 +137,6 @@ public class HistoryActivity extends BaseActivity implements ActivityToolbarInte sectionsPagerAdapter = new SectionsPagerAdapter(this); binding.tabLayoutTabLayoutHistoryActivityActivity.setVisibility(View.GONE); binding.viewPagerHistoryActivity.setAdapter(sectionsPagerAdapter); - binding.viewPagerHistoryActivity.setOffscreenPageLimit(2); //viewPager2.setUserInputEnabled(!mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_SWIPING_BETWEEN_TABS, false)); binding.viewPagerHistoryActivity.setUserInputEnabled(false); /*new TabLayoutMediator(tabLayout, viewPager2, (tab, position) -> { 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 fa6c28b5..fd937ab2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java @@ -140,6 +140,9 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf } else { mNewAccountName = getIntent().getStringExtra(EXTRA_NEW_ACCOUNT_NAME); } + + sectionsPagerAdapter = new SectionsPagerAdapter(this); + getCurrentAccountAndFetchMessage(savedInstanceState); binding.viewPagerInboxActivity.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { @@ -237,7 +240,6 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf } private void bindView(Bundle savedInstanceState) { - sectionsPagerAdapter = new SectionsPagerAdapter(this); binding.viewPagerInboxActivity.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { @Override public void onPageSelected(int position) { @@ -249,7 +251,6 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf } }); binding.viewPagerInboxActivity.setAdapter(sectionsPagerAdapter); - binding.viewPagerInboxActivity.setOffscreenPageLimit(ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT); new TabLayoutMediator(binding.tabLayoutInboxActivity, binding.viewPagerInboxActivity, (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 90694bed..4500b4e5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java @@ -859,7 +859,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb sectionsPagerAdapter = new SectionsPagerAdapter(this, tabCount, mShowFavoriteMultiReddits, mShowMultiReddits, mShowFavoriteSubscribedSubreddits, mShowSubscribedSubreddits); binding.includedAppBar.viewPagerMainActivity.setAdapter(sectionsPagerAdapter); - binding.includedAppBar.viewPagerMainActivity.setOffscreenPageLimit(ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT); binding.includedAppBar.viewPagerMainActivity.setUserInputEnabled(!mDisableSwipingBetweenTabs); if (mMainActivityTabsSharedPreferences.getBoolean((accountName.equals(Account.ANONYMOUS_ACCOUNT) ? "" : accountName) + 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 b0f78fff..6e2d9024 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java @@ -227,7 +227,6 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect private void bindView(Bundle savedInstanceState) { sectionsPagerAdapter = new SectionsPagerAdapter(this); binding.viewPagerSearchResultActivity.setAdapter(sectionsPagerAdapter); - binding.viewPagerSearchResultActivity.setOffscreenPageLimit(ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT); binding.viewPagerSearchResultActivity.setUserInputEnabled(!mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_SWIPING_BETWEEN_TABS, false)); binding.viewPagerSearchResultActivity.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java index 73df4d13..e0ee0210 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java @@ -280,6 +280,9 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele binding.fabViewPostDetailActivity.setCoordinates(); } }); + + sectionsPagerAdapter = new SectionsPagerAdapter(this); + checkNewAccountAndBindView(savedInstanceState); } @@ -361,7 +364,6 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele } private void bindView(Bundle savedInstanceState) { - sectionsPagerAdapter = new SectionsPagerAdapter(this); binding.viewPager2ViewPostDetailActivity.setAdapter(sectionsPagerAdapter); if (savedInstanceState == null) { binding.viewPager2ViewPostDetailActivity.setCurrentItem(getIntent().getIntExtra(EXTRA_POST_LIST_POSITION, 0), false); 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 002e775d..939a0fba 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java @@ -317,6 +317,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp } } + sectionsPagerAdapter = new SectionsPagerAdapter(this); + checkNewAccountAndBindView(); fetchSubredditData(); @@ -1023,7 +1025,6 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp } }); - sectionsPagerAdapter = new SectionsPagerAdapter(this); binding.viewPagerViewSubredditDetailActivity.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { @Override public void onPageSelected(int position) { @@ -1043,7 +1044,6 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp } }); binding.viewPagerViewSubredditDetailActivity.setAdapter(sectionsPagerAdapter); - binding.viewPagerViewSubredditDetailActivity.setOffscreenPageLimit(ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT); binding.viewPagerViewSubredditDetailActivity.setUserInputEnabled(!mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_SWIPING_BETWEEN_TABS, false)); new TabLayoutMediator(binding.tabLayoutViewSubredditDetailActivity, binding.viewPagerViewSubredditDetailActivity, (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 cc179b2a..18ed5b5e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java @@ -238,6 +238,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele mNewAccountName = savedInstanceState.getString(NEW_ACCOUNT_NAME_STATE); } + sectionsPagerAdapter = new SectionsPagerAdapter(this); + checkNewAccountAndInitializeViewPager(); fetchUserInfo(); @@ -629,9 +631,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele } private void initializeViewPager() { - sectionsPagerAdapter = new SectionsPagerAdapter(this); binding.viewPagerViewUserDetailActivity.setAdapter(sectionsPagerAdapter); - binding.viewPagerViewUserDetailActivity.setOffscreenPageLimit(ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT); binding.viewPagerViewUserDetailActivity.setUserInputEnabled(!mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_SWIPING_BETWEEN_TABS, false)); new TabLayoutMediator(binding.tabLayoutViewUserDetailActivity, binding.viewPagerViewUserDetailActivity, (tab, position) -> { switch (position) { 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 fceba752..44ca9537 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/CommentsListingFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/CommentsListingFragment.java @@ -326,8 +326,8 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni @Override public void onDestroy() { - super.onDestroy(); EventBus.getDefault().unregister(this); + super.onDestroy(); } public void changeSortType(SortType sortType) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/InboxFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/InboxFragment.java index bf3cfbc3..db4076cc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/InboxFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/InboxFragment.java @@ -215,8 +215,8 @@ public class InboxFragment extends Fragment implements FragmentCommunicator { @Override public void onDestroy() { - super.onDestroy(); EventBus.getDefault().unregister(this); + super.onDestroy(); } @Override 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 96628942..86d9375e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java @@ -233,8 +233,8 @@ public class SidebarFragment extends Fragment { @Override public void onDestroy() { - super.onDestroy(); EventBus.getDefault().unregister(this); + super.onDestroy(); } public void fetchSubredditData() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java index 52042a64..cdcfdf95 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java @@ -1196,8 +1196,8 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic @Override public void onDestroyView() { - super.onDestroyView(); Bridge.clear(this); + super.onDestroyView(); } @Override |