From 9084613e387cf660e06d48f6cbcfdd609c7890a0 Mon Sep 17 00:00:00 2001 From: r-ca Date: Mon, 29 Jan 2024 01:55:06 +0900 Subject: [PATCH] =?UTF-8?q?Fragment=E3=81=A7=E3=81=AF=E3=81=AA=E3=81=8FTar?= =?UTF-8?q?getId=E3=82=92=E6=8C=81=E3=81=A4=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/viewer/ViewerViewPagerAdapter.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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 e3f998fe..3c91cde5 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 @@ -13,13 +13,13 @@ import java.util.ArrayList; public class ViewerViewPagerAdapter extends FragmentStateAdapter { // Variables - private ArrayList fragmentArrayList = new ArrayList<>(); + private ArrayList fragmentTargetIdList = new ArrayList<>(); private ArrayList fragmentTitleList = new ArrayList<>(); // Setter - public void addFragment(Fragment fragment, String title){ - fragmentArrayList.add(fragment); - fragmentTitleList.add(title); + + public void setFragmentTargetIdList(ArrayList fragmentTargetIdList) { + this.fragmentTargetIdList = fragmentTargetIdList; } public ViewerViewPagerAdapter(@NonNull FragmentActivity fragmentActivity) { @@ -29,12 +29,12 @@ public class ViewerViewPagerAdapter extends FragmentStateAdapter { @NonNull @Override public Fragment createFragment(int position) { - return fragmentArrayList.get(position); + return ViewerListFragment.newInstance(fragmentTargetIdList.get(position), fragmentTitleList.get(position)); } @Override public int getItemCount() { - return fragmentArrayList == null ? 0 : fragmentArrayList.size(); + return fragmentTargetIdList == null ? 0 : fragmentTargetIdList.size(); } @Nullable