public void showList(){
FirebaseRecyclerOptions options =
new FirebaseRecyclerOptions.Builder<Model>()
.setQuery(reference,Model.class)
.build();
adapter = new FirebaseRecyclerAdapter<Model, ViewHolder>(options) {
@Override
protected void onBindViewHolder(@NonNull ViewHolder viewHolder, int i, @NonNull final Model model) {
///What happen to data obtainied from fire base
viewHolder.txtViewDescription.setText(model.getmName());
Picasso.with(MainActivity.this)
.load(model.getmImageUri())
.fit()
.centerCrop()
.into(viewHolder.tvImageView);
viewHolder.tvImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this,GalleryActivity.class);
intent.putExtra("image_url",model.getmImageUri());
startActivity(intent);
}
});
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.image_view,parent,false);
return new ViewHolder(view);
}
};