イベントリスナ実装

This commit is contained in:
r-ca 2024-01-24 17:32:58 +09:00
parent 1b60b15187
commit 5639117e0e
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -12,6 +12,7 @@ import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import one.nem.lacerta.component.viewer.model.RevSelectListener;
import one.nem.lacerta.model.VcsRevModel;
import one.nem.lacerta.utils.FeatureSwitch;
@ -19,11 +20,14 @@ public class RevAdapter extends RecyclerView.Adapter<RevAdapter.RevViewHolder>{
private ArrayList<VcsRevModel> revModels;
private RevSelectListener revSelectListener;
public RevAdapter(ArrayList<VcsRevModel> revModels) {
this.revModels = revModels;
}
public RevAdapter() {
public RevAdapter(RevSelectListener revSelectListener) {
this.revSelectListener = revSelectListener;
}
public void setRevModels(ArrayList<VcsRevModel> revModels) {
@ -52,6 +56,13 @@ public class RevAdapter extends RecyclerView.Adapter<RevAdapter.RevViewHolder>{
}
holder.revId.setText("RevID: " + revModel.getId());
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
revSelectListener.onRevSelect(revModel.getId());
}
});
}
@Override