正常にタイトルが表示されるように

This commit is contained in:
r-ca 2024-01-23 04:13:02 +09:00
parent 9865790a98
commit 9f50696b39
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9
4 changed files with 12 additions and 10 deletions

View File

@ -63,7 +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"); documentName = getArguments().getString("documentName");
} }
} }

View File

@ -1,5 +1,5 @@
package one.nem.lacerta.feature.home; package one.nem.lacerta.feature.home;
public interface DocumentSelectListener { public interface DocumentSelectListener {
void onDocumentSelect(String documentId); void onDocumentSelect(String documentId, String documentName);
} }

View File

@ -85,11 +85,15 @@ public class HomeTopFragment extends Fragment {
Toolbar toolbar = view.findViewById(R.id.home_toolbar); Toolbar toolbar = view.findViewById(R.id.home_toolbar);
toolbarSetup(toolbar, false, "ホーム"); toolbarSetup(toolbar, false, "ホーム");
ListItemAdapter listItemAdapter = new ListItemAdapter(documentId -> { ListItemAdapter listItemAdapter = new ListItemAdapter(new DocumentSelectListener() {
Log.d("HomeTopFragment", "onViewCreated: " + documentId); @Override
Intent intent = new Intent(getContext(), ViewerMainActivity.class); public void onDocumentSelect(String documentId, String documentName) {
intent.putExtra("documentId", documentId); Intent intent = new Intent(getContext(), ViewerMainActivity.class);
startActivity(intent); Log.d("HomeTopFragment", "onDocumentSelect: " + documentId + " " + documentName);
intent.putExtra("documentId", documentId);
intent.putExtra("documentName", documentName);
startActivity(intent);
}
}); });
recyclerView.setAdapter(listItemAdapter); recyclerView.setAdapter(listItemAdapter);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));

View File

@ -46,9 +46,7 @@ public class ListItemAdapter extends RecyclerView.Adapter<ListItemAdapter.ListIt
holder.description.setText(listItem.getDescription()); holder.description.setText(listItem.getDescription());
holder.itemView.setOnClickListener( v -> { holder.itemView.setOnClickListener( v -> {
Intent intent = new Intent(v.getContext(), ViewerMainActivity.class); listener.onDocumentSelect(listItem.getItemId(), listItem.getTitle());
intent.putExtra("documentId", listItem.getItemId());
v.getContext().startActivity(intent);
}); });
} }