1
0
Fork 1

fix repeating GIFs

This commit is contained in:
Arne 2024-03-27 22:50:06 +01:00
parent 62b6caabc5
commit 3c8dbc1e9e

View file

@ -37,18 +37,18 @@ public class GifsAdapter extends BaseAdapter {
return pos;
}
@Override
public View getView(int p, View convertView, ViewGroup parent) {
View grid;
LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (convertView == null) {
grid = inflater.inflate(R.layout.activity_gridview, null);
ImageView imageView = (ImageView)grid.findViewById(R.id.grid_item);
Glide.with(ctx).load(filesPaths[p]).into(imageView);
public View getView(int position, View convertView, ViewGroup parent) {
View v;
if (convertView == null) { // if it's not recycled, initialize some attributes
LayoutInflater inflater = (LayoutInflater) ctx.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
v = inflater.inflate(R.layout.activity_gridview, parent, false);
} else {
grid = (View) convertView;
v = (View) convertView;
}
return grid;
ImageView image = (ImageView)v.findViewById(R.id.grid_item);
Glide.with(ctx).load(filesPaths[position]).into(image);
return v;
}
}