SHARE
TWEET

Untitled

a guest Feb 17th, 2017 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.example.roman.capitalistadventure;
  2.  
  3. import android.support.v7.widget.RecyclerView;
  4. import android.util.Log;
  5. import android.view.LayoutInflater;
  6. import android.view.View;
  7. import android.view.ViewGroup;
  8.  
  9. /**
  10.  * Created by roman on 16.02.2017.
  11.  */
  12.  
  13. public class marketplaceAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
  14. {
  15.  
  16.     int position;
  17.  
  18.     public marketplaceAdapter()
  19.     {
  20.         Utility.marketplaceAdapter=this;
  21.     }
  22.  
  23.     @Override
  24.     public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
  25.     {
  26.         if (viewType == 0)
  27.         {
  28.             Log.d("View: ", "normalView");
  29.             View cardView = LayoutInflater.from(parent.getContext()).inflate(R.layout.activity_marketplace_card, parent, false);
  30.  
  31.             marketplaceViewHolder Item = new marketplaceViewHolder(cardView);
  32.  
  33.             return Item;
  34.         }
  35.         else
  36.         {
  37.             Log.d("keine items","");
  38.             return null;
  39.         }
  40.     }
  41.  
  42.  
  43.  
  44.  
  45.     @Override
  46.     public void onBindViewHolder(RecyclerView.ViewHolder holder, int position)
  47.     {
  48.         if (Utility.amountArray[position]==0)
  49.         {
  50.             ButtonViewHolder buttonHolder = (ButtonViewHolder) holder;
  51.             buttonHolder.position = position;
  52.             buttonHolder.UpdateLayout();
  53.         }
  54.         else
  55.         {
  56.             VentureViewHolder venture = (VentureViewHolder)holder;
  57.             venture.position=position;
  58.             venture.UpdateLayout();
  59.         }
  60.     }
  61.  
  62.     @Override
  63.     public int getItemCount()
  64.     {
  65.         return 10;
  66.     }
  67.  
  68.     @Override
  69.     public int getItemViewType(int position)
  70.     {
  71.         return 10;
  72.     }
  73. }
RAW Paste Data
Top