Initial commit
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package com.ubt.jimu.controller.view.control;
|
||||
|
||||
import com.ubt.jimu.controller.data.widget.ControllerData;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface ControlEditEvent {
|
||||
void b(ControllerData controllerData);
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
package com.ubt.jimu.controller.view.control;
|
||||
|
||||
import android.view.View;
|
||||
import com.ubt.jimu.controller.data.widget.ActionWidgetData;
|
||||
import com.ubt.jimu.controller.data.widget.ItemBaseData;
|
||||
import com.ubt.jimu.controller.view.control.SuperControlView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface ControlTouchEvent {
|
||||
void a(View view);
|
||||
|
||||
void a(View view, float f, float f2);
|
||||
|
||||
void a(View view, ItemBaseData itemBaseData);
|
||||
|
||||
void a(View view, String str);
|
||||
|
||||
void a(ActionWidgetData actionWidgetData);
|
||||
|
||||
void a(ActionWidgetData actionWidgetData, SuperControlView.MotionEventState motionEventState);
|
||||
|
||||
void a(SuperControlView superControlView);
|
||||
|
||||
void b(View view);
|
||||
|
||||
void b(SuperControlView superControlView);
|
||||
|
||||
void c(View view);
|
||||
|
||||
boolean c(SuperControlView superControlView);
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.ubt.jimu.controller.view.control;
|
||||
|
||||
import com.ubt.jimu.controller.view.ControllerState;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface ControllerStateChangeListener {
|
||||
void a(ControllerState controllerState);
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.ubt.jimu.controller.view.control;
|
||||
|
||||
import com.ubt.jimu.controller.data.widget.ActionWidgetData;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface OnControllerClickListener {
|
||||
void a(ActionWidgetData actionWidgetData, SuperControlView superControlView);
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.ubt.jimu.controller.view.control;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface OnGameControllerConfigResultListener {
|
||||
void onCancel();
|
||||
|
||||
void onOk();
|
||||
}
|
@@ -0,0 +1,341 @@
|
||||
package com.ubt.jimu.controller.view.control;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.controller.component.DeleteView;
|
||||
import com.ubt.jimu.controller.data.widget.ItemBaseData;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
import com.ubt.jimu.utils.ScreenUtil;
|
||||
import com.ubtech.utils.XLog;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SuperControlView<D extends ItemBaseData> extends View {
|
||||
private boolean A;
|
||||
protected int a;
|
||||
protected Paint b;
|
||||
protected Paint c;
|
||||
private D d;
|
||||
public DeleteView e;
|
||||
protected boolean f;
|
||||
private RectF g;
|
||||
private boolean h;
|
||||
protected ControlTouchEvent i;
|
||||
protected RectF j;
|
||||
protected RectF k;
|
||||
protected float l;
|
||||
protected float m;
|
||||
protected boolean n;
|
||||
protected float o;
|
||||
protected float p;
|
||||
private OnControllerClickListener q;
|
||||
protected int r;
|
||||
protected int s;
|
||||
protected long t;
|
||||
protected float u;
|
||||
private float v;
|
||||
private boolean x;
|
||||
private Bitmap y;
|
||||
protected int z;
|
||||
|
||||
public enum MotionEventState {
|
||||
STATE_UP,
|
||||
STATE_CANCEL
|
||||
}
|
||||
|
||||
public SuperControlView(Context context) {
|
||||
super(context);
|
||||
this.a = R.color.color_4D00C4C9;
|
||||
this.h = false;
|
||||
this.x = false;
|
||||
this.z = 0;
|
||||
this.A = false;
|
||||
a(context);
|
||||
}
|
||||
|
||||
private void a(Context context) {
|
||||
this.r = ScreenUtil.b(context);
|
||||
this.s = ScreenUtil.a(context);
|
||||
this.b = new Paint();
|
||||
this.b.setAntiAlias(true);
|
||||
this.b.setColor(getResources().getColor(this.a));
|
||||
this.c = new Paint();
|
||||
this.c.setAntiAlias(true);
|
||||
this.y = BitmapFactory.decodeResource(getResources(), R.drawable.ic_adsorb_corner);
|
||||
this.u = context.getResources().getDimension(R.dimen.shadow_radian);
|
||||
this.v = getContext().getResources().getDimension(R.dimen.grid_view_width);
|
||||
this.k = new RectF();
|
||||
this.j = new RectF();
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return this.h;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
return this.A;
|
||||
}
|
||||
|
||||
public void d() {
|
||||
RectF rectF = this.j;
|
||||
if (rectF != null) {
|
||||
this.o = rectF.left;
|
||||
this.p = rectF.top;
|
||||
}
|
||||
}
|
||||
|
||||
public void e() {
|
||||
if (this.j != null) {
|
||||
float[] viewCenterXY = getViewCenterXY();
|
||||
RectF rectF = this.j;
|
||||
float f = viewCenterXY[0];
|
||||
float f2 = this.l;
|
||||
float f3 = viewCenterXY[1];
|
||||
float f4 = this.m;
|
||||
rectF.set(f - (f2 / 2.0f), f3 - (f4 / 2.0f), viewCenterXY[0] + (f2 / 2.0f), viewCenterXY[1] + (f4 / 2.0f));
|
||||
this.k.set(this.j);
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public RectF getAdsorbRectF() {
|
||||
return this.k;
|
||||
}
|
||||
|
||||
public D getData() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public RectF getDeleteViewRectF() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
protected OnControllerClickListener getOnControllerClickListener() {
|
||||
return this.q;
|
||||
}
|
||||
|
||||
public RectF getShadowRectF() {
|
||||
return this.j;
|
||||
}
|
||||
|
||||
protected int getState() {
|
||||
return this.z;
|
||||
}
|
||||
|
||||
public float[] getViewCenterXY() {
|
||||
return new float[0];
|
||||
}
|
||||
|
||||
public float getViewHeight() {
|
||||
return this.m;
|
||||
}
|
||||
|
||||
public float getViewWidth() {
|
||||
return this.l;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
if (this.h || c()) {
|
||||
a(canvas);
|
||||
RectF rectF = this.j;
|
||||
float f = this.u;
|
||||
canvas.drawRoundRect(rectF, f, f, this.b);
|
||||
}
|
||||
}
|
||||
|
||||
public void setControlTouchEvent(ControlTouchEvent controlTouchEvent) {
|
||||
this.i = controlTouchEvent;
|
||||
}
|
||||
|
||||
public void setData(D d) {
|
||||
this.d = d;
|
||||
}
|
||||
|
||||
public void setEditState(boolean z) {
|
||||
this.h = z;
|
||||
}
|
||||
|
||||
public void setOnControllerClickListener(OnControllerClickListener onControllerClickListener) {
|
||||
this.q = onControllerClickListener;
|
||||
}
|
||||
|
||||
public void setSelect(boolean z) {
|
||||
this.A = z;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setState(int i) {
|
||||
this.z = i;
|
||||
if (i == 0) {
|
||||
setSelect(false);
|
||||
setEditState(false);
|
||||
a();
|
||||
} else if (i == 1) {
|
||||
setSelect(false);
|
||||
setEditState(true);
|
||||
e();
|
||||
} else {
|
||||
if (i != 2) {
|
||||
return;
|
||||
}
|
||||
setEditState(false);
|
||||
a();
|
||||
}
|
||||
}
|
||||
|
||||
public void b(boolean z) {
|
||||
this.x = z;
|
||||
}
|
||||
|
||||
public float b(MotionEvent motionEvent, float f) {
|
||||
float y = motionEvent.getY();
|
||||
float f2 = this.m;
|
||||
if ((y - (f2 / 2.0f)) + f <= 0.0f) {
|
||||
return 0.0f;
|
||||
}
|
||||
float f3 = y + (f2 / 2.0f) + f;
|
||||
int i = this.s;
|
||||
return f3 >= ((float) i) ? i - f2 : (motionEvent.getY() - (this.m / 2.0f)) + f;
|
||||
}
|
||||
|
||||
public float b(float f) {
|
||||
RectF rectF = this.j;
|
||||
if (rectF == null) {
|
||||
return 0.0f;
|
||||
}
|
||||
return rectF.centerY() - f;
|
||||
}
|
||||
|
||||
public SuperControlView(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
this.a = R.color.color_4D00C4C9;
|
||||
this.h = false;
|
||||
this.x = false;
|
||||
this.z = 0;
|
||||
this.A = false;
|
||||
a(context);
|
||||
}
|
||||
|
||||
public void a(DeleteView deleteView) {
|
||||
this.e = deleteView;
|
||||
if (this.e != null) {
|
||||
this.g = deleteView.getDeleteViewRectF();
|
||||
}
|
||||
}
|
||||
|
||||
public void a(boolean z) {
|
||||
if (z) {
|
||||
this.a = R.color.bg_88fb4570;
|
||||
LogUtils.c("颜色改变~");
|
||||
} else {
|
||||
this.a = R.color.color_4D00C4C9;
|
||||
}
|
||||
this.b.setColor(getResources().getColor(this.a));
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void a() {
|
||||
RectF rectF = this.j;
|
||||
if (rectF == null || rectF.width() <= 0.0f) {
|
||||
return;
|
||||
}
|
||||
LogUtils.b("关闭阴影");
|
||||
this.j.set(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
this.k.set(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public float a(MotionEvent motionEvent, float f) {
|
||||
float x = motionEvent.getX();
|
||||
float f2 = this.l;
|
||||
if ((x - (f2 / 2.0f)) + f <= 0.0f) {
|
||||
return 0.0f;
|
||||
}
|
||||
float f3 = (f2 / 2.0f) + x + f;
|
||||
int i = this.r;
|
||||
return f3 >= ((float) i) ? i - f2 : (x - (f2 / 2.0f)) + f;
|
||||
}
|
||||
|
||||
public float a(float f) {
|
||||
RectF rectF = this.j;
|
||||
if (rectF == null) {
|
||||
return 0.0f;
|
||||
}
|
||||
return rectF.centerX() - f;
|
||||
}
|
||||
|
||||
public PointF a(float f, float f2) {
|
||||
int round = Math.round(f / this.v);
|
||||
int round2 = Math.round(f2 / this.v);
|
||||
float f3 = this.v;
|
||||
float f4 = round * f3;
|
||||
if (this.l + f4 > this.r) {
|
||||
f4 = (round - 1) * f3;
|
||||
}
|
||||
float f5 = this.v;
|
||||
float f6 = round2 * f5;
|
||||
if (this.m + f6 > this.s) {
|
||||
f6 = (round2 - 1) * f5;
|
||||
}
|
||||
XLog.a("Controller", "row: %d, column: %d (%.3f, %.3f) -> (%.3f, %.3f)", Integer.valueOf(round), Integer.valueOf(round2), Float.valueOf(f), Float.valueOf(f2), Float.valueOf(f4), Float.valueOf(f6));
|
||||
return new PointF(f4, f6);
|
||||
}
|
||||
|
||||
private void a(Canvas canvas) {
|
||||
if (this.x) {
|
||||
Bitmap bitmap = this.y;
|
||||
RectF rectF = this.k;
|
||||
float f = rectF.left;
|
||||
float f2 = rectF.bottom;
|
||||
float f3 = this.v;
|
||||
canvas.drawBitmap(bitmap, (Rect) null, new RectF(f, f2 - f3, f3 + f, f2), this.c);
|
||||
canvas.save();
|
||||
RectF rectF2 = this.k;
|
||||
float f4 = rectF2.left;
|
||||
float f5 = this.v;
|
||||
canvas.rotate(90.0f, f4 + (f5 / 2.0f), rectF2.top + (f5 / 2.0f));
|
||||
Bitmap bitmap2 = this.y;
|
||||
RectF rectF3 = this.k;
|
||||
float f6 = rectF3.left;
|
||||
float f7 = rectF3.top;
|
||||
float f8 = this.v;
|
||||
canvas.drawBitmap(bitmap2, (Rect) null, new RectF(f6, f7, f6 + f8, f8 + f7), this.c);
|
||||
canvas.restore();
|
||||
canvas.save();
|
||||
RectF rectF4 = this.k;
|
||||
float f9 = rectF4.right;
|
||||
float f10 = this.v;
|
||||
canvas.rotate(180.0f, f9 - (f10 / 2.0f), rectF4.top + (f10 / 2.0f));
|
||||
Bitmap bitmap3 = this.y;
|
||||
RectF rectF5 = this.k;
|
||||
float f11 = rectF5.right;
|
||||
float f12 = this.v;
|
||||
float f13 = rectF5.top;
|
||||
canvas.drawBitmap(bitmap3, (Rect) null, new RectF(f11 - f12, f13, f11, f12 + f13), this.c);
|
||||
canvas.restore();
|
||||
canvas.save();
|
||||
RectF rectF6 = this.k;
|
||||
float f14 = rectF6.right;
|
||||
float f15 = this.v;
|
||||
canvas.rotate(270.0f, f14 - (f15 / 2.0f), rectF6.bottom - (f15 / 2.0f));
|
||||
Bitmap bitmap4 = this.y;
|
||||
RectF rectF7 = this.k;
|
||||
float f16 = rectF7.right;
|
||||
float f17 = this.v;
|
||||
float f18 = rectF7.bottom;
|
||||
canvas.drawBitmap(bitmap4, (Rect) null, new RectF(f16 - f17, f18 - f17, f16, f18), this.c);
|
||||
canvas.restore();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
package com.ubt.jimu.controller.view.control;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ViewPagerSlide extends ViewPager {
|
||||
private boolean k0;
|
||||
|
||||
public ViewPagerSlide(Context context) {
|
||||
super(context);
|
||||
this.k0 = false;
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.ViewPager, android.view.ViewGroup
|
||||
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
|
||||
return this.k0;
|
||||
}
|
||||
|
||||
public void setSlide(boolean z) {
|
||||
this.k0 = z;
|
||||
}
|
||||
|
||||
public ViewPagerSlide(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
this.k0 = false;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user