From fa985b86bd7ed89f3cda9c72766098b9ddc15983 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 14:40:58 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lacerta/component/viewer/ViewerContainerFragment.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index 9d0740c5..19ab6bd1 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -105,7 +105,6 @@ public class ViewerContainerFragment extends Fragment { // Init tab layout TabLayout tabLayout = view.findViewById(R.id.tab_layout); - new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> tab.setText(viewerViewPagerAdapter.getTabTitle(position))).attach(); // Init toolbar Toolbar toolbar = view.findViewById(R.id.toolbar); @@ -116,16 +115,22 @@ public class ViewerContainerFragment extends Fragment { lacertaLibrary.getCombinedDocumentToxiList(documentId).thenAccept(combinedDocumentToxiList -> { logger.debug("ViewerContainerFragment", "combinedDocumentToxiList: " + combinedDocumentToxiList.size()); for (ToxiDocumentModel toxiDocumentModel : combinedDocumentToxiList) { + logger.debug("ViewerContainerFragment", "titleCache: " + toxiDocumentModel.getTitleCache()); viewerViewPagerAdapter .addFragment(ViewerBodyFragment.newInstance(toxiDocumentModel.getChildDocumentId(), toxiDocumentModel.getTitleCache()), toxiDocumentModel.getTitleCache()); } + viewerViewPagerAdapter.notifyItemRangeChanged(0, combinedDocumentToxiList.size()); }); } else { logger.debug("ViewerContainerFragment", "hasCombined: " + hasCombined); tabLayout.setVisibility(View.GONE); viewerViewPagerAdapter.addFragment(ViewerBodyFragment.newInstance(documentId, documentName), documentName); + viewerViewPagerAdapter.notifyItemRangeChanged(0, 1); } + + // Attach tab layout to view pager + new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> tab.setText(viewerViewPagerAdapter.getTabTitle(position))).attach(); } /**