diff --git a/app/src/main/java/com/example/nemophila/MyPageActivityAdapter.java b/app/src/main/java/com/example/nemophila/MyPageActivityAdapter.java new file mode 100644 index 0000000..b8651d1 --- /dev/null +++ b/app/src/main/java/com/example/nemophila/MyPageActivityAdapter.java @@ -0,0 +1,38 @@ +package com.example.nemophila; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.recyclerview.widget.RecyclerView; + +import java.util.List; + +public class MyPageActivityAdapter extends RecyclerView.Adapter { + + private List list; + + public MyPageActivityAdapter(List list) { + this.list = list; + } + + @Override + public PostsViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + View inflate = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_my_page_activity_posts, parent,false); + PostsViewHolder vh = new PostsViewHolder(inflate); + return vh; + } + + @Override + public void onBindViewHolder(PostsViewHolder holder, int position) { + holder.dateView.setText(list.get(position).getDate()); + holder.rateView.setText(list.get(position).getRate()); + holder.genreView.setText(list.get(position).getGenre()); + holder.commentView.setText(list.get(position).getComment()); + } + + @Override + public int getItemCount() { + return list.size(); + } +}