java类android.widget.ImageView.ScaleType的实例源码

PhotoViewAttacher.java 文件源码 项目:CXJPadProject 阅读 32 收藏 0 点赞 0 评论 0
/**
 * 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);
        }
    }
}
AlbumPlayActivity.java 文件源码 项目:letv 阅读 23 收藏 0 点赞 0 评论 0
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);
}
RoundedDrawable.java 文件源码 项目:shareNote 阅读 34 收藏 0 点赞 0 评论 0
public RoundedDrawable setScaleType(ScaleType scaleType) {
  if (scaleType == null) {
    scaleType = ScaleType.FIT_CENTER;
  }
  if (mScaleType != scaleType) {
    mScaleType = scaleType;
    updateShaderMatrix();
  }
  return this;
}
Banner.java 文件源码 项目:GitHub 阅读 30 收藏 0 点赞 0 评论 0
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;
        }

    }
}
PicViewerPage.java 文件源码 项目:TextEmoji 阅读 25 收藏 0 点赞 0 评论 0
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);
    }
}
PhotoViewAttacher.java 文件源码 项目:tvConnect_android 阅读 23 收藏 0 点赞 0 评论 0
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");
        }
    }
}
PopSubView.java 文件源码 项目:boohee_v5.6 阅读 18 收藏 0 点赞 0 评论 0
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;
        }
    });
}
Shake2Share.java 文件源码 项目:boohee_v5.6 阅读 23 收藏 0 点赞 0 评论 0
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();
    }
}
PicassoTargetUtils.java 文件源码 项目:atlant-android 阅读 22 收藏 0 点赞 0 评论 0
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();
      }
    }
  };
}
PhotoViewAttacher.java 文件源码 项目:filepicker 阅读 23 收藏 0 点赞 0 评论 0
@Override
public final void setScaleType(ScaleType scaleType) {
    if (isSupportedScaleType(scaleType) && scaleType != mScaleType) {
        mScaleType = scaleType;

        // Finally addOrUpdate
        update();
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号