android.graphics.Matrix#equals ( )源码实例Demo

下面列出了android.graphics.Matrix#equals ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: DanDanPlayForAndroid   文件: ImageViewTouchBase.java
@Override
public void setImageMatrix( Matrix matrix ) {

	Matrix current = getImageMatrix();
	boolean needUpdate = false;
	
	if ( matrix == null && !current.isIdentity() || matrix != null && !current.equals( matrix ) ) {
		needUpdate = true;
	}
	
	super.setImageMatrix( matrix );
	
	if ( needUpdate ) onImageMatrixChanged();
}
 
源代码2 项目: FlickableView   文件: ImageViewTouchBase.java
@Override
public void setImageMatrix(Matrix matrix) {
    Matrix current = getImageMatrix();
    boolean needUpdate = false;

    if (matrix == null && !current.isIdentity() || matrix != null && !current.equals(matrix)) {
        needUpdate = true;
    }

    super.setImageMatrix(matrix);
    if (needUpdate) {
        onImageMatrixChanged();
    }
}
 
源代码3 项目: Klyph   文件: ImageViewTouchBase.java
@Override
public void setImageMatrix( Matrix matrix ) {

	Matrix current = getImageMatrix();
	boolean needUpdate = false;
	
	if ( matrix == null && !current.isIdentity() || matrix != null && !current.equals( matrix ) ) {
		needUpdate = true;
	}
	
	super.setImageMatrix( matrix );
	
	if ( needUpdate ) onImageMatrixChanged();
}
 
源代码4 项目: android_9.0.0_r45   文件: ChangeImageTransform.java
/**
 * Creates an Animator for ImageViews moving, changing dimensions, and/or changing
 * {@link android.widget.ImageView.ScaleType}.
 *
 * @param sceneRoot   The root of the transition hierarchy.
 * @param startValues The values for a specific target in the start scene.
 * @param endValues   The values for the target in the end scene.
 * @return An Animator to move an ImageView or null if the View is not an ImageView,
 * the Drawable changed, the View is not VISIBLE, or there was no change.
 */
@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues,
        TransitionValues endValues) {
    if (startValues == null || endValues == null) {
        return null;
    }
    Rect startBounds = (Rect) startValues.values.get(PROPNAME_BOUNDS);
    Rect endBounds = (Rect) endValues.values.get(PROPNAME_BOUNDS);
    if (startBounds == null || endBounds == null) {
        return null;
    }

    Matrix startMatrix = (Matrix) startValues.values.get(PROPNAME_MATRIX);
    Matrix endMatrix = (Matrix) endValues.values.get(PROPNAME_MATRIX);

    boolean matricesEqual = (startMatrix == null && endMatrix == null) ||
            (startMatrix != null && startMatrix.equals(endMatrix));

    if (startBounds.equals(endBounds) && matricesEqual) {
        return null;
    }

    ImageView imageView = (ImageView) endValues.view;
    Drawable drawable = imageView.getDrawable();
    int drawableWidth = drawable.getIntrinsicWidth();
    int drawableHeight = drawable.getIntrinsicHeight();

    ObjectAnimator animator;
    if (drawableWidth == 0 || drawableHeight == 0) {
        animator = createNullAnimator(imageView);
    } else {
        if (startMatrix == null) {
            startMatrix = Matrix.IDENTITY_MATRIX;
        }
        if (endMatrix == null) {
            endMatrix = Matrix.IDENTITY_MATRIX;
        }
        ANIMATED_TRANSFORM_PROPERTY.set(imageView, startMatrix);
        animator = createMatrixAnimator(imageView, startMatrix, endMatrix);
    }
    return animator;
}
 
/**
 * Creates an Animator for ImageViews moving, changing dimensions, and/or changing
 * {@link android.widget.ImageView.ScaleType}.
 *
 * @param sceneRoot   The root of the transition hierarchy.
 * @param startValues The values for a specific target in the start scene.
 * @param endValues   The values for the target in the end scene.
 * @return An Animator to move an ImageView or null if the View is not an ImageView,
 * the Drawable changed, the View is not VISIBLE, or there was no change.
 */
@Nullable
@Override
public Animator createAnimator(@NonNull ViewGroup sceneRoot, @Nullable TransitionValues startValues,
                               @Nullable TransitionValues endValues) {
    if (startValues == null || endValues == null) {
        return null;
    }
    Rect startBounds = (Rect) startValues.values.get(PROPNAME_BOUNDS);
    Rect endBounds = (Rect) endValues.values.get(PROPNAME_BOUNDS);
    if (startBounds == null || endBounds == null) {
        return null;
    }

    Matrix startMatrix = (Matrix) startValues.values.get(PROPNAME_MATRIX);
    Matrix endMatrix = (Matrix) endValues.values.get(PROPNAME_MATRIX);

    boolean matricesEqual = (startMatrix == null && endMatrix == null) ||
            (startMatrix != null && startMatrix.equals(endMatrix));

    if (startBounds.equals(endBounds) && matricesEqual) {
        return null;
    }

    ImageView imageView = (ImageView) endValues.view;
    Drawable drawable = imageView.getDrawable();
    int drawableWidth = drawable.getIntrinsicWidth();
    int drawableHeight = drawable.getIntrinsicHeight();

    ObjectAnimator animator;
    if (drawableWidth == 0 || drawableHeight == 0) {
        animator = createMatrixAnimator(imageView, new MatrixUtils.NullMatrixEvaluator(),
                MatrixUtils.IDENTITY_MATRIX, MatrixUtils.IDENTITY_MATRIX);
    } else {
        if (startMatrix == null) {
            startMatrix = MatrixUtils.IDENTITY_MATRIX;
        }
        if (endMatrix == null) {
            endMatrix = MatrixUtils.IDENTITY_MATRIX;
        }
        MatrixUtils.animateTransform(imageView, startMatrix);
        animator = createMatrixAnimator(imageView, new MatrixUtils.MatrixEvaluator(),
                startMatrix, endMatrix);
    }
    return animator;
}