111 lines
3.8 KiB
Java
111 lines
3.8 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.Color;
|
||
|
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 b extends LinearLayout {
|
||
|
protected float a;
|
||
|
protected float b;
|
||
|
private Bitmap c;
|
||
|
protected float d;
|
||
|
protected float e;
|
||
|
private int f;
|
||
|
|
||
|
protected void aCC_(Canvas canvas) {
|
||
|
}
|
||
|
|
||
|
@Override // android.view.ViewGroup, android.view.View
|
||
|
protected void dispatchDraw(Canvas canvas) {
|
||
|
super.dispatchDraw(canvas);
|
||
|
if (this.c == null) {
|
||
|
Runtime.getRuntime().gc();
|
||
|
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);
|
||
|
paint.setColor(this.f);
|
||
|
canvas2.drawRect(rectF, paint);
|
||
|
paint.setColor(0);
|
||
|
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OUT));
|
||
|
if (this.e == -1000.0f) {
|
||
|
this.e = getWidth() / 2;
|
||
|
}
|
||
|
if (this.d == -1000.0f) {
|
||
|
this.d = getHeight() / 2;
|
||
|
}
|
||
|
canvas2.drawRect(new RectF(this.e - ((this.b / 2.0f) - getPaddingLeft()), this.d - ((this.a / 2.0f) - getPaddingTop()), this.e + ((this.b / 2.0f) - getPaddingRight()), this.d + ((this.a / 2.0f) - (getPaddingBottom() + 65))), paint);
|
||
|
aCC_(canvas2);
|
||
|
}
|
||
|
canvas.drawBitmap(this.c, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, (Paint) null);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
public boolean isInEditMode() {
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
@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 final void e(float f, float f2) {
|
||
|
this.b = f;
|
||
|
this.a = f2;
|
||
|
postInvalidate();
|
||
|
}
|
||
|
|
||
|
public final void c(float f, float f2) {
|
||
|
this.e = f;
|
||
|
this.d = f2;
|
||
|
postInvalidate();
|
||
|
}
|
||
|
|
||
|
public b(Context context, AttributeSet attributeSet, int i) {
|
||
|
super(context, attributeSet, i);
|
||
|
this.b = 200.0f;
|
||
|
this.a = 200.0f;
|
||
|
this.e = 200.0f;
|
||
|
this.d = 200.0f;
|
||
|
}
|
||
|
|
||
|
public b(Context context, AttributeSet attributeSet) {
|
||
|
super(context, attributeSet);
|
||
|
this.b = 200.0f;
|
||
|
this.a = 200.0f;
|
||
|
this.e = 200.0f;
|
||
|
this.d = 200.0f;
|
||
|
TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet, fPZ.IeS.OverlayView, 0, 0);
|
||
|
try {
|
||
|
this.f = obtainStyledAttributes.getColor(fPZ.IeS.OverlayView_backgroundColor, Color.parseColor("#000000"));
|
||
|
this.b = obtainStyledAttributes.getFloat(fPZ.IeS.OverlayView_overlayWidth, 100.0f);
|
||
|
this.a = obtainStyledAttributes.getFloat(fPZ.IeS.OverlayView_overlayHeight, 100.0f);
|
||
|
this.e = obtainStyledAttributes.getFloat(fPZ.IeS.OverlayView_centerX, -1000.0f);
|
||
|
this.d = obtainStyledAttributes.getFloat(fPZ.IeS.OverlayView_centerY, -1000.0f);
|
||
|
} finally {
|
||
|
obtainStyledAttributes.recycle();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public b(Context context) {
|
||
|
super(context);
|
||
|
this.b = 200.0f;
|
||
|
this.a = 200.0f;
|
||
|
this.e = 200.0f;
|
||
|
this.d = 200.0f;
|
||
|
}
|
||
|
}
|