Last active
January 17, 2016 23:29
-
-
Save ColeMurray/fdb36ef92e52b0471900 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.murraycole.impressiontutorial; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import java.util.List; | |
public class ImpressionAdapter extends RecyclerView.Adapter<ProductViewHolder> { | |
private List<String> mDataSet; | |
public ImpressionAdapter(List<String> dataSet) { | |
mDataSet = dataSet; | |
} | |
@Override | |
public ProductViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { | |
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.product_item_layout, viewGroup, false); | |
return new ProductViewHolder(view); | |
} | |
@Override | |
public void onBindViewHolder(ProductViewHolder productViewHolder, int i) { | |
String title = mDataSet.get(i); | |
productViewHolder.mTitleTextView.setText(title); | |
} | |
@Override | |
public int getItemCount() { | |
return mDataSet.size(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment