Initial commit
This commit is contained in:
58
sources/com/ubtech/view/widget/AWebView.java
Normal file
58
sources/com/ubtech/view/widget/AWebView.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package com.ubtech.view.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.webkit.WebView;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class AWebView extends WebView {
|
||||
private int a;
|
||||
private WebViewScrollChangeListener b;
|
||||
|
||||
public interface WebViewScrollChangeListener {
|
||||
void a(int i, int i2, int i3, int i4);
|
||||
|
||||
void b(int i, int i2, int i3, int i4);
|
||||
|
||||
void c(int i, int i2, int i3, int i4);
|
||||
}
|
||||
|
||||
public AWebView(Context context) {
|
||||
super(context);
|
||||
this.a = 150;
|
||||
}
|
||||
|
||||
@Override // android.webkit.WebView, android.view.View
|
||||
protected void onScrollChanged(int i, int i2, int i3, int i4) {
|
||||
super.onScrollChanged(i, i2, i3, i4);
|
||||
if (this.b == null) {
|
||||
return;
|
||||
}
|
||||
if (Math.abs((getContentHeight() * getScale()) - (getHeight() + getScrollY())) < this.a) {
|
||||
this.b.b(i, i2, i3, i4);
|
||||
} else if (getScrollY() == 0) {
|
||||
this.b.a(i, i2, i3, i4);
|
||||
} else {
|
||||
this.b.c(i, i2, i3, i4);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnScrollChangeListener(WebViewScrollChangeListener webViewScrollChangeListener) {
|
||||
this.b = webViewScrollChangeListener;
|
||||
}
|
||||
|
||||
public AWebView(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
this.a = 150;
|
||||
}
|
||||
|
||||
public AWebView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
this.a = 150;
|
||||
}
|
||||
|
||||
public AWebView(Context context, AttributeSet attributeSet, int i, int i2) {
|
||||
super(context, attributeSet, i, i2);
|
||||
this.a = 150;
|
||||
}
|
||||
}
|
102
sources/com/ubtech/view/widget/ErrorView.java
Normal file
102
sources/com/ubtech/view/widget/ErrorView.java
Normal file
@@ -0,0 +1,102 @@
|
||||
package com.ubtech.view.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import com.ubtech.R$id;
|
||||
import com.ubtech.R$layout;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class ErrorView extends LinearLayout {
|
||||
private ImageView a;
|
||||
private TextView b;
|
||||
private ResAgent c;
|
||||
private Observable d;
|
||||
private View[] e;
|
||||
|
||||
public interface Observable {
|
||||
boolean a();
|
||||
}
|
||||
|
||||
public interface ResAgent {
|
||||
ResData[] a();
|
||||
}
|
||||
|
||||
public static class ResData {
|
||||
public int a;
|
||||
public int b;
|
||||
public int c;
|
||||
|
||||
public ResData(int i, int i2, int i3) {
|
||||
this.a = i;
|
||||
this.b = i2;
|
||||
this.c = i3;
|
||||
}
|
||||
}
|
||||
|
||||
public ErrorView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
private void a(Context context, AttributeSet attributeSet) {
|
||||
setOrientation(1);
|
||||
setGravity(17);
|
||||
LayoutInflater.from(context).inflate(R$layout.comm_error, this);
|
||||
this.a = (ImageView) findViewById(R$id.iv_icon);
|
||||
this.b = (TextView) findViewById(R$id.tv_msg);
|
||||
}
|
||||
|
||||
public void setType(int i) {
|
||||
ResData[] a = this.c.a();
|
||||
if (a == null) {
|
||||
return;
|
||||
}
|
||||
for (ResData resData : a) {
|
||||
if (resData != null && resData.a == i) {
|
||||
this.a.setBackgroundResource(resData.b);
|
||||
this.b.setText(resData.c);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ErrorView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
public ErrorView(Context context, AttributeSet attributeSet, int i) {
|
||||
this(context, attributeSet, i, 0);
|
||||
}
|
||||
|
||||
public ErrorView(Context context, AttributeSet attributeSet, int i, int i2) {
|
||||
super(context, attributeSet, i, i2);
|
||||
a(context, attributeSet);
|
||||
}
|
||||
|
||||
public void a(ResAgent resAgent) {
|
||||
this.c = resAgent;
|
||||
}
|
||||
|
||||
public void a(Observable observable, View... viewArr) {
|
||||
this.d = observable;
|
||||
this.e = viewArr;
|
||||
}
|
||||
|
||||
public void a() {
|
||||
Observable observable = this.d;
|
||||
boolean a = observable != null ? observable.a() : false;
|
||||
setVisibility(a ? 0 : 8);
|
||||
View[] viewArr = this.e;
|
||||
if (viewArr != null) {
|
||||
for (View view : viewArr) {
|
||||
if (view != null) {
|
||||
view.setVisibility(!a ? 0 : 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
68
sources/com/ubtech/view/widget/ToastView.java
Normal file
68
sources/com/ubtech/view/widget/ToastView.java
Normal file
@@ -0,0 +1,68 @@
|
||||
package com.ubtech.view.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import com.ubtech.R$id;
|
||||
import com.ubtech.R$layout;
|
||||
import com.ubtech.utils.DisplayUtil;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class ToastView {
|
||||
private static ToastView c;
|
||||
private Toast a = null;
|
||||
private long b = 0;
|
||||
|
||||
public enum Type {
|
||||
NORMAL,
|
||||
SUCCESS,
|
||||
ERROR
|
||||
}
|
||||
|
||||
private ToastView() {
|
||||
}
|
||||
|
||||
public static ToastView a(Context context, CharSequence charSequence, Type type) {
|
||||
if (c == null) {
|
||||
c = new ToastView();
|
||||
}
|
||||
ToastView toastView = c;
|
||||
if (toastView.a == null) {
|
||||
toastView.a = new Toast(context);
|
||||
c.a.setView(LayoutInflater.from(context).inflate(R$layout.comm_layout_toast, (ViewGroup) null));
|
||||
c.a.setGravity(17, 0, 0);
|
||||
}
|
||||
TextView textView = (TextView) c.a.getView().findViewById(R$id.textView);
|
||||
textView.setText(charSequence);
|
||||
if (!TextUtils.isEmpty(charSequence)) {
|
||||
float b = (DisplayUtil.b(context) / 3.0f) * 2.0f;
|
||||
if (textView.getPaint().measureText(charSequence.toString()) > b) {
|
||||
ViewGroup.LayoutParams layoutParams = textView.getLayoutParams();
|
||||
layoutParams.width = (int) b;
|
||||
textView.setLayoutParams(layoutParams);
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
public static ToastView a(Context context, CharSequence charSequence) {
|
||||
return a(context, charSequence, Type.NORMAL);
|
||||
}
|
||||
|
||||
public static ToastView a(Context context, int i) {
|
||||
return a(context, context.getResources().getString(i), Type.NORMAL);
|
||||
}
|
||||
|
||||
public void a() {
|
||||
Log.e("Test", "显示Toast");
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
if (currentTimeMillis - this.b > 1000) {
|
||||
this.a.show();
|
||||
this.b = currentTimeMillis;
|
||||
}
|
||||
}
|
||||
}
|
24
sources/com/ubtech/view/widget/UButton.java
Normal file
24
sources/com/ubtech/view/widget/UButton.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.ubtech.view.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import androidx.appcompat.widget.AppCompatButton;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class UButton extends AppCompatButton {
|
||||
public UButton(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
private void a(Context context, AttributeSet attributeSet) {
|
||||
}
|
||||
|
||||
public UButton(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
public UButton(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
a(context, attributeSet);
|
||||
}
|
||||
}
|
145
sources/com/ubtech/view/widget/UFrameLayout.java
Normal file
145
sources/com/ubtech/view/widget/UFrameLayout.java
Normal file
@@ -0,0 +1,145 @@
|
||||
package com.ubtech.view.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
import com.ubtech.R$styleable;
|
||||
import com.ubtech.utils.DensityUtils;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class UFrameLayout extends FrameLayout {
|
||||
private int a;
|
||||
private float b;
|
||||
|
||||
public static class LayoutParams extends FrameLayout.LayoutParams {
|
||||
private float a;
|
||||
private float b;
|
||||
private float c;
|
||||
private float d;
|
||||
private float e;
|
||||
private float f;
|
||||
|
||||
public LayoutParams(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.u_layout, 0, 0);
|
||||
this.a = obtainStyledAttributes.getFloat(R$styleable.u_layout_height_percent, 0.0f);
|
||||
this.b = obtainStyledAttributes.getFloat(R$styleable.u_layout_width_percent, 0.0f);
|
||||
this.c = obtainStyledAttributes.getFloat(R$styleable.u_layout_margin_left_percent, 0.0f);
|
||||
this.d = obtainStyledAttributes.getFloat(R$styleable.u_layout_margin_top_percent, 0.0f);
|
||||
this.e = obtainStyledAttributes.getFloat(R$styleable.u_layout_margin_right_percent, 0.0f);
|
||||
this.f = obtainStyledAttributes.getFloat(R$styleable.u_layout_margin_bottom_percent, 0.0f);
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
|
||||
public float a() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
public float b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public float c() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public float d() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public float e() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public float f() {
|
||||
return this.b;
|
||||
}
|
||||
}
|
||||
|
||||
public UFrameLayout(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
private void a(Context context, AttributeSet attributeSet) {
|
||||
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
|
||||
this.a = Math.min(displayMetrics.widthPixels, displayMetrics.heightPixels);
|
||||
this.b = this.a / (DensityUtils.a(context, 720) * 1.0f);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) {
|
||||
super.addView(view, i, layoutParams);
|
||||
if (view instanceof TextView) {
|
||||
TextView textView = (TextView) view;
|
||||
textView.setTextSize(0, textView.getTextSize() * this.b);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.FrameLayout, 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);
|
||||
}
|
||||
|
||||
@Override // android.widget.FrameLayout, android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
float f;
|
||||
float f2;
|
||||
float f3;
|
||||
float f4;
|
||||
float f5;
|
||||
float f6;
|
||||
for (int i3 = 0; i3 < getChildCount(); i3++) {
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) getChildAt(i3).getLayoutParams();
|
||||
if (layoutParams instanceof LayoutParams) {
|
||||
LayoutParams layoutParams2 = (LayoutParams) layoutParams;
|
||||
f2 = layoutParams2.f();
|
||||
f3 = layoutParams2.b();
|
||||
f4 = layoutParams2.c();
|
||||
f5 = layoutParams2.e();
|
||||
f6 = layoutParams2.d();
|
||||
f = layoutParams2.a();
|
||||
} else {
|
||||
f = 0.0f;
|
||||
f2 = 0.0f;
|
||||
f3 = 0.0f;
|
||||
f4 = 0.0f;
|
||||
f5 = 0.0f;
|
||||
f6 = 0.0f;
|
||||
}
|
||||
if (f3 != 0.0f) {
|
||||
layoutParams.height = (int) Math.ceil(this.a * f3);
|
||||
}
|
||||
if (f2 != 0.0f) {
|
||||
layoutParams.width = (int) Math.ceil(layoutParams.height * f2);
|
||||
}
|
||||
if (f4 != 0.0f) {
|
||||
layoutParams.leftMargin = (int) Math.ceil(this.a * f4);
|
||||
}
|
||||
if (f5 != 0.0f) {
|
||||
layoutParams.topMargin = (int) Math.ceil(this.a * f5);
|
||||
}
|
||||
if (f6 != 0.0f) {
|
||||
layoutParams.rightMargin = (int) Math.ceil(this.a * f6);
|
||||
}
|
||||
if (f != 0.0f) {
|
||||
layoutParams.bottomMargin = (int) Math.ceil(this.a * f);
|
||||
}
|
||||
}
|
||||
super.onMeasure(i, i2);
|
||||
}
|
||||
|
||||
public UFrameLayout(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
a(context, attributeSet);
|
||||
}
|
||||
|
||||
@Override // android.widget.FrameLayout, android.view.ViewGroup
|
||||
public FrameLayout.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
|
||||
return new LayoutParams(getContext(), attributeSet);
|
||||
}
|
||||
}
|
140
sources/com/ubtech/view/widget/ULinearLayout.java
Normal file
140
sources/com/ubtech/view/widget/ULinearLayout.java
Normal file
@@ -0,0 +1,140 @@
|
||||
package com.ubtech.view.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import com.ubtech.R$styleable;
|
||||
import com.ubtech.utils.DensityUtils;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class ULinearLayout extends LinearLayout {
|
||||
private int a;
|
||||
private float b;
|
||||
|
||||
public static class LayoutParams extends LinearLayout.LayoutParams {
|
||||
private float a;
|
||||
private float b;
|
||||
private float c;
|
||||
private float d;
|
||||
private float e;
|
||||
private float f;
|
||||
|
||||
public LayoutParams(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.u_layout, 0, 0);
|
||||
this.a = obtainStyledAttributes.getFloat(R$styleable.u_layout_height_percent, 0.0f);
|
||||
this.b = obtainStyledAttributes.getFloat(R$styleable.u_layout_width_percent, 0.0f);
|
||||
this.c = obtainStyledAttributes.getFloat(R$styleable.u_layout_margin_left_percent, 0.0f);
|
||||
this.d = obtainStyledAttributes.getFloat(R$styleable.u_layout_margin_top_percent, 0.0f);
|
||||
this.e = obtainStyledAttributes.getFloat(R$styleable.u_layout_margin_right_percent, 0.0f);
|
||||
this.f = obtainStyledAttributes.getFloat(R$styleable.u_layout_margin_bottom_percent, 0.0f);
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
|
||||
public float a() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
public float b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public float c() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public float d() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public float e() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public float f() {
|
||||
return this.b;
|
||||
}
|
||||
}
|
||||
|
||||
public ULinearLayout(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
private void a(Context context, AttributeSet attributeSet) {
|
||||
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
|
||||
this.a = Math.min(displayMetrics.widthPixels, displayMetrics.heightPixels);
|
||||
this.b = this.a / (DensityUtils.a(context, 720) * 1.0f);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) {
|
||||
super.addView(view, i, layoutParams);
|
||||
if (view instanceof TextView) {
|
||||
TextView textView = (TextView) view;
|
||||
textView.setTextSize(0, textView.getTextSize() * this.b);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.LinearLayout, android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
float f;
|
||||
float f2;
|
||||
float f3;
|
||||
float f4;
|
||||
float f5;
|
||||
float f6;
|
||||
for (int i3 = 0; i3 < getChildCount(); i3++) {
|
||||
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) getChildAt(i3).getLayoutParams();
|
||||
if (layoutParams instanceof LayoutParams) {
|
||||
LayoutParams layoutParams2 = (LayoutParams) layoutParams;
|
||||
f2 = layoutParams2.f();
|
||||
f3 = layoutParams2.b();
|
||||
f4 = layoutParams2.c();
|
||||
f5 = layoutParams2.e();
|
||||
f6 = layoutParams2.d();
|
||||
f = layoutParams2.a();
|
||||
} else {
|
||||
f = 0.0f;
|
||||
f2 = 0.0f;
|
||||
f3 = 0.0f;
|
||||
f4 = 0.0f;
|
||||
f5 = 0.0f;
|
||||
f6 = 0.0f;
|
||||
}
|
||||
if (f3 != 0.0f) {
|
||||
layoutParams.height = (int) Math.ceil(this.a * f3);
|
||||
}
|
||||
if (f2 != 0.0f) {
|
||||
layoutParams.width = (int) Math.ceil(layoutParams.height * f2);
|
||||
}
|
||||
if (f4 != 0.0f) {
|
||||
layoutParams.leftMargin = (int) Math.ceil(this.a * f4);
|
||||
}
|
||||
if (f5 != 0.0f) {
|
||||
layoutParams.topMargin = (int) Math.ceil(this.a * f5);
|
||||
}
|
||||
if (f6 != 0.0f) {
|
||||
layoutParams.rightMargin = (int) Math.ceil(this.a * f6);
|
||||
}
|
||||
if (f != 0.0f) {
|
||||
layoutParams.bottomMargin = (int) Math.ceil(this.a * f);
|
||||
}
|
||||
}
|
||||
super.onMeasure(i, i2);
|
||||
}
|
||||
|
||||
public ULinearLayout(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
a(context, attributeSet);
|
||||
}
|
||||
|
||||
@Override // android.widget.LinearLayout, android.view.ViewGroup
|
||||
public LinearLayout.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
|
||||
return new LayoutParams(getContext(), attributeSet);
|
||||
}
|
||||
}
|
146
sources/com/ubtech/view/widget/UViewFlipper.java
Normal file
146
sources/com/ubtech/view/widget/UViewFlipper.java
Normal file
@@ -0,0 +1,146 @@
|
||||
package com.ubtech.view.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.ViewFlipper;
|
||||
import com.ubtech.R$styleable;
|
||||
import com.ubtech.utils.DensityUtils;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class UViewFlipper extends ViewFlipper {
|
||||
private int a;
|
||||
private float b;
|
||||
|
||||
public static class LayoutParams extends FrameLayout.LayoutParams {
|
||||
private float a;
|
||||
private float b;
|
||||
private float c;
|
||||
private float d;
|
||||
private float e;
|
||||
private float f;
|
||||
|
||||
public LayoutParams(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.u_layout, 0, 0);
|
||||
this.a = obtainStyledAttributes.getFloat(R$styleable.u_layout_height_percent, 0.0f);
|
||||
this.b = obtainStyledAttributes.getFloat(R$styleable.u_layout_width_percent, 0.0f);
|
||||
this.c = obtainStyledAttributes.getFloat(R$styleable.u_layout_margin_left_percent, 0.0f);
|
||||
this.d = obtainStyledAttributes.getFloat(R$styleable.u_layout_margin_top_percent, 0.0f);
|
||||
this.e = obtainStyledAttributes.getFloat(R$styleable.u_layout_margin_right_percent, 0.0f);
|
||||
this.f = obtainStyledAttributes.getFloat(R$styleable.u_layout_margin_bottom_percent, 0.0f);
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
|
||||
public float a() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
public float b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public float c() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public float d() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public float e() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public float f() {
|
||||
return this.b;
|
||||
}
|
||||
}
|
||||
|
||||
public UViewFlipper(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
private void a(Context context, AttributeSet attributeSet) {
|
||||
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
|
||||
this.a = Math.min(displayMetrics.widthPixels, displayMetrics.heightPixels);
|
||||
this.b = this.a / (DensityUtils.a(context, 720) * 1.0f);
|
||||
}
|
||||
|
||||
@Override // android.widget.ViewAnimator, android.view.ViewGroup
|
||||
public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) {
|
||||
super.addView(view, i, layoutParams);
|
||||
if (view instanceof TextView) {
|
||||
TextView textView = (TextView) view;
|
||||
textView.setTextSize(0, textView.getTextSize() * this.b);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.FrameLayout, 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);
|
||||
}
|
||||
|
||||
@Override // android.widget.FrameLayout, android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
float f;
|
||||
float f2;
|
||||
float f3;
|
||||
float f4;
|
||||
float f5;
|
||||
float f6;
|
||||
for (int i3 = 0; i3 < getChildCount(); i3++) {
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) getChildAt(i3).getLayoutParams();
|
||||
if (layoutParams instanceof LayoutParams) {
|
||||
LayoutParams layoutParams2 = (LayoutParams) layoutParams;
|
||||
f2 = layoutParams2.f();
|
||||
f3 = layoutParams2.b();
|
||||
f4 = layoutParams2.c();
|
||||
f5 = layoutParams2.e();
|
||||
f6 = layoutParams2.d();
|
||||
f = layoutParams2.a();
|
||||
} else {
|
||||
f = 0.0f;
|
||||
f2 = 0.0f;
|
||||
f3 = 0.0f;
|
||||
f4 = 0.0f;
|
||||
f5 = 0.0f;
|
||||
f6 = 0.0f;
|
||||
}
|
||||
if (f3 != 0.0f) {
|
||||
layoutParams.height = (int) Math.ceil(this.a * f3);
|
||||
}
|
||||
if (f2 != 0.0f) {
|
||||
layoutParams.width = (int) Math.ceil(layoutParams.height * f2);
|
||||
}
|
||||
if (f4 != 0.0f) {
|
||||
layoutParams.leftMargin = (int) Math.ceil(this.a * f4);
|
||||
}
|
||||
if (f5 != 0.0f) {
|
||||
layoutParams.topMargin = (int) Math.ceil(this.a * f5);
|
||||
}
|
||||
if (f6 != 0.0f) {
|
||||
layoutParams.rightMargin = (int) Math.ceil(this.a * f6);
|
||||
}
|
||||
if (f != 0.0f) {
|
||||
layoutParams.bottomMargin = (int) Math.ceil(this.a * f);
|
||||
}
|
||||
}
|
||||
super.onMeasure(i, i2);
|
||||
}
|
||||
|
||||
public UViewFlipper(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
a(context, attributeSet);
|
||||
}
|
||||
|
||||
@Override // android.widget.FrameLayout, android.view.ViewGroup
|
||||
public FrameLayout.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
|
||||
return new LayoutParams(getContext(), attributeSet);
|
||||
}
|
||||
}
|
66
sources/com/ubtech/view/widget/UWebLayout.java
Normal file
66
sources/com/ubtech/view/widget/UWebLayout.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package com.ubtech.view.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.FrameLayout;
|
||||
import com.ubtech.R$id;
|
||||
import com.ubtech.R$layout;
|
||||
import com.ubtech.view.widget.AWebView;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class UWebLayout extends FrameLayout {
|
||||
private AWebView a;
|
||||
|
||||
public UWebLayout(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
private void a(Context context, AttributeSet attributeSet) {
|
||||
LayoutInflater.from(context).inflate(R$layout.lay_webview, this);
|
||||
this.a = (AWebView) findViewById(R$id.wv_content);
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
this.a.removeJavascriptInterface("searchBoxJavaBridge_");
|
||||
this.a.removeJavascriptInterface("accessibility");
|
||||
this.a.removeJavascriptInterface("accessibilityTraversal");
|
||||
}
|
||||
WebSettings settings = this.a.getSettings();
|
||||
settings.setJavaScriptEnabled(true);
|
||||
settings.setDomStorageEnabled(true);
|
||||
settings.setAllowFileAccess(true);
|
||||
settings.setSupportZoom(true);
|
||||
settings.setCacheMode(-1);
|
||||
settings.setBuiltInZoomControls(false);
|
||||
settings.setLoadsImagesAutomatically(true);
|
||||
settings.setDefaultTextEncodingName("UTF-8");
|
||||
settings.setLoadWithOverviewMode(true);
|
||||
}
|
||||
|
||||
public WebView b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public void setOnScollChangeListener(AWebView.WebViewScrollChangeListener webViewScrollChangeListener) {
|
||||
this.a.setOnScrollChangeListener(webViewScrollChangeListener);
|
||||
}
|
||||
|
||||
public UWebLayout(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
public UWebLayout(Context context, AttributeSet attributeSet, int i) {
|
||||
this(context, attributeSet, i, 0);
|
||||
}
|
||||
|
||||
public UWebLayout(Context context, AttributeSet attributeSet, int i, int i2) {
|
||||
super(context, attributeSet, i, i2);
|
||||
a(context, attributeSet);
|
||||
}
|
||||
|
||||
public WebSettings a() {
|
||||
return this.a.getSettings();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user