This commit is contained in:
r-ca 2024-01-24 17:43:10 +09:00
parent 5639117e0e
commit 615d58f3ca
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9
2 changed files with 13 additions and 6 deletions

View File

@ -98,7 +98,7 @@ public class ViewerListFragment extends Fragment {
}); });
recyclerView.setAdapter(viewerBodyAdapter); recyclerView.setAdapter(viewerBodyAdapter);
if (revisionId.isEmpty()) { if (revisionId == null) {
logger.debug(TAG, "revisionId is empty, loading latest revision"); logger.debug(TAG, "revisionId is empty, loading latest revision");
if (FeatureSwitch.Viewer.showProgressBarWhenLoading) view.findViewById(R.id.loading_progress_bar).setVisibility(View.VISIBLE); if (FeatureSwitch.Viewer.showProgressBarWhenLoading) view.findViewById(R.id.loading_progress_bar).setVisibility(View.VISIBLE);
document.getDocument(documentId).thenAccept(documentDetail -> { document.getDocument(documentId).thenAccept(documentDetail -> {
@ -154,7 +154,7 @@ public class ViewerListFragment extends Fragment {
if (item.getItemId() == R.id.action_open_vcs_rev_list) { if (item.getItemId() == R.id.action_open_vcs_rev_list) {
// Open vcs rev list // Open vcs rev list
getParentFragmentManager().beginTransaction() getParentFragmentManager().beginTransaction()
.replace(R.id.nav_host_fragment, ViewerVcsRevListFragment.newInstance(documentId)) .replace(R.id.nav_host_fragment, ViewerVcsRevListFragment.newInstance(documentId, documentName))
.commit(); .commit();
return true; return true;
} else if (item.getItemId() == R.id.action_rename) { } else if (item.getItemId() == R.id.action_rename) {

View File

@ -34,15 +34,17 @@ public class ViewerVcsRevListFragment extends Fragment {
LacertaVcs lacertaVcs; LacertaVcs lacertaVcs;
private String documentId; private String documentId;
private String documentName;
public ViewerVcsRevListFragment() { public ViewerVcsRevListFragment() {
// Required empty public constructor // Required empty public constructor
} }
public static ViewerVcsRevListFragment newInstance(String documentId) { public static ViewerVcsRevListFragment newInstance(String documentId, String documentName) {
ViewerVcsRevListFragment fragment = new ViewerVcsRevListFragment(); ViewerVcsRevListFragment fragment = new ViewerVcsRevListFragment();
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putString("documentId", documentId); args.putString("documentId", documentId);
args.putString("documentName", documentName);
fragment.setArguments(args); fragment.setArguments(args);
return fragment; return fragment;
} }
@ -66,17 +68,22 @@ public class ViewerVcsRevListFragment extends Fragment {
// Init arg // Init arg
if (getArguments() != null) { if (getArguments() != null) {
this.documentId = getArguments().getString("documentId"); this.documentId = getArguments().getString("documentId");
logger.debug("ViewerVcsRevListFragment", "documentId: " + documentId); logger.debug("ViewerVcsRevListFragment", "documentId: " + this.documentId);
} }
// Init vcs // Init vcs
lacertaVcs = lacertaVcsFactory.create(documentId); lacertaVcs = lacertaVcsFactory.create(this.documentId);
// Init view // Init view
RecyclerView recyclerView = view.findViewById(R.id.rev_list); RecyclerView recyclerView = view.findViewById(R.id.rev_list);
// Init adapter // Init adapter
RevAdapter revAdapter = new RevAdapter(); RevAdapter revAdapter = new RevAdapter(revisionId -> {
logger.debug("ViewerVcsRevListFragment", "Selected revisionId: " + revisionId);
getParentFragmentManager().beginTransaction()
.replace(R.id.nav_host_fragment, ViewerListFragment.newInstance(this.documentId, this.documentName, revisionId))
.commit();
});
// Set adapter // Set adapter
recyclerView.setAdapter(revAdapter); recyclerView.setAdapter(revAdapter);