Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Apr 10th, 2020 126 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.example.amtis2;
  2.  
  3. import android.content.Context;
  4. import android.view.LayoutInflater;
  5. import android.view.View;
  6. import android.view.ViewGroup;
  7. import android.widget.ImageView;
  8. import android.widget.TextView;
  9.  
  10. import androidx.annotation.NonNull;
  11. import androidx.recyclerview.widget.RecyclerView;
  12.  
  13. import com.bumptech.glide.Glide;
  14. import com.bumptech.glide.request.RequestOptions;
  15.  
  16. import java.util.ArrayList;
  17.  
  18. public class HospitalAdapter extends RecyclerView.Adapter<HospitalAdapter.CardViewViewHolder> {
  19.     private ArrayList<Hospital> listHospital;
  20.     private Context context;
  21.  
  22.     public HospitalAdapter(ArrayList<Hospital> listHospital, Context context) {
  23.         this.listHospital = listHospital;
  24.         this.context = context;
  25.     }
  26.  
  27.     public class CardViewViewHolder extends RecyclerView.ViewHolder {
  28.         ImageView hospitalImage;
  29.         TextView hospitalName, hospitalAddress;
  30.         RecyclerView recyclerView;
  31.         public CardViewViewHolder(@NonNull View itemView) {
  32.             super(itemView);
  33.             recyclerView = itemView.findViewById(R.id.rv_hospital);
  34.             hospitalImage = itemView.findViewById(R.id.iv_hospital);
  35.             hospitalName = itemView.findViewById(R.id.tv_hospital_name);
  36.             hospitalAddress = itemView.findViewById(R.id.tv_hospital_address);
  37.         }
  38.     }
  39.  
  40.     @NonNull
  41.     @Override
  42.     public HospitalAdapter.CardViewViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int position) {
  43.         View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_list_hospital, viewGroup, false);
  44.         return new CardViewViewHolder(view);
  45.     }
  46.  
  47.     @Override
  48.     public void onBindViewHolder(@NonNull HospitalAdapter.CardViewViewHolder holder, int position) {
  49.  
  50.         Hospital hospital = listHospital.get(position);
  51.         Glide.with(holder.itemView.getContext())
  52.                 .load(hospital.getImage())
  53.                 .apply(new RequestOptions().override(350, 550))
  54.                 .into(holder.hospitalImage);
  55.         holder.hospitalName.setText(hospital.getName());
  56.         holder.hospitalAddress.setText(hospital.getAddress());
  57.     }
  58.  
  59.     @Override
  60.     public int getItemCount() {
  61.         return listHospital.size();
  62.     }
  63. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top