daily pastebin goal
72%
SHARE
TWEET

Untitled

a guest Nov 17th, 2017 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.example.artistle.testjob.Adapter;
  2.  
  3. import android.support.v7.widget.RecyclerView;
  4. import android.view.LayoutInflater;
  5. import android.view.View;
  6. import android.view.ViewGroup;
  7. import android.widget.TextView;
  8.  
  9. import com.example.artistle.testjob.Api.InfoUsers;
  10. import com.example.artistle.testjob.Model.InfoModel;
  11. import com.example.artistle.testjob.Model.PostModel;
  12. import com.example.artistle.testjob.R;
  13.  
  14. import java.util.List;
  15.  
  16. /**
  17.  * Created by artistle on 15.11.17.
  18.  */
  19.  
  20. public class InfoAdapter extends RecyclerView.Adapter<InfoAdapter.ViewHolder> {
  21.     List<InfoModel> info_data;
  22.  
  23.     public InfoAdapter(List<InfoModel> info) {
  24.     }
  25.  
  26.  
  27.     @Override
  28.     public InfoAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  29.         View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.info_model, parent, false);
  30.         return new ViewHolder(v);
  31.     }
  32.  
  33.     @Override
  34.     public void onBindViewHolder(ViewHolder holder, int position) {
  35.         InfoModel info = info_data.get(position);
  36.  
  37.         holder.name.setText(info.getTitle());
  38.         holder.userName.setText(info.getBody());
  39.     }
  40.  
  41.  
  42.     @Override
  43.     public int getItemCount() {
  44.         /*if(info_data == null){
  45.             return 0;
  46.         }*/
  47.         return info_data.size();
  48.     }
  49.  
  50.     public class ViewHolder extends RecyclerView.ViewHolder {
  51.         TextView name;
  52.         TextView userName;
  53.         TextView email;
  54.         TextView phone;
  55.         TextView website;
  56.         TextView company;
  57.         public ViewHolder(View itemView) {
  58.             super(itemView);
  59.  
  60.             name = (TextView)itemView.findViewById(R.id.title);
  61.             userName = (TextView)itemView.findViewById(R.id.body);
  62.            /* email = (TextView)itemView.findViewById(R.id.info_email);
  63.             phone = (TextView)itemView.findViewById(R.id.info_phone);
  64.             website = (TextView)itemView.findViewById(R.id.website);
  65.             company = (TextView)itemView.findViewById(R.id.info_company); */
  66.         }
  67.     }
  68. }
RAW Paste Data
Top