Search in sources :

Example 1 with SubsamplingScaleImageView

use of me.ccrama.redditslide.Views.SubsamplingScaleImageView in project Slide by ccrama.

the class MediaFragmentComment method displayImage.

public void displayImage(final String url) {
    if (!imageShown) {
        actuallyLoaded = url;
        final SubsamplingScaleImageView i = rootView.findViewById(R.id.submission_image);
        i.setMinimumDpi(70);
        i.setMinimumTileDpi(240);
        final ProgressBar bar = rootView.findViewById(R.id.progress);
        bar.setIndeterminate(false);
        bar.setProgress(0);
        final Handler handler = new Handler();
        final Runnable progressBarDelayRunner = new Runnable() {

            public void run() {
                bar.setVisibility(View.VISIBLE);
            }
        };
        handler.postDelayed(progressBarDelayRunner, 500);
        ImageView fakeImage = new ImageView(getActivity());
        fakeImage.setLayoutParams(new LinearLayout.LayoutParams(i.getWidth(), i.getHeight()));
        fakeImage.setScaleType(ImageView.ScaleType.CENTER_CROP);
        File f = ((Reddit) getActivity().getApplicationContext()).getImageLoader().getDiskCache().get(url);
        if (f != null && f.exists()) {
            imageShown = true;
            try {
                i.setImage(ImageSource.uri(f.getAbsolutePath()));
            } catch (Exception e) {
            // todo  i.setImage(ImageSource.bitmap(loadedImage));
            }
            (rootView.findViewById(R.id.progress)).setVisibility(View.GONE);
            handler.removeCallbacks(progressBarDelayRunner);
            previous = i.scale;
            final float base = i.scale;
            i.setOnStateChangedListener(new SubsamplingScaleImageView.DefaultOnStateChangedListener() {

                @Override
                public void onScaleChanged(float newScale, int origin) {
                    if (newScale > previous && !hidden && newScale > base) {
                        hidden = true;
                        final View base = rootView.findViewById(R.id.base);
                        ValueAnimator va = ValueAnimator.ofFloat(1.0f, 0.2f);
                        // in millis
                        int mDuration = 250;
                        va.setDuration(mDuration);
                        va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

                            public void onAnimationUpdate(ValueAnimator animation) {
                                Float value = (Float) animation.getAnimatedValue();
                                base.setAlpha(value);
                            }
                        });
                        va.start();
                    // hide
                    } else if (newScale <= previous && hidden) {
                        hidden = false;
                        final View base = rootView.findViewById(R.id.base);
                        ValueAnimator va = ValueAnimator.ofFloat(0.2f, 1.0f);
                        // in millis
                        int mDuration = 250;
                        va.setDuration(mDuration);
                        va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

                            public void onAnimationUpdate(ValueAnimator animation) {
                                Float value = (Float) animation.getAnimatedValue();
                                base.setAlpha(value);
                            }
                        });
                        va.start();
                    // unhide
                    }
                    previous = newScale;
                }
            });
        } else {
            ((Reddit) getActivity().getApplicationContext()).getImageLoader().displayImage(url, new ImageViewAware(fakeImage), new DisplayImageOptions.Builder().resetViewBeforeLoading(true).cacheOnDisk(true).imageScaleType(ImageScaleType.NONE).cacheInMemory(false).build(), new ImageLoadingListener() {

                @Override
                public void onLoadingStarted(String imageUri, View view) {
                    imageShown = true;
                }

                @Override
                public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
                    Log.v(LogUtil.getTag(), "LOADING FAILED");
                }

                @Override
                public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
                    imageShown = true;
                    File f = null;
                    if (getActivity() != null) {
                        f = ((Reddit) getActivity().getApplicationContext()).getImageLoader().getDiskCache().get(url);
                    }
                    if (f != null && f.exists()) {
                        i.setImage(ImageSource.uri(f.getAbsolutePath()));
                    } else {
                        i.setImage(ImageSource.bitmap(loadedImage));
                    }
                    (rootView.findViewById(R.id.progress)).setVisibility(View.GONE);
                    handler.removeCallbacks(progressBarDelayRunner);
                    previous = i.scale;
                    final float base = i.scale;
                    i.setOnStateChangedListener(new SubsamplingScaleImageView.DefaultOnStateChangedListener() {

                        @Override
                        public void onScaleChanged(float newScale, int origin) {
                            if (newScale > previous && !hidden && newScale > base) {
                                hidden = true;
                                final View base = rootView.findViewById(R.id.base);
                                ValueAnimator va = ValueAnimator.ofFloat(1.0f, 0.2f);
                                // in millis
                                int mDuration = 250;
                                va.setDuration(mDuration);
                                va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

                                    public void onAnimationUpdate(ValueAnimator animation) {
                                        Float value = (Float) animation.getAnimatedValue();
                                        base.setAlpha(value);
                                    }
                                });
                                va.start();
                            // hide
                            } else if (newScale <= previous && hidden) {
                                hidden = false;
                                final View base = rootView.findViewById(R.id.base);
                                ValueAnimator va = ValueAnimator.ofFloat(0.2f, 1.0f);
                                // in millis
                                int mDuration = 250;
                                va.setDuration(mDuration);
                                va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

                                    public void onAnimationUpdate(ValueAnimator animation) {
                                        Float value = (Float) animation.getAnimatedValue();
                                        base.setAlpha(value);
                                    }
                                });
                                va.start();
                            // unhide
                            }
                            previous = newScale;
                        }
                    });
                }

                @Override
                public void onLoadingCancelled(String imageUri, View view) {
                    Log.v(LogUtil.getTag(), "LOADING CANCELLED");
                }
            }, new ImageLoadingProgressListener() {

                @Override
                public void onProgressUpdate(String imageUri, View view, int current, int total) {
                    ((ProgressBar) rootView.findViewById(R.id.progress)).setProgress(Math.round(100.0f * current / total));
                }
            });
        }
    }
}
Also used : ImageLoadingProgressListener(com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener) FailReason(com.nostra13.universalimageloader.core.assist.FailReason) ValueAnimator(android.animation.ValueAnimator) Bitmap(android.graphics.Bitmap) Reddit(me.ccrama.redditslide.Reddit) ImageView(android.widget.ImageView) SubsamplingScaleImageView(me.ccrama.redditslide.Views.SubsamplingScaleImageView) ProgressBar(android.widget.ProgressBar) ImageViewAware(com.nostra13.universalimageloader.core.imageaware.ImageViewAware) ImageLoadingListener(com.nostra13.universalimageloader.core.listener.ImageLoadingListener) Handler(android.os.Handler) SubsamplingScaleImageView(me.ccrama.redditslide.Views.SubsamplingScaleImageView) MediaView(me.ccrama.redditslide.Activities.MediaView) ImageView(android.widget.ImageView) ExoVideoView(me.ccrama.redditslide.Views.ExoVideoView) View(android.view.View) SubsamplingScaleImageView(me.ccrama.redditslide.Views.SubsamplingScaleImageView) IOException(java.io.IOException) File(java.io.File) LinearLayout(android.widget.LinearLayout)

Example 2 with SubsamplingScaleImageView

use of me.ccrama.redditslide.Views.SubsamplingScaleImageView in project Slide by ccrama.

the class TumblrPager method loadImage.

private static void loadImage(final View rootView, Fragment f, String url) {
    final SubsamplingScaleImageView image = rootView.findViewById(R.id.image);
    image.setMinimumDpi(70);
    image.setMinimumTileDpi(240);
    ImageView fakeImage = new ImageView(f.getActivity());
    final TextView size = rootView.findViewById(R.id.size);
    fakeImage.setLayoutParams(new LinearLayout.LayoutParams(image.getWidth(), image.getHeight()));
    fakeImage.setScaleType(ImageView.ScaleType.CENTER_CROP);
    ((Reddit) f.getActivity().getApplication()).getImageLoader().displayImage(url, new ImageViewAware(fakeImage), new DisplayImageOptions.Builder().resetViewBeforeLoading(true).cacheOnDisk(true).imageScaleType(ImageScaleType.NONE).cacheInMemory(false).build(), new ImageLoadingListener() {

        @Override
        public void onLoadingStarted(String imageUri, View view) {
            size.setVisibility(View.VISIBLE);
        }

        @Override
        public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
            Log.v("Slide", "LOADING FAILED");
        }

        @Override
        public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
            size.setVisibility(View.GONE);
            image.setImage(ImageSource.bitmap(loadedImage));
            (rootView.findViewById(R.id.progress)).setVisibility(View.GONE);
        }

        @Override
        public void onLoadingCancelled(String imageUri, View view) {
            Log.v("Slide", "LOADING CANCELLED");
        }
    }, new ImageLoadingProgressListener() {

        @Override
        public void onProgressUpdate(String imageUri, View view, int current, int total) {
            size.setText(FileUtil.readableFileSize(total));
            ((ProgressBar) rootView.findViewById(R.id.progress)).setProgress(Math.round(100.0f * current / total));
        }
    });
}
Also used : ImageViewAware(com.nostra13.universalimageloader.core.imageaware.ImageViewAware) ImageLoadingListener(com.nostra13.universalimageloader.core.listener.ImageLoadingListener) ImageLoadingProgressListener(com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener) SubsamplingScaleImageView(me.ccrama.redditslide.Views.SubsamplingScaleImageView) FailReason(com.nostra13.universalimageloader.core.assist.FailReason) GridView(android.widget.GridView) ImageView(android.widget.ImageView) SpoilerRobotoTextView(me.ccrama.redditslide.SpoilerRobotoTextView) SubmissionsView(me.ccrama.redditslide.Fragments.SubmissionsView) ExoVideoView(me.ccrama.redditslide.Views.ExoVideoView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) SubsamplingScaleImageView(me.ccrama.redditslide.Views.SubsamplingScaleImageView) Bitmap(android.graphics.Bitmap) SpoilerRobotoTextView(me.ccrama.redditslide.SpoilerRobotoTextView) TextView(android.widget.TextView) ImageView(android.widget.ImageView) SubsamplingScaleImageView(me.ccrama.redditslide.Views.SubsamplingScaleImageView) LinearLayout(android.widget.LinearLayout)

Example 3 with SubsamplingScaleImageView

use of me.ccrama.redditslide.Views.SubsamplingScaleImageView in project Slide by ccrama.

the class MediaFragment method displayImage.

public void displayImage(final String urlB) {
    final String url = StringEscapeUtils.unescapeHtml4(urlB);
    if (!imageShown) {
        actuallyLoaded = url;
        final SubsamplingScaleImageView i = rootView.findViewById(R.id.submission_image);
        i.setMinimumDpi(70);
        i.setMinimumTileDpi(240);
        final ProgressBar bar = rootView.findViewById(R.id.progress);
        bar.setIndeterminate(false);
        LogUtil.v("Displaying image " + url);
        bar.setProgress(0);
        final Handler handler = new Handler();
        final Runnable progressBarDelayRunner = new Runnable() {

            public void run() {
                bar.setVisibility(View.VISIBLE);
            }
        };
        handler.postDelayed(progressBarDelayRunner, 500);
        ImageView fakeImage = new ImageView(getActivity());
        fakeImage.setLayoutParams(new LinearLayout.LayoutParams(i.getWidth(), i.getHeight()));
        fakeImage.setScaleType(ImageView.ScaleType.CENTER_CROP);
        File f = ((Reddit) getActivity().getApplicationContext()).getImageLoader().getDiskCache().get(url);
        if (f != null && f.exists()) {
            imageShown = true;
            try {
                i.setImage(ImageSource.uri(f.getAbsolutePath()));
            } catch (Exception e) {
            // todo  i.setImage(ImageSource.bitmap(loadedImage));
            }
            (rootView.findViewById(R.id.progress)).setVisibility(View.GONE);
            handler.removeCallbacks(progressBarDelayRunner);
            previous = i.scale;
            final float base = i.scale;
            i.setOnStateChangedListener(new SubsamplingScaleImageView.DefaultOnStateChangedListener() {

                @Override
                public void onScaleChanged(float newScale, int origin) {
                    if (newScale > previous && !hidden && newScale > base) {
                        hidden = true;
                        final View base = rootView.findViewById(R.id.base);
                        ValueAnimator va = ValueAnimator.ofFloat(1.0f, 0.2f);
                        // in millis
                        int mDuration = 250;
                        va.setDuration(mDuration);
                        va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

                            public void onAnimationUpdate(ValueAnimator animation) {
                                Float value = (Float) animation.getAnimatedValue();
                                base.setAlpha(value);
                            }
                        });
                        va.start();
                    // hide
                    } else if (newScale <= previous && hidden) {
                        hidden = false;
                        final View base = rootView.findViewById(R.id.base);
                        ValueAnimator va = ValueAnimator.ofFloat(0.2f, 1.0f);
                        // in millis
                        int mDuration = 250;
                        va.setDuration(mDuration);
                        va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

                            public void onAnimationUpdate(ValueAnimator animation) {
                                Float value = (Float) animation.getAnimatedValue();
                                base.setAlpha(value);
                            }
                        });
                        va.start();
                    // unhide
                    }
                    previous = newScale;
                }
            });
        } else {
            ((Reddit) getActivity().getApplicationContext()).getImageLoader().displayImage(url, new ImageViewAware(fakeImage), new DisplayImageOptions.Builder().resetViewBeforeLoading(true).cacheOnDisk(true).imageScaleType(ImageScaleType.NONE).cacheInMemory(false).build(), new ImageLoadingListener() {

                @Override
                public void onLoadingStarted(String imageUri, View view) {
                    imageShown = true;
                }

                @Override
                public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
                    Log.v(LogUtil.getTag(), "LOADING FAILED");
                }

                @Override
                public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
                    imageShown = true;
                    File f = null;
                    if (getActivity() != null) {
                        f = ((Reddit) getActivity().getApplicationContext()).getImageLoader().getDiskCache().get(url);
                    }
                    if (f != null && f.exists()) {
                        i.setImage(ImageSource.uri(f.getAbsolutePath()));
                    } else {
                        i.setImage(ImageSource.bitmap(loadedImage));
                    }
                    (rootView.findViewById(R.id.progress)).setVisibility(View.GONE);
                    handler.removeCallbacks(progressBarDelayRunner);
                    previous = i.scale;
                    final float base = i.scale;
                    i.setOnStateChangedListener(new SubsamplingScaleImageView.DefaultOnStateChangedListener() {

                        @Override
                        public void onScaleChanged(float newScale, int origin) {
                            if (newScale > previous && !hidden && newScale > base) {
                                hidden = true;
                                final View base = rootView.findViewById(R.id.base);
                                ValueAnimator va = ValueAnimator.ofFloat(1.0f, 0.2f);
                                // in millis
                                int mDuration = 250;
                                va.setDuration(mDuration);
                                va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

                                    public void onAnimationUpdate(ValueAnimator animation) {
                                        Float value = (Float) animation.getAnimatedValue();
                                        base.setAlpha(value);
                                    }
                                });
                                va.start();
                            // hide
                            } else if (newScale <= previous && hidden) {
                                hidden = false;
                                final View base = rootView.findViewById(R.id.base);
                                ValueAnimator va = ValueAnimator.ofFloat(0.2f, 1.0f);
                                // in millis
                                int mDuration = 250;
                                va.setDuration(mDuration);
                                va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

                                    public void onAnimationUpdate(ValueAnimator animation) {
                                        Float value = (Float) animation.getAnimatedValue();
                                        base.setAlpha(value);
                                    }
                                });
                                va.start();
                            // unhide
                            }
                            previous = newScale;
                        }
                    });
                }

                @Override
                public void onLoadingCancelled(String imageUri, View view) {
                    Log.v(LogUtil.getTag(), "LOADING CANCELLED");
                }
            }, new ImageLoadingProgressListener() {

                @Override
                public void onProgressUpdate(String imageUri, View view, int current, int total) {
                    ((ProgressBar) rootView.findViewById(R.id.progress)).setProgress(Math.round(100.0f * current / total));
                }
            });
        }
    }
}
Also used : ImageLoadingProgressListener(com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener) FailReason(com.nostra13.universalimageloader.core.assist.FailReason) ValueAnimator(android.animation.ValueAnimator) Bitmap(android.graphics.Bitmap) Reddit(me.ccrama.redditslide.Reddit) ImageView(android.widget.ImageView) SubsamplingScaleImageView(me.ccrama.redditslide.Views.SubsamplingScaleImageView) ProgressBar(android.widget.ProgressBar) ImageViewAware(com.nostra13.universalimageloader.core.imageaware.ImageViewAware) ImageLoadingListener(com.nostra13.universalimageloader.core.listener.ImageLoadingListener) Handler(android.os.Handler) SubsamplingScaleImageView(me.ccrama.redditslide.Views.SubsamplingScaleImageView) MediaView(me.ccrama.redditslide.Activities.MediaView) ImageView(android.widget.ImageView) ExoVideoView(me.ccrama.redditslide.Views.ExoVideoView) View(android.view.View) SubsamplingScaleImageView(me.ccrama.redditslide.Views.SubsamplingScaleImageView) IOException(java.io.IOException) File(java.io.File) LinearLayout(android.widget.LinearLayout)

Example 4 with SubsamplingScaleImageView

use of me.ccrama.redditslide.Views.SubsamplingScaleImageView in project Slide by ccrama.

the class MediaFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = (ViewGroup) inflater.inflate(R.layout.submission_mediacard, container, false);
    if (savedInstanceState != null && savedInstanceState.containsKey("position")) {
        stopPosition = savedInstanceState.getLong("position");
    }
    PopulateShadowboxInfo.doActionbar(s, rootView, getActivity(), true);
    View thumbnailView = (rootView.findViewById(R.id.thumbimage2));
    thumbnailView.setVisibility(View.GONE);
    ImageView typeImage = rootView.findViewById(R.id.type);
    typeImage.setVisibility(View.VISIBLE);
    SubsamplingScaleImageView img = rootView.findViewById(R.id.submission_image);
    final SlidingUpPanelLayout slideLayout = rootView.findViewById(R.id.sliding_layout);
    ContentType.Type type = ContentType.getContentType(s);
    if (type == ContentType.Type.VREDDIT_REDIRECT || type == ContentType.Type.VREDDIT_DIRECT) {
        if ((!s.getDataNode().has("media") || !s.getDataNode().get("media").has("reddit_video")) && !s.getDataNode().has("crosspost_parent_list")) {
            type = ContentType.Type.LINK;
        }
    }
    img.setAlpha(1f);
    if (Strings.isNullOrEmpty(s.getThumbnail()) || Strings.isNullOrEmpty(firstUrl) || (s.isNsfw() && SettingValues.getIsNSFWEnabled())) {
        thumbnailView.setVisibility(View.VISIBLE);
        ((ImageView) thumbnailView).setImageResource(R.drawable.web);
        addClickFunctions(thumbnailView, slideLayout, rootView, type, getActivity(), s);
        addClickFunctions(typeImage, slideLayout, rootView, type, getActivity(), s);
        (rootView.findViewById(R.id.progress)).setVisibility(View.GONE);
        if ((s.isNsfw() && SettingValues.getIsNSFWEnabled())) {
            ((ImageView) thumbnailView).setImageResource(R.drawable.nsfw);
        } else {
            if (Strings.isNullOrEmpty(firstUrl) && !Strings.isNullOrEmpty(s.getThumbnail())) {
                ((Reddit) getContext().getApplicationContext()).getImageLoader().displayImage(s.getThumbnail(), ((ImageView) thumbnailView));
            }
        }
    } else {
        thumbnailView.setVisibility(View.GONE);
        addClickFunctions(img, slideLayout, rootView, type, getActivity(), s);
    }
    if (!s.isNsfw() || !SettingValues.getIsNSFWEnabled()) {
        if (type == ContentType.Type.EXTERNAL || type == ContentType.Type.LINK || type == ContentType.Type.VIDEO) {
            doLoad(firstUrl, type);
        } else {
            doLoad(contentUrl, type);
        }
    }
    switch(type) {
        case ALBUM:
        case REDDIT_GALLERY:
            typeImage.setImageResource(R.drawable.ic_photo_library);
            break;
        case EXTERNAL:
        case LINK:
        case REDDIT:
            typeImage.setImageResource(R.drawable.ic_public);
            rootView.findViewById(R.id.submission_image).setAlpha(0.5f);
            break;
        case SELF:
            typeImage.setImageResource(R.drawable.ic_text_fields);
            break;
        case EMBEDDED:
        case VIDEO:
            typeImage.setImageResource(R.drawable.ic_play_arrow);
            rootView.findViewById(R.id.submission_image).setAlpha(0.5f);
            break;
        default:
            typeImage.setVisibility(View.GONE);
            break;
    }
    rootView.findViewById(R.id.base).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent i2 = new Intent(getActivity(), CommentsScreen.class);
            i2.putExtra(CommentsScreen.EXTRA_PAGE, i);
            i2.putExtra(CommentsScreen.EXTRA_SUBREDDIT, sub);
            getActivity().startActivity(i2);
        }
    });
    final View.OnClickListener openClick = new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ((SlidingUpPanelLayout) rootView.findViewById(R.id.sliding_layout)).setPanelState(SlidingUpPanelLayout.PanelState.EXPANDED);
        }
    };
    rootView.findViewById(R.id.base).setOnClickListener(openClick);
    final View title = rootView.findViewById(R.id.title);
    title.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

        @Override
        public void onGlobalLayout() {
            slideLayout.setPanelHeight(title.getMeasuredHeight());
            title.getViewTreeObserver().removeOnGlobalLayoutListener(this);
        }
    });
    slideLayout.addPanelSlideListener(new SlidingUpPanelLayout.SimplePanelSlideListener() {

        @Override
        public void onPanelStateChanged(View panel, SlidingUpPanelLayout.PanelState previousState, SlidingUpPanelLayout.PanelState newState) {
            if (newState == SlidingUpPanelLayout.PanelState.EXPANDED) {
                rootView.findViewById(R.id.base).setOnClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        Intent i2 = new Intent(getActivity(), CommentsScreen.class);
                        i2.putExtra(CommentsScreen.EXTRA_PAGE, i);
                        i2.putExtra(CommentsScreen.EXTRA_SUBREDDIT, sub);
                        getActivity().startActivity(i2);
                    }
                });
            } else {
                rootView.findViewById(R.id.base).setOnClickListener(openClick);
            }
        }
    });
    return rootView;
}
Also used : CommentsScreen(me.ccrama.redditslide.Activities.CommentsScreen) SlidingUpPanelLayout(com.sothree.slidinguppanel.SlidingUpPanelLayout) ContentType(me.ccrama.redditslide.ContentType) SubsamplingScaleImageView(me.ccrama.redditslide.Views.SubsamplingScaleImageView) Intent(android.content.Intent) MediaView(me.ccrama.redditslide.Activities.MediaView) ImageView(android.widget.ImageView) ExoVideoView(me.ccrama.redditslide.Views.ExoVideoView) View(android.view.View) SubsamplingScaleImageView(me.ccrama.redditslide.Views.SubsamplingScaleImageView) ImageView(android.widget.ImageView) SubsamplingScaleImageView(me.ccrama.redditslide.Views.SubsamplingScaleImageView) ViewTreeObserver(android.view.ViewTreeObserver)

Example 5 with SubsamplingScaleImageView

use of me.ccrama.redditslide.Views.SubsamplingScaleImageView in project Slide by ccrama.

the class MediaView method onDestroy.

@Override
public void onDestroy() {
    super.onDestroy();
    ((SubsamplingScaleImageView) findViewById(R.id.submission_image)).recycle();
    if (gif != null) {
        gif.cancel();
        gif.cancel(true);
    }
    doOnClick = null;
    if (!didLoadGif && fileLoc != null && !fileLoc.isEmpty()) {
        new File(fileLoc).delete();
    }
}
Also used : SubsamplingScaleImageView(me.ccrama.redditslide.Views.SubsamplingScaleImageView) File(java.io.File)

Aggregations

SubsamplingScaleImageView (me.ccrama.redditslide.Views.SubsamplingScaleImageView)7 View (android.view.View)6 ImageView (android.widget.ImageView)6 ExoVideoView (me.ccrama.redditslide.Views.ExoVideoView)6 Bitmap (android.graphics.Bitmap)5 LinearLayout (android.widget.LinearLayout)5 FailReason (com.nostra13.universalimageloader.core.assist.FailReason)5 ImageViewAware (com.nostra13.universalimageloader.core.imageaware.ImageViewAware)5 ImageLoadingListener (com.nostra13.universalimageloader.core.listener.ImageLoadingListener)5 ImageLoadingProgressListener (com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener)5 File (java.io.File)4 ValueAnimator (android.animation.ValueAnimator)3 Handler (android.os.Handler)3 ProgressBar (android.widget.ProgressBar)3 TextView (android.widget.TextView)3 IOException (java.io.IOException)3 MediaView (me.ccrama.redditslide.Activities.MediaView)3 SubmissionsView (me.ccrama.redditslide.Fragments.SubmissionsView)3 Reddit (me.ccrama.redditslide.Reddit)3 AdapterView (android.widget.AdapterView)2