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

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);
if (getArguments() != null) {
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;
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);
toolbarSetup(toolbar, false, "ホーム");
ListItemAdapter listItemAdapter = new ListItemAdapter(documentId -> {
Log.d("HomeTopFragment", "onViewCreated: " + documentId);
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()));

View File

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