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

Clear Cache #21

Open
TheLGameS opened this issue Jun 19, 2017 · 0 comments
Open

Clear Cache #21

TheLGameS opened this issue Jun 19, 2017 · 0 comments

Comments

@TheLGameS
Copy link

TheLGameS commented Jun 19, 2017

How to Clear cached images ?
Need call
Glide.get(this.activity).clearDiskCache();
and
Glide.get(this.activity).clearMemory();
in

public Object instantiateItem(ViewGroup container, int position) {
    View itemView = this.mLayoutInflater.inflate(layout.pager_item, container, false);
    final ImageView imageView = (ImageView)itemView.findViewById(id.iv);
    Glide.with(this.activity).load((String)this.images.get(position)).listener(new RequestListener() {
        public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
            return false;
        }

        public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
            ViewPagerAdapter.this.mPhotoViewAttacher = new PhotoViewAttacher(imageView);
            ViewPagerAdapter.this.mPhotoViewAttacher.setOnPhotoTapListener(new OnPhotoTapListener() {
                public void onPhotoTap(View view, float x, float y) {
                    if(ViewPagerAdapter.this.isShowing) {
                        ViewPagerAdapter.this.isShowing = false;
                        ViewPagerAdapter.this.toolbar.animate().translationY((float)(-ViewPagerAdapter.this.toolbar.getBottom())).setInterpolator(new AccelerateInterpolator()).start();
                        ViewPagerAdapter.this.imagesHorizontalList.animate().translationY((float)ViewPagerAdapter.this.imagesHorizontalList.getBottom()).setInterpolator(new AccelerateInterpolator()).start();
                    } else {
                        ViewPagerAdapter.this.isShowing = true;
                        ViewPagerAdapter.this.toolbar.animate().translationY(0.0F).setInterpolator(new DecelerateInterpolator()).start();
                        ViewPagerAdapter.this.imagesHorizontalList.animate().translationY(0.0F).setInterpolator(new DecelerateInterpolator()).start();
                    }

                }

                public void onOutsidePhotoTap() {
                }
            });
            return false;
        }
    }).into(imageView);
    container.addView(itemView);
    return itemView;
}

or add flag for don't use cache in Glide.with().load().diskCacheStrategy(DiskCacheStrategy.NONE).skipMemoryCache(true).into()

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

1 participant