Swipecards
Swipecards copied to clipboard
Image loaded, with glide, flickers
I am using the cards, that have an ImageView with the content loaded from the web/cache with glide.
When the top card is moved, I see the next card with ImageView that has a picture loaded into it.
However, once the top card goes away, adapter gets datasetchanged event and re-inflates all cards' views. That causes the next card to re-load the image and it blinks.
Any ideas how to work around this issue?
Hi, How to add images . Can you please share the code ?
Hi, How to add images . Can you please share the code ?
I do it like this. If user has an image uploaded in DB, we get the default method and load this image, orhetwise, we set user's image like default profile image.
switch (card_item.getProfileImageUrl()) {
case "default":
Glide.with(convertView.getContext()).load(R.mipmap.ic_launcher).into(image);
break;
default:
Glide.with(convertView.getContext()).load(card_item.getProfileImageUrl()).into(image);
break;
}
Hi
I am using this but I did'nt get appropriate result . Can you check this out please .
SwipeCardsAdapter lAdapter;
ArrayList<Integer> ex1
ex1 = new ArrayList<Integer>(); ex1.add(R.drawable.image1); ex1.add(R.drawable.image2); ex1.add(R.drawable.image3); ex1.add(R.drawable.image4);
lAdapter = new SwipeCardsAdapter(MainActivity.this, ex1);
Log.d("images", String.valueOf(ex1));
flingContainer.setAdapter(lAdapter);
flingContainer.setFlingListener(new SwipeFlingAdapterView.onFlingListener() {
@Override
public void removeFirstObjectInAdapter() {
// this is the simplest way to delete an object from the Adapter (/AdapterView)
Log.d("LIST", "removed object!");
ex1.remove(0);
//al.remove(0);
//arrayAdapter.notifyDataSetChanged();
lAdapter.notifyDataSetChanged();
}
@Override
public void onAdapterAboutToEmpty(int itemsInAdapter) {
// Ask for more data here
ex1.add(itemsInAdapter);
lAdapter.notifyDataSetChanged();
Log.d("LIST", "notified");
i++;
}