From 872bbd0f4ea9f7a805cf2f334d22b6460bb81039 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 04:07:05 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1=E3=83=B3?= =?UTF-8?q?=E3=83=88=E5=90=8D=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../viewer/ComponentViewerTopFragment.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java index e3f71bb7..3a78dfad 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java @@ -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 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);