package com.example.cloudmusic.textNewUI;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.example.cloudmusic.R;

import java.util.List;

public class Text10088 extends RecyclerView.Adapter<Text10088.InnerHolder> {

    private final List<String> mList;
    private final Context mContext;

    public Text10088(List<String> list, Context context) {
        System.out.println(list);
        mList = list;
        mContext = context;
    }

    @NonNull
    @Override
    public Text10088.InnerHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new InnerHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.text_item,parent,false));
    }

    @Override
    public void onBindViewHolder(@NonNull Text10088.InnerHolder holder, int position) {
        holder.setData(mList.get(position));
    }

    @Override
    public int getItemCount() {
        return mList.size();
    }

    public class InnerHolder extends RecyclerView.ViewHolder {

        private final TextView v;

        public InnerHolder(@NonNull View itemView) {
            super(itemView);
            v = itemView.findViewById(R.id.text_content);
        }

        public void setData(String s) {
            v.setText(s);
        }
    }
}
