[add] 车模扫描动画添加 差进度条动画
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
package com.mogo.module.common.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 2019-08-22
|
||||
*/
|
||||
public class ImageViewClipBounds extends AppCompatImageView {
|
||||
Rect mClipBounds = null;
|
||||
|
||||
public ImageViewClipBounds(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public ImageViewClipBounds(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public ImageViewClipBounds(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
if (mClipBounds != null) {
|
||||
// clip bounds ignore scroll
|
||||
canvas.clipRect(mClipBounds);
|
||||
}
|
||||
super.onDraw(canvas);
|
||||
}
|
||||
|
||||
public void setClip(Rect clipBounds) {
|
||||
if (clipBounds == mClipBounds || (clipBounds != null && clipBounds.equals(mClipBounds))) {
|
||||
return;
|
||||
}
|
||||
if (clipBounds != null) {
|
||||
if (mClipBounds == null) {
|
||||
mClipBounds = new Rect(clipBounds);
|
||||
} else {
|
||||
mClipBounds.set(clipBounds);
|
||||
}
|
||||
} else {
|
||||
mClipBounds = null;
|
||||
}
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user