Example usage for android.widget ImageView getScaleType

List of usage examples for android.widget ImageView getScaleType

Introduction

In this page you can find the example usage for android.widget ImageView getScaleType.

Prototype

public ScaleType getScaleType() 

Source Link

Document

Returns the current ScaleType that is used to scale the bounds of an image to the bounds of the ImageView.

Usage

From source file:it.configure.imageloader.zoom.PhotoViewAttacher.java

private void checkImageViewScaleType() {
    ImageView imageView = getImageView();

    /**/*w w  w  .  j  a  v  a2  s . c  o m*/
     * PhotoView's getScaleType() will just divert to this.getScaleType() so
     * only call if we're not attached to a PhotoView.
     */
    if (null != imageView && !(imageView instanceof PhotoView)) {
        if (imageView.getScaleType() != ScaleType.MATRIX) {
            throw new IllegalStateException(
                    "The ImageView's ScaleType has been changed since attaching a PhotoViewAttacher");
        }
    }
}

From source file:uk.co.senab.photoview.PhotoViewAttacher.java

private void checkImageViewScaleType() {
    ImageView imageView = getImageView();

    /**// ww w . j a va2s .  c o m
     * PhotoView's getScaleType() will just divert to this.getScaleType() so
     * only call if we're not attached to a PhotoView.
     */
    if (null != imageView) {
        if (!ScaleType.MATRIX.equals(imageView.getScaleType())) {
            throw new IllegalStateException(
                    "The ImageView's ScaleType has been changed since attaching a PhotoViewAttacher. You should call setScaleType on the PhotoViewAttacher instead of on the ImageView");
        }
    }
}

From source file:com.yanzhenjie.album.widget.photoview.PhotoViewAttacher.java

private void checkImageViewScaleType() {
    ImageView imageView = getImageView();

    /**/* ww w . j a va2  s . c  o m*/
     * PhotoView's getScaleType() will just divert to this.getScaleType() so
     * only call if we're not attached to a PhotoView.
     */
    if (null != imageView && !(imageView instanceof IPhotoView)) {
        if (!ScaleType.MATRIX.equals(imageView.getScaleType())) {
            throw new IllegalStateException(
                    "The ImageView's ScaleType has been changed since attaching a PhotoViewAttacher. You should call "
                            + "setScaleType on the PhotoViewAttacher instead of on the ImageView");
        }
    }
}

From source file:com.android.volley.cache.SimpleImageLoader.java

public ImageContainer set(String requestUrl, ImageView imageView, Drawable placeHolder, int maxWidth,
        int maxHeight, Bitmap bitmap) {

    // Find any old image load request pending on this ImageView (in case this view was
    // recycled)/*from   w w  w .  ja v a 2  s. co  m*/
    ImageContainer imageContainer = imageView.getTag() != null && imageView.getTag() instanceof ImageContainer
            ? (ImageContainer) imageView.getTag()
            : null;

    // Find image url from prior request
    //String recycledImageUrl = imageContainer != null ? imageContainer.getRequestUrl() : null;

    if (imageContainer != null) {
        // Cancel previous image request
        imageContainer.cancelRequest();
        imageView.setTag(null);
    }
    if (requestUrl != null) {
        // Queue new request to fetch image
        imageContainer = set(requestUrl, getImageListener(getResources(), imageView, placeHolder, mFadeInImage),
                maxWidth, maxHeight, imageView.getScaleType(), bitmap);
        // Store request in ImageView tag
        imageView.setTag(imageContainer);
    } else {
        if (!(imageView instanceof PhotoView)) {
            imageView.setImageDrawable(placeHolder);
        }
        imageView.setTag(null);
    }

    return imageContainer;
}

From source file:com.cylan.jiafeigou.support.photoview.PhotoViewAttacher.java

private void checkImageViewScaleType() {
    ImageView imageView = getImageView();

    /**//from   w w w  . j ava2  s .  c o  m
     * PhotoView'account getScaleType() will just divert to this.getScaleType() so
     * only call if we're not attached to a PhotoView.
     */
    if (null != imageView && !(imageView instanceof IPhotoView)) {
        if (!ScaleType.MATRIX.equals(imageView.getScaleType())) {
            throw new IllegalStateException(
                    "The ImageView'account ScaleType has been changed since attaching a PhotoViewAttacher. You should call setScaleType on the PhotoViewAttacher instead of on the ImageView");
        }
    }
}

From source file:cn.golden.pinchzoomcanvasview.PinchZoomCanvasViewAttacher.java

private void checkImageViewScaleType() {
    ImageView imageView = getImageView();

    /**//w  w  w  . j  ava 2  s .c o  m
     * PhotoView's getScaleType() will just divert to this.getScaleType() so
     * only call if we're not attached to a PhotoView.
     */
    if (null != imageView && !(imageView instanceof IPhotoView)) {
        if (!ScaleType.MATRIX.equals(imageView.getScaleType())) {
            throw new IllegalStateException(
                    "The ImageView's ScaleType has been changed since attaching a PhotoViewAttacher");
        }
    }
}

From source file:baizhuan.hangzhou.com.gankcopy.view.customview.photoview.PhotoViewAttacher.java

private void checkImageViewScaleType() {
    ImageView imageView = getImageView();

    /**//from   w  w w. j av  a 2s  . com
     * PhotoView's getScaleType() will just divert to this.getScaleType() so
     * only call if we're not attached to a PhotoView.
     */
    if (null != imageView && !(imageView instanceof IPhotoView)) {
        if (!ScaleType.MATRIX.equals(imageView.getScaleType())) {
            throw new IllegalStateException(
                    "The ImageView's ScaleType has been changed since attaching a PhotoViewAttacher. You should call setScaleType on the PhotoViewAttacher instead of on the ImageView");
        }
    }
}

From source file:com.android.volley.cache.SimpleImageLoader.java

public ImageContainer get(String requestUrl, ImageView imageView, Drawable placeHolder, int maxWidth,
        int maxHeight) {

    // Find any old image load request pending on this ImageView (in case this view was
    // recycled)/*www.  j  a  va2s .  com*/
    ImageContainer imageContainer = imageView.getTag() != null && imageView.getTag() instanceof ImageContainer
            ? (ImageContainer) imageView.getTag()
            : null;

    // Find image url from prior request
    String recycledImageUrl = imageContainer != null ? imageContainer.getRequestUrl() : null;

    // If the new requestUrl is null or the new requestUrl is different to the previous
    // recycled requestUrl
    if (requestUrl == null || !requestUrl.equals(recycledImageUrl)) {
        if (imageContainer != null) {
            // Cancel previous image request
            imageContainer.cancelRequest();
            imageView.setTag(null);
        }
        if (requestUrl != null) {
            // Queue new request to fetch image
            imageContainer = get(requestUrl,
                    getImageListener(getResources(), imageView, placeHolder, mFadeInImage), maxWidth, maxHeight,
                    imageView.getScaleType());
            // Store request in ImageView tag
            imageView.setTag(imageContainer);
        } else {
            if (!(imageView instanceof PhotoView)) {
                imageView.setImageDrawable(placeHolder);
            }
            imageView.setTag(null);
        }
    }

    return imageContainer;
}