daily pastebin goal
17%
SHARE
TWEET

HistoryDetailsAdapter

a guest Sep 25th, 2018 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.getmobileltd.cotenant.history;
  2.  
  3. import android.content.Context;
  4. import android.support.annotation.NonNull;
  5. import android.support.v4.view.LayoutInflaterFactory;
  6. import android.support.v7.widget.RecyclerView;
  7. import android.view.LayoutInflater;
  8. import android.view.View;
  9. import android.view.ViewGroup;
  10. import android.widget.TextView;
  11.  
  12. import com.getmobileltd.cotenant.R;
  13.  
  14. import java.util.List;
  15.  
  16. public class HistoryDetailsAdapter extends RecyclerView.Adapter<HistoryDetailsAdapter.MyViewHolder> {
  17.     Context context;
  18.     List<HistoryDetailsModel> modelDetailsList;
  19.  
  20.     public HistoryDetailsAdapter(Context context, List<HistoryDetailsModel> modelDetailsList) {
  21.         this.context = context;
  22.         this.modelDetailsList = modelDetailsList;
  23.     }
  24.  
  25.     @NonNull
  26.     @Override
  27.     public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
  28.             View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_history_details,parent,false);
  29.             return new MyViewHolder(v);
  30.  
  31.     }
  32.  
  33.     @Override
  34.     public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
  35.         holder.tv_amount.setText(modelDetailsList.get(position).getAmount());
  36.         holder.tv_date.setText(modelDetailsList.get(position).getFullDate());
  37.         holder.tv_halfdate.setText(modelDetailsList.get(position).getHalfDate());
  38.     }
  39.  
  40.     @Override
  41.     public int getItemCount() {
  42.         return modelDetailsList.size();
  43.     }
  44.  
  45.     public static class MyViewHolder extends RecyclerView.ViewHolder{
  46.         private TextView tv_date, tv_amount,tv_halfdate;
  47.  
  48.         public MyViewHolder(View itemView) {
  49.             super(itemView);
  50.             tv_amount = itemView.findViewById(R.id.history_details_amount);
  51.             tv_date = itemView.findViewById(R.id.history_details_date);
  52.             tv_halfdate = itemView.findViewById(R.id.history_details_halfdate);
  53.         }
  54.     }
  55. }
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