107 lines
3.6 KiB
Java
107 lines
3.6 KiB
Java
package io.beid.beidk.view;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.TypedArray;
|
|
import android.graphics.Bitmap;
|
|
import android.graphics.Canvas;
|
|
import android.graphics.Paint;
|
|
import android.graphics.PorterDuff;
|
|
import android.graphics.PorterDuffXfermode;
|
|
import android.graphics.RectF;
|
|
import android.util.AttributeSet;
|
|
import android.widget.LinearLayout;
|
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
|
import o.fPZ;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public class a extends LinearLayout {
|
|
protected float a;
|
|
protected float b;
|
|
private Bitmap c;
|
|
private int d;
|
|
protected float e;
|
|
|
|
protected void aCB_(Canvas canvas) {
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean isInEditMode() {
|
|
return true;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
protected void dispatchDraw(Canvas canvas) {
|
|
super.dispatchDraw(canvas);
|
|
if (this.c == null && getWidth() > 0 && getHeight() > 0) {
|
|
this.c = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
|
|
Canvas canvas2 = new Canvas(this.c);
|
|
RectF rectF = new RectF(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, getWidth(), getHeight());
|
|
Paint paint = new Paint(1);
|
|
int i = this.d;
|
|
if (i != -1) {
|
|
paint.setColor(i);
|
|
}
|
|
canvas2.drawRect(rectF, paint);
|
|
paint.setColor(0);
|
|
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OUT));
|
|
if (this.b == -1000.0f) {
|
|
this.b = getWidth() / 2;
|
|
}
|
|
if (this.a == -1000.0f) {
|
|
this.a = (getHeight() / 2) + getPaddingTop();
|
|
}
|
|
if (this.e == -1.0f) {
|
|
int width = getWidth() < getHeight() ? getWidth() : getHeight();
|
|
getPaddingStart();
|
|
this.e = (width / 2) - getPaddingStart();
|
|
}
|
|
canvas2.drawCircle(this.b, this.a, this.e, paint);
|
|
aCB_(canvas2);
|
|
}
|
|
canvas.drawBitmap(this.c, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, (Paint) null);
|
|
}
|
|
|
|
public void setRadius(float f) {
|
|
this.e = f;
|
|
postInvalidate();
|
|
}
|
|
|
|
@Override // android.widget.LinearLayout, android.view.ViewGroup, android.view.View
|
|
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
|
super.onLayout(z, i, i2, i3, i4);
|
|
this.c = null;
|
|
}
|
|
|
|
public a(Context context, AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet, i);
|
|
this.e = 200.0f;
|
|
this.b = 200.0f;
|
|
this.a = 200.0f;
|
|
}
|
|
|
|
public a(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
this.e = 200.0f;
|
|
this.b = 200.0f;
|
|
this.a = 200.0f;
|
|
TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet, fPZ.IeS.OverlayView, 0, 0);
|
|
try {
|
|
getWidth();
|
|
getPaddingRight();
|
|
this.d = obtainStyledAttributes.getColor(fPZ.IeS.OverlayView_backgroundColor, -1);
|
|
this.e = obtainStyledAttributes.getFloat(fPZ.IeS.OverlayView_radius, -1.0f);
|
|
this.b = obtainStyledAttributes.getFloat(fPZ.IeS.OverlayView_centerX, -1000.0f);
|
|
this.a = obtainStyledAttributes.getFloat(fPZ.IeS.OverlayView_centerY, -1000.0f);
|
|
} finally {
|
|
obtainStyledAttributes.recycle();
|
|
}
|
|
}
|
|
|
|
public a(Context context) {
|
|
super(context);
|
|
this.e = 200.0f;
|
|
this.b = 200.0f;
|
|
this.a = 200.0f;
|
|
}
|
|
}
|