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.data.Document;
|
||||||
import one.nem.lacerta.model.document.DocumentDetail;
|
import one.nem.lacerta.model.document.DocumentDetail;
|
||||||
import one.nem.lacerta.model.document.page.Page;
|
import one.nem.lacerta.model.document.page.Page;
|
||||||
|
import one.nem.lacerta.utils.FeatureSwitch;
|
||||||
import one.nem.lacerta.utils.LacertaLogger;
|
import one.nem.lacerta.utils.LacertaLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,15 +43,17 @@ public class ComponentViewerTopFragment extends Fragment {
|
||||||
private static final String TAG = "ComponentViewerTopFragment";
|
private static final String TAG = "ComponentViewerTopFragment";
|
||||||
|
|
||||||
private String documentId;
|
private String documentId;
|
||||||
|
private String documentName;
|
||||||
|
|
||||||
public ComponentViewerTopFragment() {
|
public ComponentViewerTopFragment() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ComponentViewerTopFragment newInstance(String documentId) {
|
public static ComponentViewerTopFragment newInstance(String documentId, String documentName) {
|
||||||
ComponentViewerTopFragment fragment = new ComponentViewerTopFragment();
|
ComponentViewerTopFragment fragment = new ComponentViewerTopFragment();
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
@ -60,6 +63,7 @@ public class ComponentViewerTopFragment extends Fragment {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
if (getArguments() != null) {
|
if (getArguments() != null) {
|
||||||
documentId = getArguments().getString("documentId");
|
documentId = getArguments().getString("documentId");
|
||||||
|
String documentName = getArguments().getString("documentName");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +75,7 @@ public class ComponentViewerTopFragment extends Fragment {
|
||||||
|
|
||||||
// Toolbar
|
// Toolbar
|
||||||
Toolbar toolbar = view.findViewById(R.id.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 recyclerView = view.findViewById(R.id.body_recycler_view);
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
|
@ -80,12 +84,14 @@ public class ComponentViewerTopFragment extends Fragment {
|
||||||
});
|
});
|
||||||
recyclerView.setAdapter(viewerBodyAdapter);
|
recyclerView.setAdapter(viewerBodyAdapter);
|
||||||
|
|
||||||
|
if (FeatureSwitch.Viewer.showProgressBarWhenLoading) view.findViewById(R.id.loading_progress_bar).setVisibility(View.VISIBLE);
|
||||||
document.getDocument(documentId).thenAccept(documentDetail -> {
|
document.getDocument(documentId).thenAccept(documentDetail -> {
|
||||||
ArrayList<Page> pages = documentDetail.getPages();
|
ArrayList<Page> pages = documentDetail.getPages();
|
||||||
logger.debug(TAG, "pages.size(): " + pages.size());
|
logger.debug(TAG, "pages.size(): " + pages.size());
|
||||||
viewerBodyAdapter.setPages(pages);
|
viewerBodyAdapter.setPages(pages);
|
||||||
getActivity().runOnUiThread(() -> {
|
getActivity().runOnUiThread(() -> {
|
||||||
viewerBodyAdapter.notifyItemRangeChanged(0, pages.size());
|
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) {
|
if (showBackButton) {
|
||||||
toolbar.setNavigationIcon(one.nem.lacerta.shared.ui.R.drawable.arrow_back_24px);
|
toolbar.setNavigationIcon(one.nem.lacerta.shared.ui.R.drawable.arrow_back_24px);
|
||||||
toolbar.setNavigationOnClickListener(v -> {
|
toolbar.setNavigationOnClickListener(v -> {
|
||||||
//this.libraryItemPage = lacertaLibrary.getLibraryPage(this.libraryItemPage.getParentId(), 10).join();
|
// Stop Activity
|
||||||
// Back
|
getActivity().finish();
|
||||||
Navigation.findNavController(requireView()).popBackStack();
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
toolbar.setNavigationIcon(null);
|
toolbar.setNavigationIcon(null);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user