Skip to content

Instantly share code, notes, and snippets.

@shakil807g
Created June 1, 2017 20:34
Show Gist options
  • Save shakil807g/385bcc820f77dd9bfbe9a012f9cc4a3d to your computer and use it in GitHub Desktop.
Save shakil807g/385bcc820f77dd9bfbe9a012f9cc4a3d to your computer and use it in GitHub Desktop.
public class DBMainAppointmentAdapter extends MyBaseAdapter<MainAppointment,ItemDashboardBinding> {
private VideoClickListener videoClickListener;
public DBMainAppointmentAdapter(Context context) {
super(context);
}
public void setVideoClickListner(VideoClickListener videoClickListner) {
this.videoClickListener = videoClickListner;
}
@Override
protected int getLayoutIdForPosition(int position) {
return R.layout.item_dashboard;
}
@Override
protected void bindData(ItemDashboardBinding dataBinding, MainAppointment item, int position) {
dataBinding.docName.setText(item.name);
dataBinding.date.setText(Utils.formatDate(item.date));
dataBinding.time.setText(Utils.format12HourTime(item.start_time));
Picasso.with(getContext()).load(AppModule.profileimage+item.image)
.placeholder(R.drawable.image_placeholder).into(dataBinding.profileImage);
dataBinding.getRoot().setOnClickListener(v -> {
if (position != NO_POSITION && itemClickListner !=null) {
itemClickListner.onItemClick(item);
}
});
dataBinding.videoIcon.setOnClickListener(v -> {
if (position != NO_POSITION) {
if (videoClickListener != null) {
videoClickListener.onVideoIconClick(item.record_id);
}
}
});
}
public interface VideoClickListener{
public void onVideoIconClick(String url);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment