アイテムにタッチリスナーを追加

This commit is contained in:
r-ca 2024-01-27 16:16:52 +09:00
parent cf257a44ec
commit 542c04b908
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9
2 changed files with 4 additions and 3 deletions

View File

@ -78,10 +78,9 @@ public class LacertaSelectRevDialog extends DialogFragment {
SelectRevDialogItemAdapter adapter = new SelectRevDialogItemAdapter(revId -> {
if (listener != null) {
listener.onItemSelected(revId);
}
dismiss();
}
});
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
builder.setView(view);

View File

@ -41,6 +41,8 @@ public class SelectRevDialogItemAdapter extends RecyclerView.Adapter<SelectRevDi
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
holder.description.setText(simpleDateFormat.format(rev.getCreatedAt()));
holder.revId.setText("RevID: " + rev.getId());
holder.itemView.setOnClickListener(v -> listener.onItemSelected(rev.getId()));
}
@Override