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:android.support.v17.leanback.widget.DetailsOverviewSharedElementHelper.java

private void saveImageViewScale() {
    if (mSavedScaleType == null) {
        // only save first time after initialize/restoreImageViewScale()
        ImageView imageView = mViewHolder.mImageView;
        mSavedScaleType = imageView.getScaleType();
        mSavedMatrix = mSavedScaleType == ScaleType.MATRIX ? imageView.getMatrix() : null;
        if (DEBUG) {
            Log.d(TAG, "saveImageViewScale: " + mSavedScaleType);
        }/*from   w  ww . j  ava 2  s  . c  o m*/
    }
}

From source file:my.home.lehome.asynctask.LoadProfileHeaderBgAsyncTask.java

@Override
protected void onPreExecute() {
    ImageView imageView = mImageView.get();
    if (imageView != null) {
        imageView.setImageURI(null);//w  w  w.j  a  va2s . c  o  m
        this.mWidth = imageView.getWidth();
        this.mHeight = imageView.getHeight();
        this.mScaleType = imageView.getScaleType();
    }
    ProgressBar progressBar = mProgressBar.get();
    if (progressBar != null) {
        progressBar.setVisibility(View.VISIBLE);
    }
}

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

/**
 * Set's the ImageView's ScaleType to Matrix.
 *//*  w w  w.  j  a va2  s .  c o m*/
private static void setImageViewScaleTypeMatrix(ImageView imageView) {
    /**
     * PhotoView sets it's own ScaleType to Matrix, then diverts all calls
     * setScaleType to this.setScaleType automatically.
     */
    if (null != imageView) {
        if (!ScaleType.MATRIX.equals(imageView.getScaleType())) {
            imageView.setScaleType(ScaleType.MATRIX);
        }
    }
}

From source file:com.landenlabs.all_UiDemo.frag.ImageScalesFrag.java

private void setImage(int imageRes) {
    for (int idx = 0; idx < mImageHolder.getChildCount(); idx++) {
        View view = mImageHolder.getChildAt(idx);
        if (view instanceof ImageView) {
            ImageView imageView = (ImageView) view;
            if (imageView.getScaleType() != ImageView.ScaleType.MATRIX) {
                setImage(imageView, imageRes);
            }/*from  w w w  .j a v a2  s  .c  om*/
        } else if (view instanceof ViewGroup) {
            ViewGroup viewGroup = (ViewGroup) view;
            for (int childIdx = 0; childIdx != viewGroup.getChildCount(); childIdx++) {
                View child = viewGroup.getChildAt(childIdx);
                if (child instanceof ImageView) {
                    ImageView imageView = (ImageView) child;
                    if (imageView.getScaleType() != ImageView.ScaleType.MATRIX) {
                        setImage(imageView, imageRes);
                    }
                }
            }
        }
    }

    mPrevBm1 = fillUpperLeft(getDrawable(imageRes), mUpperLeftFill, mPrevBm1);
    mPrevBm2 = fillLowerLeft(getDrawable(imageRes), mLowerLeftFill, mPrevBm2);
    mPrevBm3 = setScaledImage(getDrawable(imageRes), mCenterFill, mPrevBm3);
}

From source file:android.support.v17.leanback.widget.DetailsOverviewSharedElementHelper.java

private void changeImageViewScale(View snapshotView) {
    ImageView snapshotImageView = (ImageView) snapshotView;
    ImageView imageView = mViewHolder.mImageView;
    if (DEBUG) {/*from w w w. j a  v  a2 s  .c  om*/
        Log.d(TAG, "changeImageViewScale to " + snapshotImageView.getScaleType());
    }
    imageView.setScaleType(snapshotImageView.getScaleType());
    if (snapshotImageView.getScaleType() == ScaleType.MATRIX) {
        imageView.setImageMatrix(snapshotImageView.getImageMatrix());
    }
    updateImageViewAfterScaleTypeChange(imageView);
}

From source file:com.example.imagegallerydemo.photoview.PhotoViewAttacher.java

/**
 * Sets the ImageView's ScaleType to Matrix.
 *//*  w w  w  . ja v a 2s  .  c  o m*/
private static void setImageViewScaleTypeMatrix(ImageView imageView) {
    /**
     * PhotoView sets its own ScaleType to Matrix, then diverts all calls
     * setScaleType to this.setScaleType automatically.
     */
    if (null != imageView && !(imageView instanceof IPhotoView)) {
        if (!ScaleType.MATRIX.equals(imageView.getScaleType())) {
            imageView.setScaleType(ScaleType.MATRIX);
        }
    }
}

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

/**
 * Set'account the ImageView'account ScaleType to Matrix.
 *//*  ww w  . ja  v  a  2s  .  com*/
private static void setImageViewScaleTypeMatrix(ImageView imageView) {
    /**
     * PhotoView sets it'account own ScaleType to Matrix, then diverts all calls
     * setScaleType to this.setScaleType automatically.
     */
    if (null != imageView && !(imageView instanceof IPhotoView)) {
        if (!ScaleType.MATRIX.equals(imageView.getScaleType())) {
            imageView.setScaleType(ScaleType.MATRIX);
        }
    }
}

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

/**
 * Set's the ImageView's ScaleType to Matrix.
 *//*from   www  . j ava 2  s  . com*/
private static void setImageViewScaleTypeMatrix(ImageView imageView) {
    /**
     * PhotoView sets it's own ScaleType to Matrix, then diverts all calls
     * setScaleType to this.setScaleType automatically.
     */
    if (null != imageView && !(imageView instanceof IPhotoView)) {
        if (!ScaleType.MATRIX.equals(imageView.getScaleType())) {
            imageView.setScaleType(ScaleType.MATRIX);
        }
    }
}

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

public void invalidate(String key, ImageView view) {
    final String cacheKey = getCacheKey(key, mMaxImageWidth, mMaxImageHeight, view.getScaleType());
    getImageCache().invalidateBitmap(cacheKey);
    getCache().invalidate(key, true);/*w w  w . j a  v a2s  .c  om*/
    //default cache
    invalidate(key);
}

From source file:com.fuzz.indicator.CutoutViewIndicator.java

/**
 * Call this when a View has been added to this (via {@link #addView}), to display any
 * warnings or errors due to misuse of the {@link CutoutCell}.....contract.
 *
 * @param child    the child view in question
 * @param cell     that child's CutoutCell (usually accessible through its LayoutParams)
 *///from   w  w  w  .ja v a  2  s.  c om
public void warnAboutMisuseOf(ImageView child, CutoutCell cell) {
    if (cell.getClass() == CutoutImageCell.class && child.getScaleType() != ImageView.ScaleType.MATRIX) {
        String tag = "resources.insufficient";
        String message = "Only child ImageViews with a MATRIX scaleType are respected by"
                + " your choice of CutoutCell. Offset effects will not appear properly on" + " ScaleType "
                + child.getScaleType() + ".";
        logger.logToLayoutLib(tag, message);
    }
}