mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
アダプタ実装
This commit is contained in:
parent
dd1be73904
commit
a825ad6a36
|
@ -1,33 +1,48 @@
|
||||||
package one.nem.lacerta.component.viewer;
|
package one.nem.lacerta.component.viewer;
|
||||||
|
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.media.Image;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class ViewerBodyAdapter extends RecyclerView.Adapter<ViewerBodyAdapter.ViewHolder>{
|
public class ViewerBodyAdapter extends RecyclerView.Adapter<ViewerBodyAdapter.ViewHolder>{
|
||||||
|
|
||||||
|
ArrayList<Bitmap> images;
|
||||||
|
|
||||||
|
public ViewerBodyAdapter(ArrayList<Bitmap> images){
|
||||||
|
this.images = images;
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public ViewerBodyAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
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
|
@Override
|
||||||
public void onBindViewHolder(@NonNull ViewerBodyAdapter.ViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull ViewerBodyAdapter.ViewHolder holder, int position) {
|
||||||
|
holder.image.setImageBitmap(images.get(position));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return 0;
|
return images.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ViewHolder extends RecyclerView.ViewHolder{
|
public class ViewHolder extends RecyclerView.ViewHolder{
|
||||||
|
|
||||||
|
ImageView image;
|
||||||
|
|
||||||
public ViewHolder(@NonNull View itemView) {
|
public ViewHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
image = itemView.findViewById(R.id.imageView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user