From 90df8e42bb9f885dbc408bc0c674c2e7e814b0e9 Mon Sep 17 00:00:00 2001 From: TacoTheDank Date: Wed, 23 Dec 2020 17:35:56 -0500 Subject: Correct existing ViewPager2 implementations --- .../infinityforreddit/activities/AccountSavedThingActivity.java | 8 ++++---- .../infinityforreddit/activities/MainActivity.java | 8 ++++---- .../infinityforreddit/activities/SearchResultActivity.java | 8 ++++---- .../infinityforreddit/activities/ViewSubredditDetailActivity.java | 8 ++++---- .../infinityforreddit/activities/ViewUserDetailActivity.java | 8 ++++---- 5 files changed, 20 insertions(+), 20 deletions(-) (limited to 'app') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java index c33104ac..a87c10d0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java @@ -15,8 +15,8 @@ import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; -import androidx.lifecycle.Lifecycle; import androidx.viewpager2.adapter.FragmentStateAdapter; import androidx.viewpager2.widget.ViewPager2; @@ -199,7 +199,7 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT } private void initializeViewPager() { - sectionsPagerAdapter = new SectionsPagerAdapter(fragmentManager, getLifecycle()); + sectionsPagerAdapter = new SectionsPagerAdapter(this); viewPager2.setAdapter(sectionsPagerAdapter); viewPager2.setOffscreenPageLimit(2); viewPager2.setUserInputEnabled(!mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_SWIPING_BETWEEN_TABS, false)); @@ -345,8 +345,8 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT private class SectionsPagerAdapter extends FragmentStateAdapter { - SectionsPagerAdapter(FragmentManager fm, Lifecycle lifecycle) { - super(fm, lifecycle); + SectionsPagerAdapter(FragmentActivity fa) { + super(fa); } @NonNull 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 2d139293..b621b583 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java @@ -30,8 +30,8 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.core.view.GravityCompat; import androidx.drawerlayout.widget.DrawerLayout; import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; -import androidx.lifecycle.Lifecycle; import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -772,7 +772,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb int tabCount = mMainActivityTabsSharedPreferences.getInt((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_COUNT, 3); mShowFavoriteSubscribedSubreddits = mMainActivityTabsSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.MAIN_PAGE_SHOW_FAVORITE_SUBSCRIBED_SUBREDDITS, false); mShowSubscribedSubreddits = mMainActivityTabsSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.MAIN_PAGE_SHOW_SUBSCRIBED_SUBREDDITS, false); - sectionsPagerAdapter = new SectionsPagerAdapter(fragmentManager, getLifecycle(), tabCount, + sectionsPagerAdapter = new SectionsPagerAdapter(this, tabCount, mShowFavoriteSubscribedSubreddits, mShowSubscribedSubreddits); viewPager2.setAdapter(sectionsPagerAdapter); viewPager2.setOffscreenPageLimit(1); @@ -1313,8 +1313,8 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb List favoriteSubscribedSubreddits; List subscribedSubreddits; - SectionsPagerAdapter(FragmentManager fm, Lifecycle lifecycle, int tabCount, boolean showFavoriteSubscribedSubreddits, boolean showSubscribedSubreddits) { - super(fm, lifecycle); + SectionsPagerAdapter(FragmentActivity fa, int tabCount, boolean showFavoriteSubscribedSubreddits, boolean showSubscribedSubreddits) { + super(fa); this.tabCount = tabCount; favoriteSubscribedSubreddits = new ArrayList<>(); subscribedSubreddits = new ArrayList<>(); 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 b605aedb..a3ca8889 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java @@ -16,8 +16,8 @@ import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; -import androidx.lifecycle.Lifecycle; import androidx.viewpager2.adapter.FragmentStateAdapter; import androidx.viewpager2.widget.ViewPager2; @@ -221,7 +221,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect } private void initializeViewPager() { - sectionsPagerAdapter = new SectionsPagerAdapter(fragmentManager, getLifecycle()); + sectionsPagerAdapter = new SectionsPagerAdapter(this); viewPager2.setAdapter(sectionsPagerAdapter); viewPager2.setOffscreenPageLimit(3); viewPager2.setUserInputEnabled(!mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_SWIPING_BETWEEN_TABS, false)); @@ -381,8 +381,8 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect private class SectionsPagerAdapter extends FragmentStateAdapter { - public SectionsPagerAdapter(FragmentManager fm, Lifecycle lifecycle) { - super(fm, lifecycle); + public SectionsPagerAdapter(FragmentActivity fa) { + super(fa); } @NonNull 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 1771b8dc..4852c32d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java @@ -28,8 +28,8 @@ import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; -import androidx.lifecycle.Lifecycle; import androidx.lifecycle.ViewModelProvider; import androidx.viewpager2.adapter.FragmentStateAdapter; import androidx.viewpager2.widget.ViewPager2; @@ -842,7 +842,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp } }).execute(); - sectionsPagerAdapter = new SectionsPagerAdapter(fragmentManager, getLifecycle()); + sectionsPagerAdapter = new SectionsPagerAdapter(this); viewPager2.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { @Override public void onPageSelected(int position) { @@ -1233,8 +1233,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp private class SectionsPagerAdapter extends FragmentStateAdapter { - SectionsPagerAdapter(FragmentManager fm, Lifecycle lifecycle) { - super(fm, lifecycle); + SectionsPagerAdapter(FragmentActivity fa) { + super(fa); } @NonNull 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 3ddf99f5..9c77e0a9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java @@ -31,8 +31,8 @@ import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; -import androidx.lifecycle.Lifecycle; import androidx.lifecycle.ViewModelProvider; import androidx.viewpager2.adapter.FragmentStateAdapter; import androidx.viewpager2.widget.ViewPager2; @@ -604,7 +604,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele } private void initializeViewPager() { - sectionsPagerAdapter = new SectionsPagerAdapter(fragmentManager, getLifecycle()); + sectionsPagerAdapter = new SectionsPagerAdapter(this); viewPager2.setAdapter(sectionsPagerAdapter); viewPager2.setOffscreenPageLimit(2); viewPager2.setUserInputEnabled(!mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_SWIPING_BETWEEN_TABS, false)); @@ -1308,8 +1308,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele private class SectionsPagerAdapter extends FragmentStateAdapter { - SectionsPagerAdapter(FragmentManager fm, Lifecycle lifecycle) { - super(fm, lifecycle); + SectionsPagerAdapter(FragmentActivity fa) { + super(fa); } @NonNull -- cgit v1.2.3