mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
ドキュメント名を表示するように
This commit is contained in:
parent
8e2af0c963
commit
872bbd0f4e
|
@ -23,6 +23,7 @@ import dagger.hilt.android.AndroidEntryPoint;
|
|||
import one.nem.lacerta.data.Document;
|
||||
import one.nem.lacerta.model.document.DocumentDetail;
|
||||
import one.nem.lacerta.model.document.page.Page;
|
||||
import one.nem.lacerta.utils.FeatureSwitch;
|
||||
import one.nem.lacerta.utils.LacertaLogger;
|
||||
|
||||
/**
|
||||
|
@ -42,15 +43,17 @@ public class ComponentViewerTopFragment extends Fragment {
|
|||
private static final String TAG = "ComponentViewerTopFragment";
|
||||
|
||||
private String documentId;
|
||||
private String documentName;
|
||||
|
||||
public ComponentViewerTopFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
public static ComponentViewerTopFragment newInstance(String documentId) {
|
||||
public static ComponentViewerTopFragment newInstance(String documentId, String documentName) {
|
||||
ComponentViewerTopFragment fragment = new ComponentViewerTopFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("documentId", documentId);
|
||||
args.putString("documentName", documentName);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
@ -60,6 +63,7 @@ public class ComponentViewerTopFragment extends Fragment {
|
|||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
documentId = getArguments().getString("documentId");
|
||||
String documentName = getArguments().getString("documentName");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,7 +75,7 @@ public class ComponentViewerTopFragment extends Fragment {
|
|||
|
||||
// Toolbar
|
||||
Toolbar toolbar = view.findViewById(R.id.toolbar);
|
||||
toolbarSetup(toolbar, true, "Revision List");
|
||||
toolbarSetup(toolbar, true, this.documentName == null ? "Document" : this.documentName);
|
||||
|
||||
RecyclerView recyclerView = view.findViewById(R.id.body_recycler_view);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
@ -80,12 +84,14 @@ public class ComponentViewerTopFragment extends Fragment {
|
|||
});
|
||||
recyclerView.setAdapter(viewerBodyAdapter);
|
||||
|
||||
if (FeatureSwitch.Viewer.showProgressBarWhenLoading) view.findViewById(R.id.loading_progress_bar).setVisibility(View.VISIBLE);
|
||||
document.getDocument(documentId).thenAccept(documentDetail -> {
|
||||
ArrayList<Page> pages = documentDetail.getPages();
|
||||
logger.debug(TAG, "pages.size(): " + pages.size());
|
||||
viewerBodyAdapter.setPages(pages);
|
||||
getActivity().runOnUiThread(() -> {
|
||||
viewerBodyAdapter.notifyItemRangeChanged(0, pages.size());
|
||||
if (FeatureSwitch.Viewer.showProgressBarWhenLoading) view.findViewById(R.id.loading_progress_bar).setVisibility(View.GONE);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -104,9 +110,8 @@ public class ComponentViewerTopFragment extends Fragment {
|
|||
if (showBackButton) {
|
||||
toolbar.setNavigationIcon(one.nem.lacerta.shared.ui.R.drawable.arrow_back_24px);
|
||||
toolbar.setNavigationOnClickListener(v -> {
|
||||
//this.libraryItemPage = lacertaLibrary.getLibraryPage(this.libraryItemPage.getParentId(), 10).join();
|
||||
// Back
|
||||
Navigation.findNavController(requireView()).popBackStack();
|
||||
// Stop Activity
|
||||
getActivity().finish();
|
||||
});
|
||||
} else {
|
||||
toolbar.setNavigationIcon(null);
|
||||
|
|
Loading…
Reference in New Issue
Block a user