NatalieZhang / AndBootcampIns

Assignment for instagram app
0 stars 0 forks source link

[Android-bootcamp] Assignment 2-Instagram app comments and share - ready for review #2

Open NatalieZhang opened 8 years ago

NatalieZhang commented 8 years ago

Please review. @codepathreview @codepath

codepathreview commented 8 years ago

Great work finishing the stories. Here is some feedback after reviewing your code --

public class InstagramPostsAdapter extends RecyclerView.Adapter<InstagramPostsAdapter.ViewHolder> {
    @Override
    public void onBindViewHolder(ViewHolder holder, int i) {
        InstagramPost post = posts.get(i);
        holder.post = post;
    }

    public static class ViewHolder extends RecyclerView.ViewHolder {
        private InstagramPost post;
        private Button btnDoSomethingWithPost;

        public ViewHolder(View itemView) {
            super(itemView);
            btnDoSomethingWithPost = (Button) itemView.findViewById(R.id.btnDoSomethingWithPost);
            setupListeners();
        }

        void setupListeners() {
            btnDoSomethingWithPost.setOnClickListener(new View.OnClickListener(){
                @Override
                public void onClick(View v) {
                    // context can be referenced via v.getContext()
                    doSomethingWithPost(post);
                }
            });
        }
    }
}