mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
Adapterの変更に追従, StreamAPIに変更
This commit is contained in:
parent
fcdb7c838b
commit
da78f5eef1
|
@ -20,6 +20,7 @@ import com.google.android.material.textfield.TextInputEditText;
|
||||||
import com.google.android.material.textfield.TextInputLayout;
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
@ -120,18 +121,19 @@ public class ViewerContainerFragment extends Fragment {
|
||||||
logger.debug("ViewerContainerFragment", "hasCombined: " + hasCombined);
|
logger.debug("ViewerContainerFragment", "hasCombined: " + hasCombined);
|
||||||
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) {
|
ArrayList<String> pageIdList = combinedDocumentToxiList.stream().map(ToxiDocumentModel::getChildDocumentId).collect(Collectors.toCollection(ArrayList::new));
|
||||||
logger.debug("ViewerContainerFragment", "titleCache: " + toxiDocumentModel.getTitleCache());
|
ArrayList<String> pageTitleList = combinedDocumentToxiList.stream().map(ToxiDocumentModel::getTitleCache).collect(Collectors.toCollection(ArrayList::new));
|
||||||
viewerViewPagerAdapter
|
viewerViewPagerAdapter.setFragmentTargetIdList(pageIdList);
|
||||||
.addFragment(ViewerBodyFragment.newInstance(toxiDocumentModel.getChildDocumentId(), toxiDocumentModel.getTitleCache()),
|
viewerViewPagerAdapter.setFragmentTitleList(pageTitleList);
|
||||||
toxiDocumentModel.getTitleCache());
|
|
||||||
}
|
|
||||||
viewerViewPagerAdapter.notifyItemRangeChanged(0, combinedDocumentToxiList.size());
|
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);
|
ArrayList<String> pageIdList = new ArrayList<>();
|
||||||
|
ArrayList<String> pageTitleList = new ArrayList<>();
|
||||||
|
pageIdList.add(documentId);
|
||||||
|
pageTitleList.add(documentName);
|
||||||
viewerViewPagerAdapter.notifyItemRangeChanged(0, 1);
|
viewerViewPagerAdapter.notifyItemRangeChanged(0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +146,7 @@ public class ViewerContainerFragment extends Fragment {
|
||||||
|
|
||||||
ImageButton imageButton = customView.findViewById(R.id.tab_modify);
|
ImageButton imageButton = customView.findViewById(R.id.tab_modify);
|
||||||
imageButton.setOnClickListener(v -> {
|
imageButton.setOnClickListener(v -> {
|
||||||
Toast.makeText(getContext(), "Working!, Index:" + position, Toast.LENGTH_SHORT).show();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
tab.setCustomView(customView);
|
tab.setCustomView(customView);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user