I have a custom ArrayAdapter populating a ListView. Here it is:
public class FilesAdapter extends ArrayAdapter<PutioFileLayout> {
Context context;
int layoutResourceId;
List<PutioFileLayout> data = null;
public FilesAdapter(Context context, int layoutResourceId, List<PutioFileLayout> data) {
super(context, layoutResourceId, data);
this.layoutResourceId = layoutResourceId;
this.context = context;
this.data = data;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
FileHolder holder = null;
if (row == null) {
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
row = inflater.inflate(layoutResourceId, parent, false);
holder = new FileHolder();
holder.textName = (TextView) row.findViewById(R.id.text_fileListName);
holder.textDescription = (TextView) row.findViewById(R.id.text_fileListDesc);
holder.imgIcon = (ImageView) row.findViewById(R.id.img_fileIcon);
row.setTag(holder);
} else {
holder = (FileHolder) row.getTag();
}
PutioFileLayout file = data.get(position);
holder.textName.setText(file.name);
holder.textDescription.setText(file.description);
holder.imgIcon.setImageResource(file.icon);
return row;
}
static class FileHolder {
TextView textName;
TextView textDescription;
ImageView imgIcon;
}
}
I have a Fragment that initializes the custom adapter at first with one item, which says “Loading”, then does some network stuff, and finally updates the adapter with the real information.
I want to have some kind of animation for when the loading is done and the real info comes in. Maybe a simple fade out. But I can’t figure out how I can use .animate() on any of my ListView‘s rows when this takes place.
How should I go about this?
On your call back just do:
listView.getChildAt(…).animate();