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()); }); }