Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image loaded, with glide, flickers #185

Open
alexander-ignatow opened this issue Dec 15, 2016 · 3 comments
Open

Image loaded, with glide, flickers #185

alexander-ignatow opened this issue Dec 15, 2016 · 3 comments

Comments

@alexander-ignatow
Copy link

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?

@hanisha2128-droid
Copy link

Hi,
How to add images . Can you please share the code ?

@Drewsovsky
Copy link

Drewsovsky commented Mar 31, 2020

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;
}

@hanisha2128-droid
Copy link

Hi

I am using this but I did'nt get appropriate result . Can you check this out please .

SwipeCardsAdapter lAdapter;

ArrayList ex1

ex1 = new ArrayList();
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++;
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants