From 9f50696b39008f094a1cedda8fcf33cb54ff1c38 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 04:13:02 +0900 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E3=81=AB=E3=82=BF=E3=82=A4?= =?UTF-8?q?=E3=83=88=E3=83=AB=E3=81=8C=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=82=8B=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 | 2 +- .../feature/home/DocumentSelectListener.java | 2 +- .../nem/lacerta/feature/home/HomeTopFragment.java | 14 +++++++++----- .../nem/lacerta/feature/home/ListItemAdapter.java | 4 +--- 4 files changed, 12 insertions(+), 10 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 3a78dfad..6e7951cb 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 @@ -63,7 +63,7 @@ public class ComponentViewerTopFragment extends Fragment { super.onCreate(savedInstanceState); if (getArguments() != null) { documentId = getArguments().getString("documentId"); - String documentName = getArguments().getString("documentName"); + documentName = getArguments().getString("documentName"); } } diff --git a/feature/home/src/main/java/one/nem/lacerta/feature/home/DocumentSelectListener.java b/feature/home/src/main/java/one/nem/lacerta/feature/home/DocumentSelectListener.java index 852f8e98..3d33367f 100644 --- a/feature/home/src/main/java/one/nem/lacerta/feature/home/DocumentSelectListener.java +++ b/feature/home/src/main/java/one/nem/lacerta/feature/home/DocumentSelectListener.java @@ -1,5 +1,5 @@ package one.nem.lacerta.feature.home; public interface DocumentSelectListener { - void onDocumentSelect(String documentId); + void onDocumentSelect(String documentId, String documentName); } diff --git a/feature/home/src/main/java/one/nem/lacerta/feature/home/HomeTopFragment.java b/feature/home/src/main/java/one/nem/lacerta/feature/home/HomeTopFragment.java index 39a356ba..5fea2c36 100644 --- a/feature/home/src/main/java/one/nem/lacerta/feature/home/HomeTopFragment.java +++ b/feature/home/src/main/java/one/nem/lacerta/feature/home/HomeTopFragment.java @@ -85,11 +85,15 @@ public class HomeTopFragment extends Fragment { Toolbar toolbar = view.findViewById(R.id.home_toolbar); toolbarSetup(toolbar, false, "ホーム"); - ListItemAdapter listItemAdapter = new ListItemAdapter(documentId -> { - Log.d("HomeTopFragment", "onViewCreated: " + documentId); - Intent intent = new Intent(getContext(), ViewerMainActivity.class); - intent.putExtra("documentId", documentId); - startActivity(intent); + ListItemAdapter listItemAdapter = new ListItemAdapter(new DocumentSelectListener() { + @Override + public void onDocumentSelect(String documentId, String documentName) { + Intent intent = new Intent(getContext(), ViewerMainActivity.class); + Log.d("HomeTopFragment", "onDocumentSelect: " + documentId + " " + documentName); + intent.putExtra("documentId", documentId); + intent.putExtra("documentName", documentName); + startActivity(intent); + } }); recyclerView.setAdapter(listItemAdapter); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); diff --git a/feature/home/src/main/java/one/nem/lacerta/feature/home/ListItemAdapter.java b/feature/home/src/main/java/one/nem/lacerta/feature/home/ListItemAdapter.java index 73624b32..80656ecb 100644 --- a/feature/home/src/main/java/one/nem/lacerta/feature/home/ListItemAdapter.java +++ b/feature/home/src/main/java/one/nem/lacerta/feature/home/ListItemAdapter.java @@ -46,9 +46,7 @@ public class ListItemAdapter extends RecyclerView.Adapter { - Intent intent = new Intent(v.getContext(), ViewerMainActivity.class); - intent.putExtra("documentId", listItem.getItemId()); - v.getContext().startActivity(intent); + listener.onDocumentSelect(listItem.getItemId(), listItem.getTitle()); }); }