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

View File

@ -34,15 +34,17 @@ public class ViewerVcsRevListFragment extends Fragment {
LacertaVcs lacertaVcs;
private String documentId;
private String documentName;
public ViewerVcsRevListFragment() {
// Required empty public constructor
}
public static ViewerVcsRevListFragment newInstance(String documentId) {
public static ViewerVcsRevListFragment newInstance(String documentId, String documentName) {
ViewerVcsRevListFragment fragment = new ViewerVcsRevListFragment();
Bundle args = new Bundle();
args.putString("documentId", documentId);
args.putString("documentName", documentName);
fragment.setArguments(args);
return fragment;
}
@ -66,17 +68,22 @@ public class ViewerVcsRevListFragment extends Fragment {
// Init arg
if (getArguments() != null) {
this.documentId = getArguments().getString("documentId");
logger.debug("ViewerVcsRevListFragment", "documentId: " + documentId);
logger.debug("ViewerVcsRevListFragment", "documentId: " + this.documentId);
}
// Init vcs
lacertaVcs = lacertaVcsFactory.create(documentId);
lacertaVcs = lacertaVcsFactory.create(this.documentId);
// Init view
RecyclerView recyclerView = view.findViewById(R.id.rev_list);
// 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
recyclerView.setAdapter(revAdapter);