Java 类android.widget.ImageView.ScaleType 实例源码

项目:GCSApp    文件:PhotoViewAttacher.java   
private void checkImageViewScaleType() {
    ImageView imageView = getImageView();

    /**
     * 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");
        }
    }
}
项目:weex-3d-map    文件:WXImage.java   
private ScaleType getResizeMode(String resizeMode) {
    ScaleType scaleType = ScaleType.FIT_XY;
    if (TextUtils.isEmpty(resizeMode)) {
        return scaleType;
    }

    if (resizeMode.equals("cover")) {
        scaleType = ScaleType.CENTER_CROP;
    } else if (resizeMode.equals("contain")) {
        scaleType = ScaleType.FIT_CENTER;
    } else if (resizeMode.equals("stretch")) {
        scaleType = ScaleType.FIT_XY;
    } else if (resizeMode.equals("center")) {
        scaleType = ScaleType.CENTER;
    } else if (resizeMode.equals("start")) {
        scaleType = ScaleType.MATRIX;
    } else if (resizeMode.equals("end")) {
        scaleType = ScaleType.FIT_END;
    }
    return scaleType;
}
项目:Huochexing12306    文件:Shake2Share.java   
public void onCreate() {
    startSensor();

    int resId = getBitmapRes(activity, "ssdk_oks_yaoyiyao");
    if (resId > 0) {
        ImageView iv = new ImageView(activity);
        iv.setScaleType(ScaleType.CENTER_INSIDE);
        iv.setImageResource(resId);
        activity.setContentView(iv);
    }

    resId = getStringRes(activity, "shake2share");
    if (resId > 0) {
        Toast.makeText(activity, resId, Toast.LENGTH_SHORT).show();
    }
}
项目:sctalk    文件:RotateLoadingLayout.java   
public RotateLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) {
    super(context, mode, scrollDirection, attrs);

    mRotateDrawableWhilePulling = attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true);

    mHeaderImage.setScaleType(ScaleType.MATRIX);
    mHeaderImageMatrix = new Matrix();
    mHeaderImage.setImageMatrix(mHeaderImageMatrix);

    mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
            0.5f);
    mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
    mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
    mRotateAnimation.setRepeatCount(Animation.INFINITE);
    mRotateAnimation.setRepeatMode(Animation.RESTART);
}
项目:GitHub    文件:PhotoViewAttacher.java   
/**
 * Set's the ImageView's ScaleType to Matrix.
 */
private static void setImageViewScaleTypeMatrix(ImageView imageView) {
    if (null != imageView) {
        if (imageView instanceof PhotoView) {
            /**
             * PhotoView sets it's own ScaleType to Matrix, then diverts all
             * calls setScaleType to this.setScaleType. Basically we don't
             * need to do anything here
             */
            imageView.setScaleType(ScaleType.CENTER);
        } else {
            imageView.setScaleType(ScaleType.MATRIX);
        }
    }
}
项目:boohee_v5.6    文件:GoodsPostsFragment.java   
protected void addListener() {
    this.mHeaderView = new ImageView(getActivity());
    this.mHeaderView.setScaleType(ScaleType.CENTER_CROP);
    this.mHeaderView.setLayoutParams(new LayoutParams(-1, -2));
    ((ListView) this.mPullRefreshListView.getRefreshableView()).addHeaderView(this.mHeaderView);
    this.mAdapter = new HomeTimelineAdapter(getActivity(), this.mPosts);
    this.mPullRefreshListView.setAdapter(this.mAdapter);
    this.mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
        public void onRefresh(PullToRefreshBase<ListView> pullToRefreshBase) {
            GoodsPostsFragment.this.getCurrentTopic();
        }
    });
    this.mPullRefreshListView.setOnLastItemVisibleListener(new OnLastItemVisibleListener() {
        public void onLastItemVisible() {
            if (!GoodsPostsFragment.this.isLastVisible) {
                GoodsPostsFragment.this.getNextTopic();
            }
        }
    });
}
项目:encdroidMC    文件:PhotoViewAttacher.java   
private void checkImageViewScaleType() {
    ImageView imageView = getImageView();

    /**
     * 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");
        }
    }
}
项目:boohee_v5.6    文件:a.java   
protected final void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    Context context = getContext();
    View linearLayout = new LinearLayout(context);
    LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, a(context, (float) IntFloatWheelView.DEFAULT_VALUE));
    layoutParams.gravity = 17;
    linearLayout.setOrientation(0);
    linearLayout.setLayoutParams(layoutParams);
    Drawable gradientDrawable = new GradientDrawable();
    gradientDrawable.setColor(-450944201);
    gradientDrawable.setCornerRadius((float) a(context, 5.0f));
    linearLayout.setBackgroundDrawable(gradientDrawable);
    View imageView = new ImageView(context);
    layoutParams = new LinearLayout.LayoutParams(a(context, 20.0f), a(context, 20.0f));
    layoutParams.gravity = 16;
    layoutParams.setMargins(a(this.a.f, 17.0f), a(this.a.f, 10.0f), a(this.a.f, 8.0f), a(this.a.f, 10.0f));
    imageView.setLayoutParams(layoutParams);
    imageView.setScaleType(ScaleType.FIT_CENTER);
    imageView.setImageDrawable(a(context, a.d));
    Animation rotateAnimation = new RotateAnimation(0.0f, 359.0f, 1, 0.5f, 1, 0.5f);
    rotateAnimation.setRepeatCount(-1);
    rotateAnimation.setDuration(900);
    rotateAnimation.setInterpolator(new LinearInterpolator());
    imageView.startAnimation(rotateAnimation);
    View textView = new TextView(context);
    textView.setText(TextUtils.isEmpty(this.a.g) ? a.a : this.a.g);
    textView.setTextSize(16.0f);
    textView.setTextColor(-1);
    layoutParams = new LinearLayout.LayoutParams(-2, -2);
    layoutParams.gravity = 16;
    layoutParams.setMargins(0, 0, a(context, 17.0f), 0);
    textView.setLayoutParams(layoutParams);
    linearLayout.addView(imageView);
    linearLayout.addView(textView);
    setContentView(linearLayout);
    setCancelable(false);
}
项目:boohee_v5.6    文件:ImageLoader.java   
public ImageContainer get(String requestUrl, ImageListener imageListener, int maxWidth, int maxHeight, ScaleType scaleType) {
    throwIfNotOnMainThread();
    String cacheKey = getCacheKey(requestUrl, maxWidth, maxHeight, scaleType);
    Bitmap cachedBitmap = this.mCache.getBitmap(cacheKey);
    if (cachedBitmap != null) {
        ImageContainer container = new ImageContainer(cachedBitmap, requestUrl, null, null);
        imageListener.onResponse(container, true);
        return container;
    }
    ImageContainer imageContainer = new ImageContainer(null, requestUrl, cacheKey, imageListener);
    imageListener.onResponse(imageContainer, true);
    BatchedImageRequest request = (BatchedImageRequest) this.mInFlightRequests.get(cacheKey);
    if (request != null) {
        request.addContainer(imageContainer);
        return imageContainer;
    }
    Request<Bitmap> newRequest = makeImageRequest(requestUrl, maxWidth, maxHeight, scaleType, cacheKey);
    this.mRequestQueue.add(newRequest);
    this.mInFlightRequests.put(cacheKey, new BatchedImageRequest(newRequest, imageContainer));
    return imageContainer;
}
项目:boohee_v5.6    文件:a.java   
private View a(Context context) {
    View linearLayout = new LinearLayout(context);
    LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, a(context, (float) IntFloatWheelView.DEFAULT_VALUE));
    layoutParams.gravity = 17;
    linearLayout.setOrientation(0);
    linearLayout.setLayoutParams(layoutParams);
    Drawable gradientDrawable = new GradientDrawable();
    gradientDrawable.setColor(-450944201);
    gradientDrawable.setCornerRadius((float) a(context, 5.0f));
    linearLayout.setBackgroundDrawable(gradientDrawable);
    View imageView = new ImageView(context);
    layoutParams = new LinearLayout.LayoutParams(a(context, 20.0f), a(context, 20.0f));
    layoutParams.gravity = 16;
    layoutParams.setMargins(a(this.a.f, 17.0f), a(this.a.f, 10.0f), a(this.a.f, 8.0f), a(this.a.f, 10.0f));
    imageView.setLayoutParams(layoutParams);
    imageView.setScaleType(ScaleType.FIT_CENTER);
    imageView.setImageDrawable(a(context, a.d));
    Animation rotateAnimation = new RotateAnimation(0.0f, 359.0f, 1, 0.5f, 1, 0.5f);
    rotateAnimation.setRepeatCount(-1);
    rotateAnimation.setDuration(900);
    rotateAnimation.setInterpolator(new LinearInterpolator());
    imageView.startAnimation(rotateAnimation);
    View textView = new TextView(context);
    textView.setText(TextUtils.isEmpty(this.a.g) ? a.a : this.a.g);
    textView.setTextSize(16.0f);
    textView.setTextColor(-1);
    layoutParams = new LinearLayout.LayoutParams(-2, -2);
    layoutParams.gravity = 16;
    layoutParams.setMargins(0, 0, a(context, 17.0f), 0);
    textView.setLayoutParams(layoutParams);
    linearLayout.addView(imageView);
    linearLayout.addView(textView);
    return linearLayout;
}
项目:ultrasonic    文件:RotateLoadingLayout.java   
public RotateLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) {
    super(context, mode, scrollDirection, attrs);

    mRotateDrawableWhilePulling = attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true);

    mHeaderImage.setScaleType(ScaleType.MATRIX);
    mHeaderImageMatrix = new Matrix();
    mHeaderImage.setImageMatrix(mHeaderImageMatrix);

    mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
            0.5f);
    mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
    mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
    mRotateAnimation.setRepeatCount(Animation.INFINITE);
    mRotateAnimation.setRepeatMode(Animation.RESTART);
}
项目:boohee_v5.6    文件:SelectableRoundedImageView.java   
private void adjustCanvasForBorder(Canvas canvas) {
    float[] values = new float[9];
    canvas.getMatrix().getValues(values);
    float scaleFactorX = values[0];
    float scaleFactorY = values[4];
    float translateX = values[2];
    float translateY = values[5];
    float newScaleX = this.mBounds.width() / ((this.mBounds.width() + this.mBorderWidth)
            + this.mBorderWidth);
    float newScaleY = this.mBounds.height() / ((this.mBounds.height() + this
            .mBorderWidth) + this.mBorderWidth);
    canvas.scale(newScaleX, newScaleY);
    if (ScaleType.FIT_START == this.mScaleType || ScaleType.FIT_END == this.mScaleType ||
            ScaleType.FIT_XY == this.mScaleType || ScaleType.FIT_CENTER == this
            .mScaleType || ScaleType.CENTER_INSIDE == this.mScaleType || ScaleType.MATRIX
            == this.mScaleType) {
        canvas.translate(this.mBorderWidth, this.mBorderWidth);
    } else if (ScaleType.CENTER == this.mScaleType || ScaleType.CENTER_CROP == this
            .mScaleType) {
        canvas.translate((-translateX) / (newScaleX * scaleFactorX), (-translateY) /
                (newScaleY * scaleFactorY));
        canvas.translate(-(this.mBounds.left - this.mBorderWidth), -(this.mBounds.top -
                this.mBorderWidth));
    }
}
项目:Huochexing12306    文件:PicViewer.java   
public void onCreate() {
    ivViewer = new ImageView(activity);
    ivViewer.setScaleType(ScaleType.CENTER_INSIDE);
    ivViewer.setBackgroundColor(0xc0000000);
    ivViewer.setOnClickListener(this);
    activity.setContentView(ivViewer);
    if (pic != null && !pic.isRecycled()) {
        ivViewer.setImageBitmap(pic);
    }
}
项目:ywApplication    文件:RotateLoadingLayout.java   
public RotateLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) {
    super(context, mode, scrollDirection, attrs);

    mRotateDrawableWhilePulling = attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true);

    mHeaderImage.setScaleType(ScaleType.MATRIX);
    mHeaderImageMatrix = new Matrix();
    mHeaderImage.setImageMatrix(mHeaderImageMatrix);

    mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
            0.5f);
    mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
    mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
    mRotateAnimation.setRepeatCount(Animation.INFINITE);
    mRotateAnimation.setRepeatMode(Animation.RESTART);
}
项目:letv    文件:RoundedImageView.java   
public void setScaleType(ScaleType scaleType) {
    if (!$assertionsDisabled && scaleType == null) {
        throw new AssertionError();
    } else if (this.mScaleType != scaleType) {
        this.mScaleType = scaleType;
        switch (1.$SwitchMap$android$widget$ImageView$ScaleType[scaleType.ordinal()]) {
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
                super.setScaleType(ScaleType.FIT_XY);
                break;
            default:
                super.setScaleType(scaleType);
                break;
        }
        updateDrawableAttrs();
        updateBackgroundDrawableAttrs(false);
        invalidate();
    }
}
项目:boohee_v5.6    文件:ChannelPostsActivity.java   
private void findViews() {
    this.fab_button = (FloatingActionButton) findViewById(R.id.fab_button);
    this.fab_button.setVisibility(8);
    this.mHeaderView = new ImageView(this);
    this.mHeaderView.setScaleType(ScaleType.CENTER_CROP);
    this.mHeaderView.setLayoutParams(new LayoutParams(-1, -2));
    this.mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.listview);
    this.mListView = (ListView) this.mPullRefreshListView.getRefreshableView();
    this.mListView.addHeaderView(this.mHeaderView);
    this.mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
        public void onRefresh(PullToRefreshBase<ListView> pullToRefreshBase) {
            ChannelPostsActivity.this.getCurrentTopic();
        }
    });
    this.mPullRefreshListView.setOnLastItemVisibleListener(new OnLastItemVisibleListener() {
        public void onLastItemVisible() {
            if (!ChannelPostsActivity.this.isLastVisible) {
                ChannelPostsActivity.this.getNextTopic();
            }
        }
    });
}
项目:oma-riista-android    文件:DiaryImageManager.java   
/**
 * Adds new image to container view
 *
 * @param logImage LogImage object, if null, adds new image indicator instead
 * @param index    Image index
 */
private void addImage(LogImage logImage, int index) {
    WebImageView imageView = new WebImageView(mWorkContext.getContext());
    DiaryImage diaryImage = new DiaryImage(imageView);
    diaryImage.index = index;
    if (logImage != null) {
        changeImage(diaryImage, logImage);
    } else {
        mAddButton = imageView;
        imageView.setImageDrawable(mWorkContext.getContext().getResources().getDrawable(R.drawable.ic_camera));
        imageView.setBackgroundResource(R.drawable.bg_image_button);
    }
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams((int) mWorkContext.getContext().getResources().getDimension(R.dimen.logimage_size),
            (int) mWorkContext.getContext().getResources().getDimension(R.dimen.logimage_size));
    imageView.setLayoutParams(layoutParams);
    imageView.setScaleType(ScaleType.CENTER_CROP);
    mContainerView.addView(imageView);
    mDiaryImages.add(diaryImage);
    setupImageEdit(diaryImage, imageView, index);
}
项目:Hotspot-master-devp    文件:FlipLoadingLayout.java   
@Override
protected void onLoadingDrawableSet(Drawable imageDrawable) {
    if (null != imageDrawable) {
        final int dHeight = imageDrawable.getIntrinsicHeight();
        final int dWidth = imageDrawable.getIntrinsicWidth();

        /**
         * We need to set the width/height of the ImageView so that it is
         * square with each side the size of the largest drawable dimension.
         * This is so that it doesn't clip when rotated.
         */
        ViewGroup.LayoutParams lp = mHeaderImage.getLayoutParams();
        lp.width = lp.height = Math.max(dHeight, dWidth);
        mHeaderImage.requestLayout();

        /**
         * We now rotate the Drawable so that is at the correct rotation,
         * and is centered.
         */
        mHeaderImage.setScaleType(ScaleType.MATRIX);
        Matrix matrix = new Matrix();
        matrix.postTranslate((lp.width - dWidth) / 2f, (lp.height - dHeight) / 2f);
        matrix.postRotate(getDrawableRotationAngle(), lp.width / 2f, lp.height / 2f);
        mHeaderImage.setImageMatrix(matrix);
    }
}
项目:boohee_v5.6    文件:SharedElementCallback.java   
public Parcelable onCaptureSharedElementSnapshot(View sharedElement, Matrix viewToGlobalMatrix, RectF screenBounds) {
    Bitmap bitmap;
    if (sharedElement instanceof ImageView) {
        ImageView imageView = (ImageView) sharedElement;
        Drawable d = imageView.getDrawable();
        Drawable bg = imageView.getBackground();
        if (d != null && bg == null) {
            bitmap = createDrawableBitmap(d);
            if (bitmap != null) {
                Bundle bundle = new Bundle();
                bundle.putParcelable(BUNDLE_SNAPSHOT_BITMAP, bitmap);
                bundle.putString(BUNDLE_SNAPSHOT_IMAGE_SCALETYPE, imageView.getScaleType().toString());
                if (imageView.getScaleType() != ScaleType.MATRIX) {
                    return bundle;
                }
                float[] values = new float[9];
                imageView.getImageMatrix().getValues(values);
                bundle.putFloatArray(BUNDLE_SNAPSHOT_IMAGE_MATRIX, values);
                return bundle;
            }
        }
    }
    int bitmapWidth = Math.round(screenBounds.width());
    int bitmapHeight = Math.round(screenBounds.height());
    bitmap = null;
    if (bitmapWidth > 0 && bitmapHeight > 0) {
        float scale = Math.min(1.0f, ((float) MAX_IMAGE_SIZE) / ((float) (bitmapWidth * bitmapHeight)));
        bitmapWidth = (int) (((float) bitmapWidth) * scale);
        bitmapHeight = (int) (((float) bitmapHeight) * scale);
        if (this.mTempMatrix == null) {
            this.mTempMatrix = new Matrix();
        }
        this.mTempMatrix.set(viewToGlobalMatrix);
        this.mTempMatrix.postTranslate(-screenBounds.left, -screenBounds.top);
        this.mTempMatrix.postScale(scale, scale);
        bitmap = Bitmap.createBitmap(bitmapWidth, bitmapHeight, Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        canvas.concat(this.mTempMatrix);
        sharedElement.draw(canvas);
    }
    return bitmap;
}
项目:PicShow-zhaipin    文件:PhotoViewAttacher.java   
/**
 * Set's the ImageView's ScaleType to Matrix.
 */
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);
        }
    }
}
项目:DailyStudy    文件:PhotoViewAttacher.java   
/**
 * Set's the ImageView's ScaleType to Matrix.
 */
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);
        }
    }
}
项目:GitHub    文件:Banner.java   
private void setScaleType(View imageView) {
    if (imageView instanceof ImageView) {
        ImageView view = ((ImageView) imageView);
        switch (scaleType) {
            case 0:
                view.setScaleType(ScaleType.CENTER);
                break;
            case 1:
                view.setScaleType(ScaleType.CENTER_CROP);
                break;
            case 2:
                view.setScaleType(ScaleType.CENTER_INSIDE);
                break;
            case 3:
                view.setScaleType(ScaleType.FIT_CENTER);
                break;
            case 4:
                view.setScaleType(ScaleType.FIT_END);
                break;
            case 5:
                view.setScaleType(ScaleType.FIT_START);
                break;
            case 6:
                view.setScaleType(ScaleType.FIT_XY);
                break;
            case 7:
                view.setScaleType(ScaleType.MATRIX);
                break;
        }

    }
}
项目:PicShow-zhaipin    文件:PhotoViewAttacher.java   
private void checkImageViewScaleType() {
    ImageView imageView = getImageView();

    /**
     * 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");
        }
    }
}
项目:GitHub    文件:ImageLoader.java   
protected Request<Bitmap> makeImageRequest(String requestUrl, int maxWidth, int maxHeight,
        ScaleType scaleType, final String cacheKey) {
    return new ImageRequest(requestUrl, new Listener<Bitmap>() {
        @Override
        public void onResponse(Bitmap response) {
            onGetImageSuccess(cacheKey, response);
        }
    }, maxWidth, maxHeight, scaleType, Config.RGB_565, new ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            onGetImageError(cacheKey, error);
        }
    });
}
项目:tvConnect_android    文件:PhotoViewAttacher.java   
/**
 * @return true if the ScaleType is supported.
 */
private static boolean isSupportedScaleType(final ScaleType scaleType) {
    if (null == scaleType) {
        return false;
    }

    switch (scaleType) {
        case MATRIX:
            throw new IllegalArgumentException(scaleType.name()
                    + " is not supported in PhotoView");

        default:
            return true;
    }
}
项目:AvatarView    文件:RoundedDrawable.java   
public RoundedDrawable setScaleType(ScaleType scaleType) {
    if (scaleType == null) {
        scaleType = ScaleType.FIT_CENTER;
    }
    if (mScaleType != scaleType) {
        mScaleType = scaleType;
        updateShaderMatrix();
    }
    return this;
}
项目:GitHub    文件:PhotoViewAttacher.java   
/**
 * @return true if the ScaleType is supported.
 */
private static boolean isSupportedScaleType(final ScaleType scaleType) {
    if (null == scaleType) {
        return false;
    }

    switch (scaleType) {
    case MATRIX:
        throw new IllegalArgumentException(scaleType.name()
                + " is not supported in PhotoView");

    default:
        return true;
    }
}
项目:boohee_v5.6    文件:BooheeAdvertisementBanner.java   
private void initView() {
    LayoutParams imageLP = new LayoutParams(-1, -1, 17);
    this.imageView = new ImageView(getContext());
    this.imageView.setVisibility(4);
    this.imageView.setScaleType(ScaleType.FIT_CENTER);
    addView(this.imageView, imageLP);
    LayoutParams closeLP = new LayoutParams(DensityUtil.dip2px(getContext(), 44.0f),
            DensityUtil.dip2px(getContext(), 44.0f));
    closeLP.gravity = 21;
    this.closeBtn = new Button(getContext());
    this.closeBtn.setBackgroundResource(R.drawable.l7);
    this.closeBtn.setVisibility(4);
    addView(this.closeBtn, closeLP);
}
项目:GitHub    文件:PhotoViewAttacher.java   
@Override
public final void setScaleType(ScaleType scaleType) {
    if (isSupportedScaleType(scaleType) && scaleType != mScaleType) {
        mScaleType = scaleType;

        // Finally update
        update();
    }
}
项目:ucar-weex-core    文件:WXImage.java   
@Override
protected ImageView initComponentHostView(@NonNull Context context) {
  WXImageView view = new WXImageView(context);
  view.setScaleType(ScaleType.FIT_XY);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
    view.setCropToPadding(true);
  }
  view.holdComponent(this);
  return view;
}
项目:CXJPadProject    文件:PhotoViewAttacher.java   
/**
 * Set's the ImageView's ScaleType to Matrix.
 */
private static void setImageViewScaleTypeMatrix(ImageView imageView) {
    if (null != imageView) {
        if (imageView instanceof PhotoView) {
            /**
             * PhotoView sets it's own ScaleType to Matrix, then diverts all
             * calls setScaleType to this.setScaleType. Basically we don't
             * need to do anything here
             */
        } else {
            imageView.setScaleType(ScaleType.MATRIX);
        }
    }
}
项目:letv    文件:AlbumPlayActivity.java   
private void init() {
    int i = 8;
    this.mTask = new AlbumTaskRegister(this);
    this.mBackgroundView = (ImageView) getViewById(R.id.album_loading_bg);
    this.mBackgroundView.setTag(R.id.scale_type, ScaleType.CENTER_CROP);
    this.mBottomFrame = (FrameLayout) getViewById(R.id.play_album_bottom_frame);
    this.mFloatFrame = (FrameLayout) getViewById(R.id.layout_album_float_frame);
    this.mAlbumPlayFragment = new AlbumPlayFragment(this);
    this.mVideoController = new AlbumVideoController(this, getViewById(R.id.player_full_controller_contain));
    this.mHalfFragment = new AlbumHalfFragment(this);
    this.mHalfFragment.onCreate(null);
    LeMessageManager.getInstance().dispatchMessage(this, new LeMessage(801));
    this.mPlayObservable = new PlayObservable(this);
    this.mGestureController = new AlbumGestureController(this, this.mAlbumPlayFragment, this.mGestureObservable);
    this.mPlayAdController = new AlbumPlayAdController(this);
    this.mVipTrailController = new AlbumPlayGeneralTrailController(this);
    this.mPlayNextController = new AlbumPlayNextController(this, PlayerType.MAIN);
    this.mRedPacketController = new AlbumRedPacketController(this);
    this.mBlockController = new AlbumBlockController();
    this.mController = new AlbumController(this);
    this.mTopController = new AlbumErrorTopController(this);
    this.mNetChangeController = new AlbumNetChangeController(this);
    this.mRecommendController = new AlbumRecommendController(this);
    this.mLongWatchController = new LongWatchController(this);
    this.mLoadController = new AlbumLoadController(this, this.mBottomFrame);
    this.mMidAdTipController = new AlbumMidAdController(this);
    this.rootView = (AlbumPlayContainView) getViewById(R.id.play_album_parent_view);
    this.rootView.setLongWatchController(this.mLongWatchController);
    getSupportFragmentManager().beginTransaction().add(R.id.play_album_ad_contain, this.mPlayAdController.getAdFragment()).commitAllowingStateLoss();
    getViewById(R.id.play_album_half_frame).setVisibility(this.mIsPlayingNonCopyright ? 8 : 0);
    View viewById = getViewById(R.id.play_album_toolbar);
    if (!this.mIsPlayingNonCopyright) {
        i = 0;
    }
    viewById.setVisibility(i);
    if (this.mIsPlayingNonCopyright) {
        initWebView();
    }
    checkDrmPlugin(false);
}
项目:shareNote    文件:RoundedDrawable.java   
public RoundedDrawable setScaleType(ScaleType scaleType) {
  if (scaleType == null) {
    scaleType = ScaleType.FIT_CENTER;
  }
  if (mScaleType != scaleType) {
    mScaleType = scaleType;
    updateShaderMatrix();
  }
  return this;
}
项目:GitHub    文件:Banner.java   
private void setScaleType(View imageView) {
    if (imageView instanceof ImageView) {
        ImageView view = ((ImageView) imageView);
        switch (scaleType) {
            case 0:
                view.setScaleType(ScaleType.CENTER);
                break;
            case 1:
                view.setScaleType(ScaleType.CENTER_CROP);
                break;
            case 2:
                view.setScaleType(ScaleType.CENTER_INSIDE);
                break;
            case 3:
                view.setScaleType(ScaleType.FIT_CENTER);
                break;
            case 4:
                view.setScaleType(ScaleType.FIT_END);
                break;
            case 5:
                view.setScaleType(ScaleType.FIT_START);
                break;
            case 6:
                view.setScaleType(ScaleType.FIT_XY);
                break;
            case 7:
                view.setScaleType(ScaleType.MATRIX);
                break;
        }

    }
}
项目:TextEmoji    文件:PicViewerPage.java   
public void onCreate() {
    activity.getWindow().setBackgroundDrawable(new ColorDrawable(0x4c000000));

    sivViewer = new ScaledImageView(activity);
    sivViewer.setScaleType(ScaleType.MATRIX);
    activity.setContentView(sivViewer);
    if (pic != null) {
        sivViewer.getViewTreeObserver().addOnGlobalLayoutListener(this);
    }
}
项目:tvConnect_android    文件:PhotoViewAttacher.java   
private void checkImageViewScaleType() {
    ImageView imageView = getImageView();

    /**
     * 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");
        }
    }
}
项目:boohee_v5.6    文件:PopSubView.java   
private void init(Context context) {
    setGravity(17);
    setOrientation(1);
    this.icon = new ImageView(context);
    this.icon.setScaleType(ScaleType.CENTER_INSIDE);
    addView(this.icon, new LayoutParams(-2, -2));
    this.textView = new TextView(context);
    LayoutParams tvLp = new LayoutParams(-1, -2);
    this.textView.setMaxLines(1);
    this.textView.setTextSize(12.0f);
    this.textView.setGravity(17);
    tvLp.topMargin = DensityUtil.dip2px(context, 8.0f);
    addView(this.textView, tvLp);
    setOnTouchListener(new OnTouchListener() {
        public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
                case 0:
                    PopSubView.this.scaleViewAnimation(PopSubView.this, PopSubView.factor);
                    break;
                case 1:
                    PopSubView.this.scaleViewAnimation(PopSubView.this, 1.0f);
                    break;
            }
            return false;
        }
    });
}
项目:boohee_v5.6    文件:Shake2Share.java   
public void onCreate() {
    startSensor();
    int resId = R.getBitmapRes(this.activity, "ssdk_oks_yaoyiyao");
    if (resId > 0) {
        ImageView iv = new ImageView(this.activity);
        iv.setScaleType(ScaleType.CENTER_INSIDE);
        iv.setImageResource(resId);
        this.activity.setContentView(iv);
    }
    resId = R.getStringRes(this.activity, "shake2share");
    if (resId > 0) {
        Toast.makeText(this.activity, resId, 0).show();
    }
}
项目:atlant-android    文件:PicassoTargetUtils.java   
private void createTarget() {
  target = new Target() {
    @Override
    public void onBitmapLoaded(Bitmap bitmap, LoadedFrom from) {
      materialProgressBar.setVisibility(View.INVISIBLE);
      imageView.setScaleType(ScaleType.CENTER_CROP);
      imageView.setColor(Color.TRANSPARENT);
      imageView.setImageBitmap(bitmap);
      imageView.invalidate();
      if (callBack != null) {
        callBack.onBitmapLoaded();
      }
    }

    @Override
    public void onBitmapFailed(Drawable errorDrawable) {
      materialProgressBar.setVisibility(View.INVISIBLE);
      imageView.setScaleType(ScaleType.CENTER_INSIDE);
      imageView.setImageDrawable(errorDrawable);
      if (callBack != null) {
        callBack.onBitmapFailed();
      }
    }

    @Override
    public void onPrepareLoad(Drawable placeHolderDrawable) {
      if (callBack != null) {
        callBack.onPrepareLoad();
      }
    }
  };
}
项目:filepicker    文件:PhotoViewAttacher.java   
@Override
public final void setScaleType(ScaleType scaleType) {
    if (isSupportedScaleType(scaleType) && scaleType != mScaleType) {
        mScaleType = scaleType;

        // Finally addOrUpdate
        update();
    }
}