diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerViewPagerAdapter.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerViewPagerAdapter.java index 5de859c6..cdf742b0 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerViewPagerAdapter.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerViewPagerAdapter.java @@ -7,8 +7,20 @@ import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentPagerAdapter; import androidx.viewpager2.adapter.FragmentStateAdapter; +import java.util.ArrayList; + public class ViewerViewPagerAdapter extends FragmentStateAdapter { + // Variables + private ArrayList fragmentArrayList = new ArrayList<>(); + private ArrayList fragmentTitleList = new ArrayList<>(); + + // Setter + public void addFragment(Fragment fragment, String title){ + fragmentArrayList.add(fragment); + fragmentTitleList.add(title); + } + public ViewerViewPagerAdapter(@NonNull FragmentActivity fragmentActivity) { super(fragmentActivity); } @@ -16,11 +28,11 @@ public class ViewerViewPagerAdapter extends FragmentStateAdapter { @NonNull @Override public Fragment createFragment(int position) { - return null; + return fragmentArrayList.get(position); } @Override public int getItemCount() { - return 0; + return fragmentArrayList == null ? 0 : fragmentArrayList.size(); } }