アダプタ実装

This commit is contained in:
r-ca 2024-01-20 17:39:21 +09:00
parent dd1be73904
commit a825ad6a36
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -1,33 +1,48 @@
package one.nem.lacerta.component.viewer;
import android.graphics.Bitmap;
import android.media.Image;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
public class ViewerBodyAdapter extends RecyclerView.Adapter<ViewerBodyAdapter.ViewHolder>{
ArrayList<Bitmap> images;
public ViewerBodyAdapter(ArrayList<Bitmap> images){
this.images = images;
}
@NonNull
@Override
public ViewerBodyAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return null;
View view = View.inflate(parent.getContext(), R.layout.viewer_body_list_item, null);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ViewerBodyAdapter.ViewHolder holder, int position) {
holder.image.setImageBitmap(images.get(position));
}
@Override
public int getItemCount() {
return 0;
return images.size();
}
public class ViewHolder extends RecyclerView.ViewHolder{
ImageView image;
public ViewHolder(@NonNull View itemView) {
super(itemView);
image = itemView.findViewById(R.id.imageView);
}
}
}