mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 07:53:15 +00:00
バージョンを遡れない不具合を修正
This commit is contained in:
parent
2fcab4e931
commit
0fe0f5dd00
|
@ -14,6 +14,8 @@ import android.widget.Toast;
|
|||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import dagger.hilt.android.AndroidEntryPoint;
|
||||
|
@ -124,26 +126,41 @@ public class ViewerBodyFragment extends Fragment {
|
|||
builder.show();
|
||||
}
|
||||
});
|
||||
|
||||
getActivity().runOnUiThread(() -> {
|
||||
recyclerView.setAdapter(viewerBodyAdapter);
|
||||
viewerBodyAdapter.notifyDataSetChanged();
|
||||
});
|
||||
|
||||
loadDocument(viewerBodyAdapter, documentId, revisionId);
|
||||
}
|
||||
|
||||
private void loadDocument(ViewerBodyAdapter adapter, String documentId, String revisionId) {
|
||||
if (revisionId == null) { // load latest revision
|
||||
document.getDocument(documentId).thenAccept(document -> {
|
||||
document.getDocument(documentId).thenApply(document -> {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
adapter.setPages(document.getPages());
|
||||
adapter.notifyDataSetChanged();
|
||||
});
|
||||
return null;
|
||||
});
|
||||
} else { // load specified revision
|
||||
LacertaVcs vcs = lacertaVcsFactory.create(documentId);
|
||||
document.getDocumentPageListByFileNameList(documentId, vcs.getDocumentPagePathListRev(revisionId).join()).thenAccept(documentPageList -> {
|
||||
// document.getDocumentPageListByFileNameList(documentId, vcs.getDocumentPagePathListRev(revisionId).join()).thenApply(documentPageList -> {
|
||||
// getActivity().runOnUiThread(() -> {
|
||||
// adapter.setPages(documentPageList);
|
||||
// adapter.notifyDataSetChanged();
|
||||
// });
|
||||
// return null;
|
||||
// });
|
||||
|
||||
ArrayList<String> fileNameList = vcs.getDocumentPagePathListRev(revisionId).join();
|
||||
document.getDocumentPageListByFileNameList(documentId, fileNameList).thenApply(documentPageList -> {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
adapter.setPages(documentPageList);
|
||||
adapter.notifyDataSetChanged();
|
||||
});
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,24 +145,13 @@ public class ViewerContainerFragment extends Fragment {
|
|||
|
||||
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());
|
||||
// 暫定: 履歴を遡って表示している場合は結合を無視する(処理自体は単純だけどUI側の対応をする時間がないので)
|
||||
tabLayout.setVisibility(View.GONE);
|
||||
viewerViewPagerAdapter.setFragmentTargetIdList(new ArrayList<String>(){{add(documentId);}}); // TODO-rca: 読みにくいので直接追加できるようにする
|
||||
viewerViewPagerAdapter.setFragmentTitleList(new ArrayList<String>(){{add(documentName);}}); // TODO-rca: 読みにくいので直接追加できるようにする
|
||||
|
||||
viewerViewPagerAdapter.setFragmentRevisionList(new ArrayList<String>(){{add(revId);}}); // TODO-rca: 読みにくいので直接追加できるようにする
|
||||
viewerViewPagerAdapter.notifyItemRangeChanged(0, pageList.size());
|
||||
viewerViewPagerAdapter.notifyItemRangeChanged(0, 1);
|
||||
tabLayout.setVisibility(View.GONE);
|
||||
toolbar.setSubtitle("リビジョン: " + revId);
|
||||
return null;
|
||||
});
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
// Get document page
|
||||
if (this.hasCombined) { // 結合親の場合
|
||||
// バージョンを遡る操作を非表示
|
||||
|
@ -193,6 +182,7 @@ public class ViewerContainerFragment extends Fragment {
|
|||
toolbar.setSubtitle("/" + publicPath.parent().getStringPath());
|
||||
});
|
||||
|
||||
}
|
||||
// Attach tab layout to view pager
|
||||
new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> {
|
||||
View customView = LayoutInflater.from(getContext()).inflate(R.layout.viewer_custom_tab, null);
|
||||
|
|
Loading…
Reference in New Issue
Block a user