mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
FragmentではなくTargetIdを持つように変更
This commit is contained in:
parent
c849fdae2e
commit
9084613e38
|
@ -13,13 +13,13 @@ import java.util.ArrayList;
|
||||||
public class ViewerViewPagerAdapter extends FragmentStateAdapter {
|
public class ViewerViewPagerAdapter extends FragmentStateAdapter {
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
private ArrayList<Fragment> fragmentArrayList = new ArrayList<>();
|
private ArrayList<String> fragmentTargetIdList = new ArrayList<>();
|
||||||
private ArrayList<String> fragmentTitleList = new ArrayList<>();
|
private ArrayList<String> fragmentTitleList = new ArrayList<>();
|
||||||
|
|
||||||
// Setter
|
// Setter
|
||||||
public void addFragment(Fragment fragment, String title){
|
|
||||||
fragmentArrayList.add(fragment);
|
public void setFragmentTargetIdList(ArrayList<String> fragmentTargetIdList) {
|
||||||
fragmentTitleList.add(title);
|
this.fragmentTargetIdList = fragmentTargetIdList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ViewerViewPagerAdapter(@NonNull FragmentActivity fragmentActivity) {
|
public ViewerViewPagerAdapter(@NonNull FragmentActivity fragmentActivity) {
|
||||||
|
@ -29,12 +29,12 @@ public class ViewerViewPagerAdapter extends FragmentStateAdapter {
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Fragment createFragment(int position) {
|
public Fragment createFragment(int position) {
|
||||||
return fragmentArrayList.get(position);
|
return ViewerListFragment.newInstance(fragmentTargetIdList.get(position), fragmentTitleList.get(position));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return fragmentArrayList == null ? 0 : fragmentArrayList.size();
|
return fragmentTargetIdList == null ? 0 : fragmentTargetIdList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
Loading…
Reference in New Issue
Block a user