From f1d947e15929bba49f0a96cdeaa9619b6e18fc9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Mon, 29 Jan 2024 11:07:00 +0900 Subject: [PATCH] =?UTF-8?q?=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../viewer/ViewerContainerFragment.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) 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 8d646e4c..4b95caaa 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 @@ -37,6 +37,8 @@ import one.nem.lacerta.model.document.page.Page; import one.nem.lacerta.model.document.tag.DocumentTag; import one.nem.lacerta.model.pref.ToxiDocumentModel; import one.nem.lacerta.utils.LacertaLogger; +import one.nem.lacerta.vcs.LacertaVcs; +import one.nem.lacerta.vcs.factory.LacertaVcsFactory; /** * A simple {@link Fragment} subclass. @@ -57,6 +59,9 @@ public class ViewerContainerFragment extends Fragment { @Inject Document document; + @Inject + LacertaVcsFactory lacertaVcsFactory; + // Variables private String documentId; private String documentName; @@ -137,6 +142,26 @@ public class ViewerContainerFragment extends Fragment { Toolbar toolbar = view.findViewById(R.id.toolbar); initToolbar(toolbar, true, documentName); + if (this.revId != null) { // Revが指定されている場合 + LacertaVcs lacertaVcs = lacertaVcsFactory.create(documentId); + lacertaVcs.getDocumentPagePathListRev(this.revId).thenApply(pagePathList -> { + logger.debug("ViewerContainerFragment", "pagePathList: " + pagePathList.size()); + document.getDocumentPageListByFileNameList(this.documentId, pagePathList).thenApply(pageList -> { + logger.debug("ViewerContainerFragment", "pageList: " + pageList.size()); + // 暫定: 履歴を遡って表示している場合は結合を無視する + this.hasCombined = false; + + viewerViewPagerAdapter.setFragmentTargetIdList(new ArrayList(){{add(documentId);}}); // TODO-rca: 読みにくいので直接追加できるようにする + viewerViewPagerAdapter.setFragmentTitleList(new ArrayList(){{add(documentName);}}); // TODO-rca: 読みにくいので直接追加できるようにする + + viewerViewPagerAdapter.setFragmentRevisionList(new ArrayList(){{add(revId);}}); // TODO-rca: 読みにくいので直接追加できるようにする + viewerViewPagerAdapter.notifyItemRangeChanged(0, pageList.size()); + return null; + }); + return null; + }); + } + // Get document page if (this.hasCombined) { // 結合親の場合 logger.debug("ViewerContainerFragment", "hasCombined: " + hasCombined);