mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
イベントリスナ実装
This commit is contained in:
parent
1b60b15187
commit
5639117e0e
|
@ -12,6 +12,7 @@ import java.text.SimpleDateFormat;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import one.nem.lacerta.component.viewer.model.RevSelectListener;
|
||||||
import one.nem.lacerta.model.VcsRevModel;
|
import one.nem.lacerta.model.VcsRevModel;
|
||||||
import one.nem.lacerta.utils.FeatureSwitch;
|
import one.nem.lacerta.utils.FeatureSwitch;
|
||||||
|
|
||||||
|
@ -19,11 +20,14 @@ public class RevAdapter extends RecyclerView.Adapter<RevAdapter.RevViewHolder>{
|
||||||
|
|
||||||
private ArrayList<VcsRevModel> revModels;
|
private ArrayList<VcsRevModel> revModels;
|
||||||
|
|
||||||
|
private RevSelectListener revSelectListener;
|
||||||
|
|
||||||
public RevAdapter(ArrayList<VcsRevModel> revModels) {
|
public RevAdapter(ArrayList<VcsRevModel> revModels) {
|
||||||
this.revModels = revModels;
|
this.revModels = revModels;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RevAdapter() {
|
public RevAdapter(RevSelectListener revSelectListener) {
|
||||||
|
this.revSelectListener = revSelectListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRevModels(ArrayList<VcsRevModel> revModels) {
|
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.revId.setText("RevID: " + revModel.getId());
|
||||||
|
|
||||||
|
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
revSelectListener.onRevSelect(revModel.getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user