mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 03:07:26 +01:00
Correct existing ViewPager2 implementations
This commit is contained in:
parent
94202097b7
commit
90df8e42bb
@ -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
|
||||
|
@ -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<SubscribedSubredditData> favoriteSubscribedSubreddits;
|
||||
List<SubscribedSubredditData> 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<>();
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user