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,131 @@
package com.ubt.jimu.main.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import com.ubt.jimu.R$styleable;
/* loaded from: classes2.dex */
public class CardLayout extends ViewGroup {
private int a;
private int b;
private float c;
private int d;
private int e;
private int f;
private OnItemClickListener g;
private View.OnClickListener h;
public interface OnItemClickListener {
void onClick(View view);
}
public CardLayout(Context context) {
this(context, null);
}
private void a(Context context, AttributeSet attributeSet) {
if (attributeSet != null) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.CardLayout);
this.a = obtainStyledAttributes.getDimensionPixelSize(0, 0);
this.b = obtainStyledAttributes.getDimensionPixelSize(1, 0);
this.c = obtainStyledAttributes.getFloat(2, 0.0f);
this.d = obtainStyledAttributes.getInteger(3, 0);
}
for (int i = 0; i < getChildCount(); i++) {
getChildAt(i).setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.main.widget.a
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
CardLayout.this.a(view);
}
});
}
}
public /* synthetic */ void b(View view) {
OnItemClickListener onItemClickListener = this.g;
if (onItemClickListener != null) {
onItemClickListener.onClick(view);
}
}
@Override // android.view.ViewGroup, android.view.View
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
int width = getWidth();
int height = getHeight();
int childCount = getChildCount();
int i5 = childCount >= this.d ? this.a : (width - ((this.e * childCount) + ((childCount - 1) * this.b))) / 2;
int i6 = (height - this.f) / 2;
int i7 = 0;
while (true) {
int i8 = this.d;
if (childCount < i8) {
i8 = childCount;
}
if (i7 >= i8) {
return;
}
getChildAt(i7).layout(i5, i6, this.e + i5, this.f + i6);
i5 += this.e + this.b;
i7++;
}
}
@Override // android.view.View
protected void onMeasure(int i, int i2) {
int size = View.MeasureSpec.getSize(i);
View.MeasureSpec.getSize(i2);
int i3 = size - (this.a * 2);
int i4 = this.b;
int i5 = this.d;
this.e = (i3 - (i4 * (i5 - 1))) / i5;
this.f = (int) (this.e * this.c);
for (int i6 = 0; i6 < getChildCount(); i6++) {
View childAt = getChildAt(i6);
ViewGroup.LayoutParams layoutParams = childAt.getLayoutParams();
layoutParams.width = this.e;
layoutParams.height = this.f;
childAt.setLayoutParams(layoutParams);
}
measureChildren(i, i2);
super.onMeasure(i, i2);
}
public void setListener(OnItemClickListener onItemClickListener) {
this.g = onItemClickListener;
for (int i = 0; i < getChildCount(); i++) {
View childAt = getChildAt(i);
if (childAt != null) {
childAt.setOnClickListener(this.h);
}
}
}
public CardLayout(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public CardLayout(Context context, AttributeSet attributeSet, int i) {
this(context, attributeSet, i, 0);
}
public CardLayout(Context context, AttributeSet attributeSet, int i, int i2) {
super(context, attributeSet, i, i2);
this.h = new View.OnClickListener() { // from class: com.ubt.jimu.main.widget.b
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
CardLayout.this.b(view);
}
};
a(context, attributeSet);
}
public /* synthetic */ void a(View view) {
OnItemClickListener onItemClickListener = this.g;
if (onItemClickListener != null) {
onItemClickListener.onClick(view);
}
}
}

View File

@@ -0,0 +1,66 @@
package com.ubt.jimu.main.widget;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestBuilder;
import com.bumptech.glide.request.RequestOptions;
import com.ubt.jimu.R;
import com.ubt.jimu.base.cache.SharePreferenceHelper;
import com.ubt.jimu.unity.bluetooth.ConnectionStatus;
/* loaded from: classes2.dex */
public class RobotSwitchView extends FrameLayout {
private ImageView a;
private ImageView b;
public RobotSwitchView(Context context) {
this(context, null);
}
private void a(Context context, AttributeSet attributeSet) {
LayoutInflater.from(context).inflate(R.layout.lay_robot_switch, this);
this.a = (ImageView) findViewById(R.id.robot);
this.b = (ImageView) findViewById(R.id.status);
a(getResources().getColor(R.color.image_foreground_filter), ConnectionStatus.DIS_CONNECT.getStatus());
}
@Override // android.view.View
public void onWindowFocusChanged(boolean z) {
super.onWindowFocusChanged(z);
if (z) {
a();
}
}
public RobotSwitchView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public RobotSwitchView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
a(context, attributeSet);
}
private void a() {
int i = new SharePreferenceHelper().getInt(SharePreferenceHelper.SP_KEY_CONNECTION_STATUS, ConnectionStatus.DIS_CONNECT.getStatus());
for (ConnectionStatus connectionStatus : ConnectionStatus.values()) {
if (connectionStatus.getStatus() == i) {
a(getResources().getColor(R.color.image_foreground_filter), i);
return;
}
}
}
private void a(int i, int i2) {
setBackgroundResource(R.drawable.connection_status_bg);
this.b.setImageResource(R.drawable.robot_can_change);
RequestBuilder<Drawable> a = Glide.e(getContext()).a(new SharePreferenceHelper(false).getString(SharePreferenceHelper.SP_KEY_ROBOT_IMAGE, ""));
a.a(new RequestOptions().b(R.drawable.default_robot_logo).a(R.drawable.default_robot_logo));
a.a(this.a);
}
}

View File

@@ -0,0 +1,136 @@
package com.ubt.jimu.main.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.ubt.jimu.R;
import com.ubt.jimu.R$styleable;
import com.ubtech.utils.XLog;
import java.util.Arrays;
/* loaded from: classes2.dex */
public class TabBarView extends FrameLayout {
private OnActionListener a;
private ViewGroup b;
private View c;
private int d;
private int e;
private int f;
private int g;
private int h;
private View.OnClickListener i;
public interface OnActionListener {
void c(int i);
}
public TabBarView(Context context) {
this(context, null);
}
private void a(Context context, AttributeSet attributeSet) {
LayoutInflater.from(context).inflate(R.layout.lay_tabbar, this);
this.c = findViewById(R.id.line);
if (attributeSet != null) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.TabBarView);
CharSequence[] textArray = obtainStyledAttributes.getTextArray(0);
this.f = obtainStyledAttributes.getColor(1, 0);
this.g = obtainStyledAttributes.getColor(2, 0);
float dimensionPixelSize = obtainStyledAttributes.getDimensionPixelSize(3, 16);
XLog.a("tabbar", "titles %s", Arrays.toString(textArray));
XLog.a("tabbar", "textSize %s", Float.valueOf(dimensionPixelSize));
this.b = (ViewGroup) findViewById(R.id.tabs);
this.e = textArray.length;
for (int i = 0; i < textArray.length; i++) {
TextView textView = new TextView(context);
textView.setText(textArray[i]);
if (i > 0) {
textView.setTextColor(this.f);
} else {
textView.setTextColor(this.g);
}
textView.setGravity(17);
textView.setTextSize(0, dimensionPixelSize);
textView.setTypeface(Typeface.defaultFromStyle(1));
textView.setOnClickListener(this.i);
textView.setTag(Integer.valueOf(i));
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
layoutParams.weight = 1.0f;
this.b.addView(textView, layoutParams);
}
obtainStyledAttributes.recycle();
}
this.h = 0;
}
private void b(int i, float f) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.c.getLayoutParams();
int i2 = this.d;
layoutParams.leftMargin = ((int) ((i + f) * i2)) + ((i2 - layoutParams.width) / 2);
this.c.setLayoutParams(layoutParams);
if (Float.compare(f, 0.5f) >= 0) {
i++;
}
if (this.h != i) {
for (int i3 = 0; i3 < this.b.getChildCount(); i3++) {
if (i3 == i) {
((TextView) this.b.getChildAt(i3)).setTextColor(this.g);
} else if (i3 == this.h) {
((TextView) this.b.getChildAt(i3)).setTextColor(this.f);
}
}
this.h = i;
}
}
@Override // android.widget.FrameLayout, android.view.View
protected void onMeasure(int i, int i2) {
int measuredWidth = getMeasuredWidth();
getMeasuredHeight();
this.d = measuredWidth / this.e;
super.onMeasure(i, i2);
}
public void setListener(OnActionListener onActionListener) {
this.a = onActionListener;
}
public TabBarView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public TabBarView(Context context, AttributeSet attributeSet, int i) {
this(context, attributeSet, i, 0);
}
public TabBarView(Context context, AttributeSet attributeSet, int i, int i2) {
super(context, attributeSet, i, i2);
this.h = 0;
this.i = new View.OnClickListener() { // from class: com.ubt.jimu.main.widget.c
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
TabBarView.this.a(view);
}
};
a(context, attributeSet);
}
public void a(int i, float f) {
b(i, f);
}
public /* synthetic */ void a(View view) {
int intValue = ((Integer) view.getTag()).intValue();
OnActionListener onActionListener = this.a;
if (onActionListener != null) {
onActionListener.c(intValue);
}
}
}

View File

@@ -0,0 +1,74 @@
package com.ubt.jimu.main.widget;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestBuilder;
import com.bumptech.glide.request.RequestOptions;
import com.ubt.jimu.R;
import com.ubt.jimu.base.db.user.UserDbHandler;
import com.ubt.jimu.base.entities.User;
/* loaded from: classes2.dex */
public class UserEntryView extends RelativeLayout {
private ImageView a;
private TextView b;
private ProgressBar c;
public UserEntryView(Context context) {
this(context, null);
}
private void a(Context context) {
LayoutInflater.from(context).inflate(R.layout.lay_user_entry, this);
this.a = (ImageView) findViewById(R.id.portrait);
this.b = (TextView) findViewById(R.id.name);
this.c = (ProgressBar) findViewById(R.id.level);
}
@Override // android.view.View
public void onWindowFocusChanged(boolean z) {
super.onWindowFocusChanged(z);
if (z) {
a();
}
}
public UserEntryView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public UserEntryView(Context context, AttributeSet attributeSet, int i) {
this(context, attributeSet, i, 0);
}
public UserEntryView(Context context, AttributeSet attributeSet, int i, int i2) {
super(context, attributeSet, i, i2);
a(context);
}
public void a() {
User user = UserDbHandler.getUser();
if (user == null) {
this.b.setVisibility(8);
this.c.setVisibility(8);
RequestBuilder<Drawable> a = Glide.e(getContext()).a(Integer.valueOf(R.drawable.default_photo));
a.a(RequestOptions.O().h().b());
a.a(this.a);
return;
}
this.b.setVisibility(0);
this.c.setVisibility(0);
this.c.setProgress((int) ((user.getCurExp() / user.getExpLength()) * 100.0f));
this.b.setText(user.getNickName());
RequestBuilder<Drawable> a2 = Glide.e(getContext()).a(user.getUserImage());
a2.a(RequestOptions.N().b().b(R.drawable.default_photo).a(R.drawable.default_photo));
a2.a(this.a);
}
}