This commit is contained in:
r-ca 2024-01-28 14:40:58 +09:00
parent 0dafecc75d
commit fa985b86bd
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -105,7 +105,6 @@ public class ViewerContainerFragment extends Fragment {
// Init tab layout // Init tab layout
TabLayout tabLayout = view.findViewById(R.id.tab_layout); TabLayout tabLayout = view.findViewById(R.id.tab_layout);
new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> tab.setText(viewerViewPagerAdapter.getTabTitle(position))).attach();
// Init toolbar // Init toolbar
Toolbar toolbar = view.findViewById(R.id.toolbar); Toolbar toolbar = view.findViewById(R.id.toolbar);
@ -116,16 +115,22 @@ public class ViewerContainerFragment extends Fragment {
lacertaLibrary.getCombinedDocumentToxiList(documentId).thenAccept(combinedDocumentToxiList -> { lacertaLibrary.getCombinedDocumentToxiList(documentId).thenAccept(combinedDocumentToxiList -> {
logger.debug("ViewerContainerFragment", "combinedDocumentToxiList: " + combinedDocumentToxiList.size()); logger.debug("ViewerContainerFragment", "combinedDocumentToxiList: " + combinedDocumentToxiList.size());
for (ToxiDocumentModel toxiDocumentModel : combinedDocumentToxiList) { for (ToxiDocumentModel toxiDocumentModel : combinedDocumentToxiList) {
logger.debug("ViewerContainerFragment", "titleCache: " + toxiDocumentModel.getTitleCache());
viewerViewPagerAdapter viewerViewPagerAdapter
.addFragment(ViewerBodyFragment.newInstance(toxiDocumentModel.getChildDocumentId(), toxiDocumentModel.getTitleCache()), .addFragment(ViewerBodyFragment.newInstance(toxiDocumentModel.getChildDocumentId(), toxiDocumentModel.getTitleCache()),
toxiDocumentModel.getTitleCache()); toxiDocumentModel.getTitleCache());
} }
viewerViewPagerAdapter.notifyItemRangeChanged(0, combinedDocumentToxiList.size());
}); });
} else { } else {
logger.debug("ViewerContainerFragment", "hasCombined: " + hasCombined); logger.debug("ViewerContainerFragment", "hasCombined: " + hasCombined);
tabLayout.setVisibility(View.GONE); tabLayout.setVisibility(View.GONE);
viewerViewPagerAdapter.addFragment(ViewerBodyFragment.newInstance(documentId, documentName), documentName); 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();
} }
/** /**