Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
package com.ubt.jimu.controller.view;
/* loaded from: classes.dex */
public enum ControllerState {
STATE_NORMAL,
STATE_EDIT,
STATE_PHYSICAL_CONTROLLER_CONFIG
}

View File

@@ -0,0 +1,149 @@
package com.ubt.jimu.controller.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.DragEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.ubt.jimu.R;
import com.ubt.jimu.base.data.Servo;
import com.ubt.jimu.controller.adapter.DragAdapter;
import com.ubt.jimu.course.view.GridItemDecoration;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes.dex */
public class DragRecycleView extends FrameLayout implements View.OnDragListener {
private View a;
private ImageView b;
private TextView c;
private RecyclerView d;
private TextView e;
private List<Servo> f;
private DragAdapter g;
private OnDragListener h;
public interface OnDragListener {
void a(View view, int i);
void a(Servo servo);
void b(Servo servo);
}
public DragRecycleView(Context context) {
super(context);
this.f = new ArrayList();
a();
}
private void a() {
View inflate = LayoutInflater.from(getContext()).inflate(R.layout.layout_drag_recycleview, (ViewGroup) this, true);
this.e = (TextView) inflate.findViewById(R.id.tv_title);
this.d = (RecyclerView) inflate.findViewById(R.id.rv_drag);
this.d.setLayoutManager(new GridLayoutManager(getContext(), 4));
int dimensionPixelSize = getContext().getResources().getDimensionPixelSize(R.dimen.servo_mode_item_spacing);
this.d.a(new GridItemDecoration(dimensionPixelSize, dimensionPixelSize, 0));
setOnDragListener(this);
this.a = inflate.findViewById(R.id.rl_servo_null);
this.b = (ImageView) inflate.findViewById(R.id.iv_servo_null);
this.c = (TextView) inflate.findViewById(R.id.tv_servo_null_tips);
}
public void b(int i) {
List<Servo> list = this.f;
if (list != null && list.size() <= 0) {
a(true);
}
this.g.notifyItemRemoved(i);
}
public DragAdapter getAdapter() {
return this.g;
}
public RecyclerView getRecycleView() {
return this.d;
}
@Override // android.view.View.OnDragListener
public boolean onDrag(View view, DragEvent dragEvent) {
if (!(dragEvent.getLocalState() instanceof Servo)) {
return false;
}
int action = dragEvent.getAction();
if (action == 3) {
if (this.h == null) {
return true;
}
this.h.a((Servo) dragEvent.getLocalState());
return true;
}
if (action != 4 || this.h == null) {
return true;
}
this.h.b((Servo) dragEvent.getLocalState());
return true;
}
public void setTitle(int i) {
this.e.setText(i);
}
public DragRecycleView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.f = new ArrayList();
a();
}
public void a(int i, int i2) {
this.c.setText(i2);
this.b.setImageResource(i);
}
public void a(List<Servo> list, final OnDragListener onDragListener) {
this.f = list;
this.h = onDragListener;
List<Servo> list2 = this.f;
if (list2 != null && list2.size() > 0) {
this.d.setVisibility(0);
this.a.setVisibility(8);
}
if (this.g == null) {
this.g = new DragAdapter(getContext(), this.f, new DragAdapter.OnDragListener(this) { // from class: com.ubt.jimu.controller.view.DragRecycleView.1
@Override // com.ubt.jimu.controller.adapter.DragAdapter.OnDragListener
public void a(View view, int i) {
OnDragListener onDragListener2 = onDragListener;
if (onDragListener2 != null) {
onDragListener2.a(view, i);
}
}
});
}
this.d.setAdapter(this.g);
}
private void a(boolean z) {
if (z) {
this.d.setVisibility(8);
this.a.setVisibility(0);
} else {
this.d.setVisibility(0);
this.a.setVisibility(8);
}
}
public void a(int i) {
List<Servo> list = this.f;
if (list != null && list.size() > 0) {
a(false);
}
this.g.notifyItemInserted(i);
}
}

View File

@@ -0,0 +1,13 @@
package com.ubt.jimu.controller.view;
import com.ubtrobot.jimu.robotapi.ServoAngleReadInfo;
import java.util.List;
/* loaded from: classes.dex */
public interface IAccumulatorSettingView extends IBaseControllerView {
void Y();
void d(String str);
void g(List<ServoAngleReadInfo> list);
}

View File

@@ -0,0 +1,11 @@
package com.ubt.jimu.controller.view;
import com.ubtrobot.jimu.robotapi.ServoAngleReadInfo;
import java.util.List;
/* loaded from: classes.dex */
public interface IAngleSettingView extends IBaseControllerView {
void d(String str);
void g(List<ServoAngleReadInfo> list);
}

View File

@@ -0,0 +1,18 @@
package com.ubt.jimu.controller.view;
import com.ubt.jimu.connect.model.Component;
import com.ubtrobot.jimu.exception.RobotActiveException;
import java.util.List;
/* loaded from: classes.dex */
public interface IBaseControllerView {
void a(String str, RobotActiveException robotActiveException, List<Integer> list, boolean z);
void a(Throwable th);
void a(List<Component> list);
void a(boolean z);
void b(List<Component> list);
}

View File

@@ -0,0 +1,23 @@
package com.ubt.jimu.controller.view;
import com.ubt.jimu.base.data.ServoMode;
import com.ubt.jimu.controller.data.widget.ControllerData;
import com.ubtrobot.jimu.robotapi.BatteryInfo;
import java.util.List;
/* loaded from: classes.dex */
public interface IControllerView extends IBaseControllerView {
void a(ControllerData controllerData);
void a(BatteryInfo batteryInfo);
void a(String str, String str2, String str3);
void a(List<Integer> list, ServoMode servoMode);
void c();
void j();
void z();
}

View File

@@ -0,0 +1,6 @@
package com.ubt.jimu.controller.view;
/* loaded from: classes.dex */
public interface IVSliderView extends IBaseControllerView {
void d(String str);
}

View File

@@ -0,0 +1,31 @@
package com.ubt.jimu.controller.view;
import android.content.Context;
import android.util.AttributeSet;
import androidx.appcompat.widget.AppCompatImageView;
import com.ubt.jimu.controller.data.widget.ItemBaseData;
/* loaded from: classes.dex */
public class ItemBaseView<D extends ItemBaseData> extends AppCompatImageView {
private D c;
public ItemBaseView(Context context) {
super(context);
}
public D getData() {
return this.c;
}
public void setData(D d) {
this.c = d;
}
public ItemBaseView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
public ItemBaseView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
}
}

View File

@@ -0,0 +1,6 @@
package com.ubt.jimu.controller.view;
/* loaded from: classes.dex */
public interface JockstickSettingView extends IBaseControllerView {
void b(boolean z);
}

View File

@@ -0,0 +1,92 @@
package com.ubt.jimu.controller.view;
import android.content.Context;
import com.ubt.jimu.R;
import com.ubt.jimu.controller.data.config.AccumulatorConfig;
import com.ubt.jimu.controller.data.config.HSliderConfig;
import com.ubt.jimu.controller.data.config.JockstickConfig;
import com.ubt.jimu.controller.data.config.SliderConfig;
import com.ubt.jimu.controller.data.config.WidgetConfig;
import com.ubt.jimu.controller.data.widget.ItemBaseData;
import com.ubt.jimu.controller.data.widget.MoveBaseData;
import com.ubt.jimu.controller.manager.MoveConfigManager;
import java.util.List;
/* loaded from: classes.dex */
public class MenuItemDataManage {
private static MenuItemDataManage b;
private Context a;
private MenuItemDataManage(Context context) {
this.a = context;
}
public static MenuItemDataManage a(Context context) {
if (b == null) {
b = new MenuItemDataManage(context);
}
return b;
}
public int b(ItemBaseData itemBaseData) {
if (itemBaseData == null) {
return 0;
}
WidgetConfig config = ((MoveBaseData) itemBaseData).getConfig();
if (config instanceof JockstickConfig) {
return R.mipmap.steering_wheel;
}
if (config instanceof HSliderConfig) {
return R.mipmap.h_slider;
}
if (config instanceof SliderConfig) {
return R.mipmap.v_slider;
}
if (config instanceof AccumulatorConfig) {
return R.mipmap.accumulator_icon;
}
if (config == null) {
return R.mipmap.control_menu_add;
}
return 0;
}
public float[] a(ItemBaseData itemBaseData) {
float f;
float dimension;
if (itemBaseData == null) {
return new float[]{0.0f, 0.0f};
}
WidgetConfig config = ((MoveBaseData) itemBaseData).getConfig();
float f2 = 0.0f;
if (config instanceof JockstickConfig) {
f2 = this.a.getResources().getDimension(R.dimen.grid_view_width) * 8.0f;
} else {
if (config instanceof HSliderConfig) {
f2 = this.a.getResources().getDimension(R.dimen.grid_view_width) * 8.0f;
f = f2 / 2.0f;
} else {
if (config instanceof SliderConfig) {
dimension = this.a.getResources().getDimension(R.dimen.grid_view_width);
} else if (config instanceof AccumulatorConfig) {
dimension = this.a.getResources().getDimension(R.dimen.grid_view_width);
} else if (config == null) {
f2 = this.a.getResources().getDimension(R.dimen.control_menu_add_width);
} else {
f = 0.0f;
}
float f3 = dimension * 8.0f;
f2 = f3 / 2.0f;
f = f3;
}
return new float[]{f2, f};
}
f = f2;
return new float[]{f2, f};
}
public List<MoveBaseData> a() {
MoveConfigManager.a(this.a.getApplicationContext()).g();
return MoveConfigManager.a(this.a.getApplicationContext()).e();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -0,0 +1,8 @@
package com.ubt.jimu.controller.view.control;
/* loaded from: classes.dex */
public interface OnGameControllerConfigResultListener {
void onCancel();
void onOk();
}

View File

@@ -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();
}
}
}

View File

@@ -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;
}
}