Created
May 15, 2016 09:18
-
-
Save SmartDengg/0228b0448dc185b7a149f7b2a1977ebb 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
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end | |
import android.content.Context; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import java.util.List; | |
#parse("File Header.java") | |
public class ${NAME} extends RecyclerView.Adapter<${NAME}.${VIEWHOLDER_CLASS}> { | |
private final Context context; | |
private List<${ITEM_CLASS}> items; | |
public ${NAME}(List<${ITEM_CLASS}> items, Context context) { | |
this.items = items; | |
this.context = context; | |
} | |
@Override | |
public ${VIEWHOLDER_CLASS} onCreateViewHolder(ViewGroup parent, | |
int viewType) { | |
return new ${VIEWHOLDER_CLASS}(LayoutInflater.from(parent.getContext()) | |
.inflate(R.layout.${LAYOUT_RES_ID}, parent, false)); | |
} | |
@Override | |
public void onBindViewHolder(${VIEWHOLDER_CLASS} holder, int position) { | |
${ITEM_CLASS} item = items.get(position); | |
//TODO Fill in your logic for binding the view. | |
} | |
@Override | |
public int getItemCount() { | |
return (this.items != null) ? items.size() : 0; | |
} | |
static class ${VIEWHOLDER_CLASS} extends RecyclerView.ViewHolder { | |
public ViewHolder(View itemView) { | |
super(itemView); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment