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,68 @@
package com.ubt.jimu.widgets;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import butterknife.ButterKnife;
import com.ubt.jimu.R;
import com.ubt.jimu.R$styleable;
import com.ubtech.view.widget.ULinearLayout;
/* loaded from: classes2.dex */
public class BottomShadowLayout extends ULinearLayout {
LinearLayout bottomShadowLayout;
private View.OnClickListener c;
ImageView imageView;
TextView textView;
public BottomShadowLayout(Context context) {
this(context, null);
}
public void a(int i, int i2) {
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.bottomShadowLayout.getLayoutParams();
layoutParams.width = i;
layoutParams.height = i2;
this.bottomShadowLayout.setLayoutParams(layoutParams);
}
public void onClick(View view) {
View.OnClickListener onClickListener = this.c;
if (onClickListener != null) {
onClickListener.onClick(view);
}
}
public void setListener(View.OnClickListener onClickListener) {
this.c = onClickListener;
}
public void setText(String str) {
TextView textView = this.textView;
if (textView != null) {
textView.setText(str);
}
}
public BottomShadowLayout(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
ButterKnife.a(this, LayoutInflater.from(context).inflate(R.layout.bottom_shadow_layout, (ViewGroup) this, true));
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.bottom_shadow, 0, 0);
int resourceId = obtainStyledAttributes.getResourceId(0, 0);
if (resourceId != 0) {
this.imageView.setImageResource(resourceId);
}
this.textView.setText(obtainStyledAttributes.getString(1));
int color = obtainStyledAttributes.getColor(2, -1);
if (color != 0) {
this.textView.setTextColor(color);
}
obtainStyledAttributes.recycle();
}
}

View File

@@ -0,0 +1,45 @@
package com.ubt.jimu.widgets;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import butterknife.Unbinder;
import butterknife.internal.DebouncingOnClickListener;
import butterknife.internal.Utils;
import com.ubt.jimu.R;
/* loaded from: classes2.dex */
public class BottomShadowLayout_ViewBinding implements Unbinder {
private BottomShadowLayout b;
private View c;
public BottomShadowLayout_ViewBinding(final BottomShadowLayout bottomShadowLayout, View view) {
this.b = bottomShadowLayout;
View a = Utils.a(view, R.id.bottomShadowLayout, "field 'bottomShadowLayout' and method 'onClick'");
bottomShadowLayout.bottomShadowLayout = (LinearLayout) Utils.a(a, R.id.bottomShadowLayout, "field 'bottomShadowLayout'", LinearLayout.class);
this.c = a;
a.setOnClickListener(new DebouncingOnClickListener(this) { // from class: com.ubt.jimu.widgets.BottomShadowLayout_ViewBinding.1
@Override // butterknife.internal.DebouncingOnClickListener
public void doClick(View view2) {
bottomShadowLayout.onClick(view2);
}
});
bottomShadowLayout.imageView = (ImageView) Utils.b(view, R.id.imageView, "field 'imageView'", ImageView.class);
bottomShadowLayout.textView = (TextView) Utils.b(view, R.id.textView, "field 'textView'", TextView.class);
}
@Override // butterknife.Unbinder
public void unbind() {
BottomShadowLayout bottomShadowLayout = this.b;
if (bottomShadowLayout == null) {
throw new IllegalStateException("Bindings already cleared.");
}
this.b = null;
bottomShadowLayout.bottomShadowLayout = null;
bottomShadowLayout.imageView = null;
bottomShadowLayout.textView = null;
this.c.setOnClickListener(null);
this.c = null;
}
}

View File

@@ -0,0 +1,25 @@
package com.ubt.jimu.widgets;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
/* loaded from: classes2.dex */
public class BottomShadowXLayout extends LinearLayout {
private View.OnClickListener a;
LinearLayout bottomShadowLayout;
ImageView imageView;
TextView textView;
public void onClick(View view) {
View.OnClickListener onClickListener = this.a;
if (onClickListener != null) {
onClickListener.onClick(view);
}
}
public void setListener(View.OnClickListener onClickListener) {
this.a = onClickListener;
}
}

View File

@@ -0,0 +1,45 @@
package com.ubt.jimu.widgets;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import butterknife.Unbinder;
import butterknife.internal.DebouncingOnClickListener;
import butterknife.internal.Utils;
import com.ubt.jimu.R;
/* loaded from: classes2.dex */
public class BottomShadowXLayout_ViewBinding implements Unbinder {
private BottomShadowXLayout b;
private View c;
public BottomShadowXLayout_ViewBinding(final BottomShadowXLayout bottomShadowXLayout, View view) {
this.b = bottomShadowXLayout;
View a = Utils.a(view, R.id.bottomShadowLayout, "field 'bottomShadowLayout' and method 'onClick'");
bottomShadowXLayout.bottomShadowLayout = (LinearLayout) Utils.a(a, R.id.bottomShadowLayout, "field 'bottomShadowLayout'", LinearLayout.class);
this.c = a;
a.setOnClickListener(new DebouncingOnClickListener(this) { // from class: com.ubt.jimu.widgets.BottomShadowXLayout_ViewBinding.1
@Override // butterknife.internal.DebouncingOnClickListener
public void doClick(View view2) {
bottomShadowXLayout.onClick(view2);
}
});
bottomShadowXLayout.imageView = (ImageView) Utils.b(view, R.id.imageView, "field 'imageView'", ImageView.class);
bottomShadowXLayout.textView = (TextView) Utils.b(view, R.id.textView, "field 'textView'", TextView.class);
}
@Override // butterknife.Unbinder
public void unbind() {
BottomShadowXLayout bottomShadowXLayout = this.b;
if (bottomShadowXLayout == null) {
throw new IllegalStateException("Bindings already cleared.");
}
this.b = null;
bottomShadowXLayout.bottomShadowLayout = null;
bottomShadowXLayout.imageView = null;
bottomShadowXLayout.textView = null;
this.c.setOnClickListener(null);
this.c = null;
}
}

View File

@@ -0,0 +1,127 @@
package com.ubt.jimu.widgets;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.EditText;
import com.ubt.jimu.R;
/* loaded from: classes2.dex */
public class ClearEditText extends EditText implements View.OnFocusChangeListener, TextWatcher {
private Drawable a;
private boolean b;
private Callback c;
private onFocuschangeListener d;
public interface Callback {
void a();
}
public interface onFocuschangeListener {
void a(boolean z);
}
public ClearEditText(Context context) {
this(context, null);
}
private void a() {
this.a = getCompoundDrawables()[2];
if (this.a == null) {
this.a = getResources().getDrawable(R.drawable.ic_edit_delete);
}
Drawable drawable = this.a;
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), this.a.getIntrinsicHeight());
setClearIconVisible(false);
setOnFocusChangeListener(this);
addTextChangedListener(this);
setImeOptions(33554438);
}
@Override // android.text.TextWatcher
public void afterTextChanged(Editable editable) {
Callback callback;
if (!TextUtils.isEmpty(editable.toString().trim()) || (callback = this.c) == null) {
return;
}
callback.a();
}
@Override // android.text.TextWatcher
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override // android.view.View.OnFocusChangeListener
public void onFocusChange(View view, boolean z) {
this.b = z;
if (z) {
setClearIconVisible(getText().length() > 0);
} else {
setClearIconVisible(false);
}
onFocuschangeListener onfocuschangelistener = this.d;
if (onfocuschangelistener != null) {
onfocuschangelistener.a(z);
}
}
@Override // android.widget.TextView, 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.TextView, android.view.View
protected void onMeasure(int i, int i2) {
super.onMeasure(i, i2);
int height = getHeight();
int intrinsicHeight = this.a.getIntrinsicHeight();
int i3 = height / 2;
if (intrinsicHeight <= i3) {
i3 = intrinsicHeight;
}
this.a.setBounds(0, 0, i3, i3);
}
@Override // android.widget.TextView, android.text.TextWatcher
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
if (this.b) {
setClearIconVisible(charSequence.length() > 0);
}
}
@Override // android.widget.TextView, android.view.View
public boolean onTouchEvent(MotionEvent motionEvent) {
if (motionEvent.getAction() == 1 && getCompoundDrawables()[2] != null) {
if (motionEvent.getX() > ((float) (getWidth() - getTotalPaddingRight())) && motionEvent.getX() < ((float) (getWidth() - getPaddingRight()))) {
setText("");
}
}
return super.onTouchEvent(motionEvent);
}
public void setCallback(Callback callback) {
this.c = callback;
}
public void setClearIconVisible(boolean z) {
setCompoundDrawables(getCompoundDrawables()[0], getCompoundDrawables()[1], z ? this.a : null, getCompoundDrawables()[3]);
}
public void setOnFocuschangeListener(onFocuschangeListener onfocuschangelistener) {
this.d = onfocuschangelistener;
}
public ClearEditText(Context context, AttributeSet attributeSet) {
this(context, attributeSet, android.R.attr.editTextStyle);
}
public ClearEditText(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
a();
}
}

View File

@@ -0,0 +1,38 @@
package com.ubt.jimu.widgets;
import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.View;
/* loaded from: classes2.dex */
public class ClickableSpanListener extends ClickableSpan {
private View.OnClickListener a;
private boolean b;
private int c;
public ClickableSpanListener(View.OnClickListener onClickListener, boolean z, int i) {
this.b = true;
this.c = Integer.MAX_VALUE;
this.a = onClickListener;
this.b = z;
this.c = i;
}
@Override // android.text.style.ClickableSpan
public void onClick(View view) {
View.OnClickListener onClickListener = this.a;
if (onClickListener != null) {
onClickListener.onClick(view);
}
}
@Override // android.text.style.ClickableSpan, android.text.style.CharacterStyle
public void updateDrawState(TextPaint textPaint) {
super.updateDrawState(textPaint);
textPaint.setUnderlineText(this.b);
int i = this.c;
if (i != Integer.MAX_VALUE) {
textPaint.setColor(i);
}
}
}

View File

@@ -0,0 +1,212 @@
package com.ubt.jimu.widgets;
import android.app.Activity;
import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.twitter.sdk.android.core.TwitterAuthConfig;
import com.ubt.jimu.R;
import com.ubt.jimu.R$styleable;
import com.ubt.jimu.utils.InputMethod;
import com.ubtrobot.log.ALog;
/* loaded from: classes2.dex */
public class CommentKeyBoard extends LinearLayout {
private String a;
private Activity b;
private RelativeLayout c;
private FrameLayout d;
private boolean e;
private int f;
private ImageView g;
private ImageView h;
private EditText i;
private TextView j;
private KeyBoardCommentListener k;
public interface KeyBoardCommentListener {
void onHideView();
void onKeyBoardCommitListener(String str);
}
public CommentKeyBoard(Context context) {
super(context);
this.a = "CommentKeyBoard";
this.e = true;
this.f = TwitterAuthConfig.DEFAULT_AUTH_REQUEST_CODE;
a(context, (AttributeSet) null);
}
static /* synthetic */ boolean a(View view, MotionEvent motionEvent) {
return true;
}
private void d(View view) {
this.c = (RelativeLayout) view.findViewById(R.id.rl_keyboard);
this.g = (ImageView) view.findViewById(R.id.cancel);
this.h = (ImageView) view.findViewById(R.id.commit);
this.i = (EditText) view.findViewById(R.id.edit_comment);
this.j = (TextView) view.findViewById(R.id.text_count);
this.d = (FrameLayout) view.findViewById(R.id.fm_cancel);
}
@Override // android.view.View
public boolean onTouchEvent(MotionEvent motionEvent) {
return this.e;
}
public void setAuthor(String str) {
String str2 = "@" + str + " ";
this.i.setText(str2);
this.i.setSelection(str2.length());
}
public void setCommentKey(boolean z) {
}
public void setEditTextContent(String str) {
this.i.setText(str);
}
public void setOnTouch(boolean z) {
this.e = z;
}
public void setTextCount(int i) {
this.f = i;
}
public void setonKeyBoardCommitListener(KeyBoardCommentListener keyBoardCommentListener) {
this.k = keyBoardCommentListener;
}
private void a(Context context, AttributeSet attributeSet) {
this.b = (Activity) context;
this.b.obtainStyledAttributes(attributeSet, R$styleable.CommentKeyBoard).getBoolean(0, false);
View inflate = LayoutInflater.from(context).inflate(R.layout.layout_comment_keyboard, (ViewGroup) this, true);
this.b.getWindow().getDecorView();
ALog.a(this.a).c("view 的地址根===" + inflate.toString(), new Object[0]);
d(inflate);
c();
setVisibility(8);
}
private void c() {
this.c.setOnTouchListener(new View.OnTouchListener() { // from class: com.ubt.jimu.widgets.c
@Override // android.view.View.OnTouchListener
public final boolean onTouch(View view, MotionEvent motionEvent) {
return CommentKeyBoard.a(view, motionEvent);
}
});
this.h.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.d
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
CommentKeyBoard.this.a(view);
}
});
this.g.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.a
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
CommentKeyBoard.this.b(view);
}
});
this.d.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.b
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
CommentKeyBoard.this.c(view);
}
});
this.i.addTextChangedListener(new TextWatcher() { // from class: com.ubt.jimu.widgets.CommentKeyBoard.1
@Override // android.text.TextWatcher
public void afterTextChanged(Editable editable) {
if (editable == null || editable.toString().length() <= 0) {
CommentKeyBoard.this.j.setText("0/" + CommentKeyBoard.this.f);
CommentKeyBoard.this.h.setSelected(false);
return;
}
CommentKeyBoard.this.j.setText(String.format("%s/" + CommentKeyBoard.this.f, Integer.valueOf(editable.toString().length())));
CommentKeyBoard.this.h.setSelected(true);
}
@Override // android.text.TextWatcher
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override // android.text.TextWatcher
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
});
}
public /* synthetic */ void b(View view) {
KeyBoardCommentListener keyBoardCommentListener = this.k;
if (keyBoardCommentListener != null) {
keyBoardCommentListener.onHideView();
}
a();
}
public void b() {
setVisibility(0);
d();
ALog.a(this.a).c("键盘+" + this.i.isFocusable() + "comment==", new Object[0]);
InputMethod.c(this.b, this.i);
}
public CommentKeyBoard(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.a = "CommentKeyBoard";
this.e = true;
this.f = TwitterAuthConfig.DEFAULT_AUTH_REQUEST_CODE;
a(context, attributeSet);
}
private void d() {
this.i.setFocusable(true);
this.i.setFocusableInTouchMode(true);
this.i.requestFocus();
}
public /* synthetic */ void c(View view) {
KeyBoardCommentListener keyBoardCommentListener = this.k;
if (keyBoardCommentListener != null) {
keyBoardCommentListener.onHideView();
}
a();
}
public CommentKeyBoard(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.a = "CommentKeyBoard";
this.e = true;
this.f = TwitterAuthConfig.DEFAULT_AUTH_REQUEST_CODE;
a(context, attributeSet);
}
public /* synthetic */ void a(View view) {
KeyBoardCommentListener keyBoardCommentListener;
String trim = this.i.getText().toString().trim();
if ("".equals(trim) || (keyBoardCommentListener = this.k) == null) {
return;
}
keyBoardCommentListener.onKeyBoardCommitListener(trim);
this.i.setText("");
}
public void a() {
setVisibility(8);
InputMethod.a(this.b, this.i);
}
}

View File

@@ -0,0 +1,91 @@
package com.ubt.jimu.widgets;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.EditText;
import com.ubt.jimu.R;
import com.ubt.jimu.R$styleable;
@SuppressLint({"AppCompatCustomView"})
/* loaded from: classes2.dex */
public class EditTextWithDel extends EditText {
private Context a;
private Drawable b;
public EditTextWithDel(Context context) {
this(context, null);
}
@Override // android.widget.TextView, android.view.View
public boolean onTouchEvent(MotionEvent motionEvent) {
if (this.b != null && motionEvent.getAction() == 1) {
int x = (int) motionEvent.getX();
int y = (int) motionEvent.getY();
Rect rect = new Rect();
rect.right = getMeasuredWidth() - getPaddingRight();
rect.bottom = getMeasuredHeight() - getPaddingBottom();
rect.left = rect.right - this.b.getIntrinsicWidth();
rect.top = getPaddingTop();
if (rect.contains(x, y)) {
setText("");
}
}
return super.onTouchEvent(motionEvent);
}
public EditTextWithDel(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.a = context;
a(attributeSet);
}
private void a(AttributeSet attributeSet) {
TypedArray obtainStyledAttributes = this.a.obtainStyledAttributes(attributeSet, R$styleable.EditTextWithDel);
this.b = this.a.getResources().getDrawable(R.drawable.ic_edit_delete);
obtainStyledAttributes.getDimension(0, 20.0f);
addTextChangedListener(new TextWatcher() { // from class: com.ubt.jimu.widgets.EditTextWithDel.1
@Override // android.text.TextWatcher
public void afterTextChanged(Editable editable) {
EditTextWithDel.this.a();
}
@Override // android.text.TextWatcher
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override // android.text.TextWatcher
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
});
a();
}
public EditTextWithDel(Context context, AttributeSet attributeSet, int i) {
this(context, attributeSet);
}
/* JADX INFO: Access modifiers changed from: private */
public void a() {
post(new Runnable() { // from class: com.ubt.jimu.widgets.EditTextWithDel.2
@Override // java.lang.Runnable
public void run() {
int measuredHeight = (EditTextWithDel.this.getMeasuredHeight() * 3) / 4;
EditTextWithDel.this.b.setBounds(0, 0, measuredHeight, measuredHeight);
Drawable[] compoundDrawables = EditTextWithDel.this.getCompoundDrawables();
if (EditTextWithDel.this.length() < 1) {
EditTextWithDel.this.setCompoundDrawables(compoundDrawables[0], compoundDrawables[1], null, compoundDrawables[3]);
} else {
EditTextWithDel editTextWithDel = EditTextWithDel.this;
editTextWithDel.setCompoundDrawables(compoundDrawables[0], compoundDrawables[1], editTextWithDel.b, compoundDrawables[3]);
}
}
});
}
}

View File

@@ -0,0 +1,92 @@
package com.ubt.jimu.widgets;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.ubt.jimu.R;
/* loaded from: classes2.dex */
public class FeedBackTypeLayout extends LinearLayout {
private TextView a;
private TextView b;
private ISelectCallBack c;
private Context d;
public interface ISelectCallBack {
void a();
void b();
}
public FeedBackTypeLayout(Context context) {
super(context);
}
private void a(Context context) {
this.d = context;
View inflate = LayoutInflater.from(context).inflate(R.layout.view_feedback_type, (ViewGroup) null, false);
this.a = (TextView) inflate.findViewById(R.id.left);
this.b = (TextView) inflate.findViewById(R.id.right);
this.a.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.f
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
FeedBackTypeLayout.this.a(view);
}
});
this.b.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.e
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
FeedBackTypeLayout.this.b(view);
}
});
addView(inflate);
}
public /* synthetic */ void b(View view) {
ISelectCallBack iSelectCallBack = this.c;
if (iSelectCallBack != null) {
iSelectCallBack.b();
}
b();
}
public void setiSelectCallBack(ISelectCallBack iSelectCallBack) {
this.c = iSelectCallBack;
}
public FeedBackTypeLayout(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
a(context);
}
public FeedBackTypeLayout(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
a(context);
}
public void b() {
this.b.setBackgroundDrawable(this.d.getResources().getDrawable(R.drawable.shape_feaa06));
this.a.setBackgroundDrawable(null);
this.a.setTextColor(this.d.getResources().getColor(R.color.bg_A00A9FF));
this.b.setTextColor(this.d.getResources().getColor(R.color.bg_FFFFFF));
}
public /* synthetic */ void a(View view) {
ISelectCallBack iSelectCallBack = this.c;
if (iSelectCallBack != null) {
iSelectCallBack.a();
}
a();
}
public void a() {
this.a.setBackgroundDrawable(this.d.getResources().getDrawable(R.drawable.shape_feaa06));
this.b.setBackgroundDrawable(null);
this.a.setTextColor(this.d.getResources().getColor(R.color.bg_FFFFFF));
this.b.setTextColor(this.d.getResources().getColor(R.color.bg_A00A9FF));
}
}

View File

@@ -0,0 +1,26 @@
package com.ubt.jimu.widgets;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import androidx.viewpager.widget.ViewPager;
/* loaded from: classes2.dex */
public class ForbidViewpager extends ViewPager {
private boolean k0;
public ForbidViewpager(Context context) {
super(context);
this.k0 = false;
}
@Override // androidx.viewpager.widget.ViewPager, android.view.ViewGroup
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
return this.k0 && super.onInterceptTouchEvent(motionEvent);
}
public ForbidViewpager(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.k0 = false;
}
}

View File

@@ -0,0 +1,151 @@
package com.ubt.jimu.widgets;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.LinearInterpolator;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatDialog;
import com.ubt.jimu.JimuApplication;
import com.ubt.jimu.R;
import com.ubtech.utils.DisplayUtil;
/* loaded from: classes2.dex */
public class JAlertDialog extends AppCompatDialog {
private String c;
private boolean d;
private int e;
private TextView f;
private ImageView g;
public static class Builder {
private Context a;
private JAlertDialog b;
public Builder(Context context) {
this.a = context;
this.b = new JAlertDialog(context);
}
public Builder a(String str) {
this.b.c = str;
return this;
}
public Builder b(int i) {
this.b.c = this.a.getString(i);
return this;
}
public Builder a(int i) {
this.b.e = i;
return this;
}
public Builder b(boolean z) {
this.b.setCancelable(z);
return this;
}
public Builder a(boolean z) {
this.b.d = z;
return this;
}
public JAlertDialog a() {
View inflate = LayoutInflater.from(this.a).inflate(R.layout.alert_dialog, (ViewGroup) null, false);
ImageView imageView = (ImageView) inflate.findViewById(R.id.imageView);
if (this.b.e != 0) {
imageView.setImageResource(this.b.e);
}
TextView textView = (TextView) inflate.findViewById(R.id.textView);
if (!TextUtils.isEmpty(this.b.c)) {
textView.setText(this.b.c);
} else {
textView.setVisibility(8);
}
if (this.b.d) {
JAlertDialog.b(imageView);
}
this.b.f = textView;
this.b.g = imageView;
this.b.setContentView(inflate);
Window window = this.b.getWindow();
WindowManager.LayoutParams attributes = window.getAttributes();
window.setBackgroundDrawableResource(R.color.translucent);
window.setWindowAnimations(R.style.dialogWindowAlphaIn);
int b = DisplayUtil.b(this.a);
int a = DisplayUtil.a(this.a);
boolean i = JimuApplication.l().i();
int max = Math.max(b, a);
int min = Math.min(b, a);
attributes.width = i ? max / 5 : (max * 11) / 50;
attributes.height = i ? min / 4 : (min * 17) / 50;
attributes.gravity = 17;
window.setAttributes(attributes);
return this.b;
}
}
public JAlertDialog(Context context) {
this(context, R.style.common_alert_dialog);
}
@Override // android.app.Dialog, android.content.DialogInterface
public void dismiss() {
ImageView imageView = this.g;
if (imageView != null) {
imageView.post(new Runnable() { // from class: com.ubt.jimu.widgets.JAlertDialog.1
@Override // java.lang.Runnable
public void run() {
JAlertDialog.this.g.clearAnimation();
}
});
}
super.dismiss();
}
public JAlertDialog(Context context, int i) {
super(context, i);
setCanceledOnTouchOutside(false);
}
public void b(int i) {
ImageView imageView = this.g;
if (imageView != null) {
imageView.setImageResource(i);
}
}
/* JADX INFO: Access modifiers changed from: private */
public static void b(View view) {
ObjectAnimator ofFloat = ObjectAnimator.ofFloat(view, "rotation", 0.0f, 180.0f, 360.0f);
ofFloat.setRepeatCount(-1);
ofFloat.setRepeatMode(1);
ofFloat.setDuration(1200L);
ofFloat.setInterpolator(new LinearInterpolator());
ofFloat.start();
}
public void a(String str) {
TextView textView = this.f;
if (textView != null) {
textView.setText(str);
}
}
public void a(boolean z) {
ImageView imageView = this.g;
if (imageView == null || !z) {
return;
}
this.d = true;
b(imageView);
}
}

View File

@@ -0,0 +1,220 @@
package com.ubt.jimu.widgets;
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.ubt.jimu.R;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
import java.util.concurrent.TimeUnit;
/* loaded from: classes2.dex */
public class LoadStateView extends RelativeLayout {
private Context a;
private View b;
private ImageView c;
private ImageView d;
private TextView e;
private RelativeLayout f;
private RetryListener g;
/* renamed from: com.ubt.jimu.widgets.LoadStateView$6, reason: invalid class name */
static /* synthetic */ class AnonymousClass6 {
static final /* synthetic */ int[] a = new int[LoadState.values().length];
static {
try {
a[LoadState.LOADING.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[LoadState.SUCCEED.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
a[LoadState.FAILURE.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
a[LoadState.EMPTY.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
}
}
public enum LoadState {
LOADING,
SUCCEED,
FAILURE,
EMPTY
}
public interface RetryListener {
void p0();
}
public LoadStateView(Context context) {
super(context);
this.a = context;
d();
b();
c();
}
private void b() {
}
private void e() {
this.b.setVisibility(0);
Observable.timer(500L, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.b()).observeOn(AndroidSchedulers.a()).subscribe(new Consumer<Long>() { // from class: com.ubt.jimu.widgets.LoadStateView.3
@Override // io.reactivex.functions.Consumer
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public void accept(Long l) throws Exception {
LoadStateView.this.e.setText(R.string.loading_error);
LoadStateView.this.c.setVisibility(8);
LoadStateView.this.c.clearAnimation();
LoadStateView.this.d.setVisibility(0);
LoadStateView.this.d.setBackgroundResource(R.drawable.ic_network_error);
}
});
}
private void f() {
if (this.c.getVisibility() == 8) {
this.b.setVisibility(0);
this.c.setVisibility(0);
this.d.setVisibility(4);
this.e.setText(R.string.loading_text);
a(this.c);
}
}
public void setLoadViewBackColor(int i) {
this.b.setBackgroundColor(this.a.getResources().getColor(i));
}
public void setRetryListener(RetryListener retryListener) {
this.g = retryListener;
}
public void setTextColor(int i) {
this.e.setTextColor(this.a.getResources().getColor(i));
}
/* JADX INFO: Access modifiers changed from: private */
public void b(final View view) {
ObjectAnimator ofFloat = ObjectAnimator.ofFloat(view, "alpha", 1.0f, 0.0f);
ofFloat.setDuration(500L);
ofFloat.addListener(new Animator.AnimatorListener() { // from class: com.ubt.jimu.widgets.LoadStateView.5
@Override // android.animation.Animator.AnimatorListener
public void onAnimationCancel(Animator animator) {
}
@Override // android.animation.Animator.AnimatorListener
public void onAnimationEnd(Animator animator) {
LoadStateView.this.c.clearAnimation();
LoadStateView.this.c.setVisibility(8);
view.setVisibility(8);
}
@Override // android.animation.Animator.AnimatorListener
public void onAnimationRepeat(Animator animator) {
}
@Override // android.animation.Animator.AnimatorListener
public void onAnimationStart(Animator animator) {
}
});
ofFloat.start();
}
private void c() {
this.f.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.LoadStateView.1
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (LoadStateView.this.g != null) {
LoadStateView.this.g.p0();
}
}
});
}
private void d() {
this.b = View.inflate(this.a, R.layout.layout_loading_view, this);
this.b.setVisibility(8);
this.c = (ImageView) this.b.findViewById(R.id.im_loading);
this.c.setVisibility(8);
this.d = (ImageView) this.b.findViewById(R.id.im_load_state);
this.e = (TextView) this.b.findViewById(R.id.tv_load_state_des);
this.f = (RelativeLayout) this.b.findViewById(R.id.rl_re);
}
public void a(LoadState loadState) {
int i = AnonymousClass6.a[loadState.ordinal()];
if (i == 1) {
f();
return;
}
if (i == 2) {
a(this.b);
} else if (i == 3) {
e();
} else {
if (i != 4) {
return;
}
a();
}
}
public LoadStateView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.a = context;
d();
b();
c();
}
private void a() {
this.b.setVisibility(0);
Observable.timer(500L, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.b()).observeOn(AndroidSchedulers.a()).subscribe(new Consumer<Long>() { // from class: com.ubt.jimu.widgets.LoadStateView.2
@Override // io.reactivex.functions.Consumer
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public void accept(Long l) throws Exception {
LoadStateView.this.e.setText(R.string.loading_service_error);
LoadStateView.this.c.setVisibility(8);
LoadStateView.this.c.clearAnimation();
LoadStateView.this.d.setVisibility(0);
LoadStateView.this.d.setBackgroundResource(R.drawable.ic_try_reload);
}
});
}
private void a(final View view) {
Observable.timer(500L, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.b()).observeOn(AndroidSchedulers.a()).subscribe(new Consumer<Long>() { // from class: com.ubt.jimu.widgets.LoadStateView.4
@Override // io.reactivex.functions.Consumer
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public void accept(Long l) throws Exception {
LoadStateView.this.b(view);
}
});
}
private void a(ImageView imageView) {
Animation loadAnimation = AnimationUtils.loadAnimation(this.a, R.anim.rotate_anim);
loadAnimation.setInterpolator(new LinearInterpolator());
if (loadAnimation != null) {
imageView.startAnimation(loadAnimation);
}
}
}

View File

@@ -0,0 +1,245 @@
package com.ubt.jimu.widgets;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.ubt.jimu.R;
import com.ubt.jimu.base.http.manager.CommunityManager;
import com.ubt.jimu.base.http.manager.Manager;
import com.ubt.jimu.base.http.manager.SubscriberModel;
import com.ubt.jimu.utils.LogUtils;
/* loaded from: classes2.dex */
public class LoadingView extends RelativeLayout {
private LayoutInflater a;
private ImageView b;
private RelativeLayout c;
private RotateAnimation d;
private TextView e;
private ImageView f;
private TextView g;
private Context h;
private int i;
private int j;
private int k;
private boolean l;
private RetryRequest m;
public interface RetryRequest {
void OnRetryListener();
}
public LoadingView(Context context) {
super(context);
this.l = false;
a(context);
}
private void a(Context context) {
this.a = LayoutInflater.from(context);
this.h = context;
View inflate = this.a.inflate(R.layout.loading_common, (ViewGroup) this, false);
this.b = (ImageView) inflate.findViewById(R.id.img_loading);
this.c = (RelativeLayout) inflate.findViewById(R.id.rl_loading);
this.e = (TextView) inflate.findViewById(R.id.tv_loading);
this.f = (ImageView) inflate.findViewById(R.id.img_loading_error);
this.g = (TextView) inflate.findViewById(R.id.tv_net_error);
addView(inflate);
this.c.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.g
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
LoadingView.this.a(view);
}
});
}
public void b() {
if (this.l) {
return;
}
this.k++;
if (this.j == this.k) {
setVisibility(8);
this.c.setVisibility(8);
this.f.setVisibility(8);
this.g.setVisibility(8);
this.b.clearAnimation();
RotateAnimation rotateAnimation = this.d;
if (rotateAnimation != null) {
rotateAnimation.cancel();
}
}
}
public void c() {
if (this.d == null) {
this.d = new RotateAnimation(0.0f, 359.0f, 1, 0.5f, 1, 0.5f);
this.d.setRepeatCount(-1);
this.d.setDuration(800L);
this.d.setInterpolator(new LinearInterpolator());
this.d.setRepeatMode(1);
}
setVisibility(0);
this.c.setVisibility(0);
this.f.setVisibility(8);
this.g.setVisibility(8);
this.e.setVisibility(0);
this.b.setVisibility(0);
this.b.startAnimation(this.d);
}
public void d() {
setVisibility(0);
this.c.setVisibility(0);
this.f.setVisibility(0);
this.g.setVisibility(0);
this.e.setVisibility(8);
this.b.setVisibility(8);
this.b.clearAnimation();
this.f.setImageResource(R.drawable.ic_network_error);
this.g.setText(R.string.loading_error);
}
public void e() {
a(R.string.loading_service_error, R.drawable.ic_try_reload);
}
public void f() {
if (this.l) {
return;
}
this.k++;
if (this.j == this.k) {
h();
}
}
public void g() {
if (this.l) {
return;
}
if (this.d == null) {
this.d = new RotateAnimation(0.0f, 359.0f, 1, 0.5f, 1, 0.5f);
this.d.setRepeatCount(-1);
this.d.setDuration(800L);
this.d.setInterpolator(new LinearInterpolator());
this.d.setRepeatMode(1);
this.b.setAnimation(this.d);
}
if (this.j == this.k) {
setVisibility(0);
this.c.setVisibility(0);
this.f.setVisibility(8);
this.g.setVisibility(8);
this.e.setVisibility(0);
this.b.setVisibility(0);
this.b.startAnimation(this.d);
}
this.j++;
}
public void h() {
setVisibility(0);
this.c.setVisibility(0);
this.f.setVisibility(0);
this.g.setVisibility(0);
this.e.setVisibility(8);
this.b.setVisibility(8);
RotateAnimation rotateAnimation = this.d;
if (rotateAnimation != null) {
rotateAnimation.cancel();
}
}
public void setBackgroundViewColor(int i) {
RelativeLayout relativeLayout = this.c;
if (relativeLayout != null) {
relativeLayout.setBackgroundColor(i);
}
}
public void setIsRefresh(boolean z) {
this.l = z;
}
public void setOnRetryListener(RetryRequest retryRequest) {
this.m = retryRequest;
}
public void setServiceLoadingError(int i) {
this.f.setImageResource(i);
}
public void setServiceTextError(int i) {
this.g.setText(this.h.getString(i));
}
public LoadingView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.l = false;
a(context);
}
public LoadingView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.l = false;
a(context);
}
public /* synthetic */ void a(View view) {
RetryRequest retryRequest = this.m;
if (retryRequest != null) {
retryRequest.OnRetryListener();
return;
}
if (this.f.getVisibility() == 0) {
this.j = 0;
this.k = 0;
try {
if (this.i == 0) {
for (SubscriberModel subscriberModel : Manager.mList) {
CommunityManager.create().toSubscribe(subscriberModel.getObservable(), subscriberModel.getSubscriber());
}
return;
}
if (this.i <= Manager.mList.size()) {
for (int size = Manager.mList.size(); size > 0; size--) {
int i = size - 1;
CommunityManager.create().toSubscribe(Manager.mList.get(i).getObservable(), Manager.mList.get(i).getSubscriber());
this.i--;
if (this.i == 0) {
return;
}
}
return;
}
throw new Exception("设置的需要刷新的 条目 比总的请求数要多");
} catch (Exception e) {
LogUtils.c(e.toString());
}
}
}
public void a() {
this.b.clearAnimation();
}
public void a(int i, int i2) {
setVisibility(0);
this.c.setVisibility(0);
this.f.setVisibility(0);
this.g.setVisibility(0);
this.e.setVisibility(8);
this.b.setVisibility(8);
this.b.clearAnimation();
this.f.setImageResource(i2);
this.g.setText(i);
}
}

View File

@@ -0,0 +1,207 @@
package com.ubt.jimu.widgets;
import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.ubt.jimu.R;
import com.ubt.jimu.R$styleable;
/* loaded from: classes2.dex */
public class NavigationBarView extends RelativeLayout {
private ImageView a;
private TextView b;
private ImageView c;
private TextView d;
private OnActionClickListener e;
private int f;
private View.OnClickListener g;
public interface OnActionClickListener {
public static class Stub implements OnActionClickListener {
@Override // com.ubt.jimu.widgets.NavigationBarView.OnActionClickListener
public void onClick(View view) {
int id = view.getId();
if (id == R.id.iv_left) {
onLeftClick(view);
} else if (id == R.id.iv_right || id == R.id.tv_right) {
onRightClick(view);
}
}
public void onLeftClick(View view) {
if (view.getContext() instanceof Activity) {
((Activity) view.getContext()).finish();
}
}
public void onRightClick(View view) {
}
}
void onClick(View view);
}
public NavigationBarView(Context context) {
this(context, null);
}
private void a() {
setOnClickListener(new View.OnClickListener(this) { // from class: com.ubt.jimu.widgets.NavigationBarView.1
@Override // android.view.View.OnClickListener
public void onClick(View view) {
}
});
}
public View getRightIcon() {
return this.c;
}
public void setLeftIcon(int i) {
this.a.setBackgroundResource(i);
}
public void setLeftIvSrc(int i) {
this.a.setImageResource(i);
}
public void setListener(OnActionClickListener onActionClickListener) {
this.e = onActionClickListener;
}
public void setMode(int i) {
this.f = i;
if (i == 0) {
this.c.setVisibility(8);
this.d.setVisibility(8);
} else if (i == 1) {
this.c.setVisibility(0);
this.d.setVisibility(8);
} else if (i == 2) {
this.c.setVisibility(8);
this.d.setVisibility(0);
}
}
public void setRightAlpha(float f) {
int i = this.f;
if (i == 1) {
this.c.setAlpha(f);
} else if (i == 2) {
this.d.setAlpha(f);
}
}
public void setRightEnabled(boolean z) {
int i = this.f;
if (i == 1) {
this.c.setEnabled(z);
} else if (i == 2) {
this.d.setEnabled(z);
}
}
public void setRightIcon(int i) {
this.c.setVisibility(0);
this.d.setVisibility(8);
this.c.setBackgroundResource(i);
}
public void setRightIvSrc(int i) {
this.c.setVisibility(0);
this.d.setVisibility(8);
this.c.setImageResource(i);
}
public void setRightIvVisibility(int i) {
this.c.setVisibility(i);
}
public void setRightText(int i) {
this.c.setVisibility(8);
this.d.setVisibility(0);
this.d.setText(i);
}
public void setTitle(int i) {
this.b.setText(i);
}
public void setTitleColor(int i) {
this.b.setTextColor(i);
}
public NavigationBarView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
private void a(Context context, AttributeSet attributeSet) {
String str;
int i;
int i2 = 0;
if (attributeSet != null) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.NavigationBarView);
i = obtainStyledAttributes.getInt(1, 0);
str = obtainStyledAttributes.getString(4);
i2 = obtainStyledAttributes.getInt(3, 0);
obtainStyledAttributes.recycle();
} else {
str = "";
i = 0;
}
if (i2 == 0) {
LayoutInflater.from(context).inflate(R.layout.lay_navigation_bar, this);
} else if (i2 == 2) {
LayoutInflater.from(context).inflate(R.layout.lay_navigation_bar_min_round, this);
} else if (i2 == 3) {
LayoutInflater.from(context).inflate(R.layout.lay_navigation_bar_middle_round, this);
} else {
LayoutInflater.from(context).inflate(R.layout.lay_navigation_bar_large, this);
}
this.a = (ImageView) findViewById(R.id.iv_left);
this.a.setOnClickListener(this.g);
this.a.bringToFront();
this.b = (TextView) findViewById(R.id.tv_title);
this.b.setText(str);
this.c = (ImageView) findViewById(R.id.iv_right);
this.c.setOnClickListener(this.g);
this.d = (TextView) findViewById(R.id.tv_right);
this.d.setOnClickListener(this.g);
setMode(i);
setListener(new OnActionClickListener.Stub());
}
public void setTitle(String str) {
this.b.setText(str);
}
public NavigationBarView(Context context, AttributeSet attributeSet, int i) {
this(context, attributeSet, i, 0);
}
public NavigationBarView(Context context, AttributeSet attributeSet, int i, int i2) {
super(context, attributeSet, i, i2);
this.g = new View.OnClickListener() { // from class: com.ubt.jimu.widgets.h
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
NavigationBarView.this.a(view);
}
};
a(context, attributeSet);
a();
}
public /* synthetic */ void a(View view) {
OnActionClickListener onActionClickListener = this.e;
if (onActionClickListener != null) {
onActionClickListener.onClick(view);
}
}
}

View File

@@ -0,0 +1,313 @@
package com.ubt.jimu.widgets;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.ubt.jimu.R;
/* loaded from: classes2.dex */
public class PullRefreshLayout extends LinearLayout {
private View a;
private View b;
private TextView c;
private ImageView d;
private Context e;
private int f;
private int g;
private int h;
private int i;
private int j;
private int k;
private Status l;
private Animation m;
private ImageView n;
private boolean o;
private OnRefreshListener p;
public interface OnRefreshListener {
void a();
void b();
}
private enum Status {
NORMAL,
TRY_REFRESH,
REFRESHING,
TRY_LOADMORE,
LOADING
}
public PullRefreshLayout(Context context) {
super(context);
this.l = Status.NORMAL;
this.o = false;
}
private void a(Status status) {
this.l = status;
}
private void b() {
this.b = LayoutInflater.from(getContext()).inflate(R.layout.pull_footer, (ViewGroup) null, false);
addView(this.b, new RelativeLayout.LayoutParams(-1, -2));
this.n = (ImageView) findViewById(R.id.footer_loading);
}
private void c() {
this.a = LayoutInflater.from(getContext()).inflate(R.layout.pull_header, (ViewGroup) null, false);
addView(this.a, new RelativeLayout.LayoutParams(-1, -2));
this.c = (TextView) findViewById(R.id.header_text);
this.d = (ImageView) findViewById(R.id.header_arrow);
}
private boolean d(View view) {
if (view instanceof AdapterView) {
return b(view);
}
if (view instanceof ScrollView) {
return h(view);
}
if (view instanceof RecyclerView) {
return f(view);
}
return false;
}
private boolean e(View view) {
RecyclerView recyclerView = (RecyclerView) view;
return recyclerView.computeVerticalScrollExtent() + recyclerView.computeVerticalScrollOffset() >= recyclerView.computeVerticalScrollRange();
}
private boolean f(View view) {
return ((RecyclerView) view).computeVerticalScrollOffset() <= 0;
}
private boolean g(View view) {
ScrollView scrollView = (ScrollView) view;
return scrollView.getScrollY() >= scrollView.getChildAt(0).getHeight() - scrollView.getHeight();
}
private boolean h(View view) {
return view.getScrollY() <= 0;
}
private void i(View view) {
if (this.m == null) {
this.m = AnimationUtils.loadAnimation(this.e, R.anim.anima_dialog_wait);
}
this.m.setInterpolator(new LinearInterpolator());
view.startAnimation(this.m);
}
public void a() {
}
@Override // android.view.View
protected void onFinishInflate() {
super.onFinishInflate();
this.k = getChildCount() - 1;
c();
b();
}
@Override // android.view.ViewGroup
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
int y = (int) motionEvent.getY();
Status status = this.l;
boolean z = false;
if (status != Status.REFRESHING && status != Status.LOADING) {
int action = motionEvent.getAction();
if (action == 0) {
this.i = y;
} else if (action != 1 && action == 2) {
int i = this.j;
if (y > i) {
z = d(getChildAt(0));
if (z) {
a(Status.TRY_REFRESH);
}
} else if (y < i && (z = c(getChildAt(this.k)))) {
a(Status.TRY_LOADMORE);
}
}
this.j = y;
}
return z;
}
@Override // android.widget.LinearLayout, android.view.ViewGroup, android.view.View
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
this.f = 0;
for (int i5 = 0; i5 < getChildCount(); i5++) {
View childAt = getChildAt(i5);
if (childAt == this.a) {
childAt.layout(0, 0 - childAt.getMeasuredHeight(), childAt.getMeasuredWidth(), 0);
this.g = childAt.getHeight();
} else if (childAt == this.b) {
childAt.layout(0, this.f, childAt.getMeasuredWidth(), this.f + childAt.getMeasuredHeight());
this.h = childAt.getHeight();
} else {
childAt.layout(0, this.f, childAt.getMeasuredWidth(), this.f + childAt.getMeasuredHeight());
if (i5 < getChildCount()) {
if (childAt instanceof ScrollView) {
this.f += getMeasuredHeight();
} else {
this.f += childAt.getMeasuredHeight();
}
}
}
}
}
@Override // android.widget.LinearLayout, android.view.View
protected void onMeasure(int i, int i2) {
super.onMeasure(i, i2);
for (int i3 = 0; i3 < getChildCount(); i3++) {
measureChild(getChildAt(i3), i, i2);
}
}
@Override // android.view.View
public boolean onTouchEvent(MotionEvent motionEvent) {
int y = (int) motionEvent.getY();
Status status = this.l;
if (status == Status.REFRESHING || status == Status.LOADING) {
return true;
}
int action = motionEvent.getAction();
if (action == 0) {
this.i = y;
} else if (action != 1) {
if (action == 2) {
int i = this.i - y;
if (getScrollY() > 0 || i > 0) {
if (getScrollY() < 0 || i < 0) {
scrollBy(0, i / 3);
} else if (this.l == Status.TRY_REFRESH) {
scrollBy(0, i / 30);
} else {
scrollBy(0, i / 3);
}
} else if (this.l == Status.TRY_LOADMORE) {
scrollBy(0, i / 30);
} else {
scrollBy(0, i / 3);
}
a(i);
a();
}
} else if (getScrollY() <= (-this.g)) {
e();
OnRefreshListener onRefreshListener = this.p;
if (onRefreshListener != null) {
onRefreshListener.a();
}
} else if (getScrollY() >= 10) {
d();
OnRefreshListener onRefreshListener2 = this.p;
if (onRefreshListener2 != null) {
onRefreshListener2.b();
}
} else {
g();
f();
}
this.i = y;
return super.onTouchEvent(motionEvent);
}
public void setRefreshListener(OnRefreshListener onRefreshListener) {
this.p = onRefreshListener;
}
private boolean a(View view) {
AdapterView adapterView = (AdapterView) view;
return adapterView.getLastVisiblePosition() == adapterView.getCount() - 1 && adapterView.getChildAt(adapterView.getChildCount() - 1).getBottom() >= getMeasuredHeight();
}
private void f() {
scrollBy(0, -getScrollY());
a(Status.NORMAL);
}
public PullRefreshLayout(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.l = Status.NORMAL;
this.o = false;
this.e = context;
}
private void e() {
scrollTo(0, -this.g);
this.c.setText("正在刷新");
i(this.d);
a(Status.REFRESHING);
}
private void g() {
scrollBy(0, -getScrollY());
this.c.setText("下拉刷新");
a(Status.NORMAL);
}
public void a(float f) {
int abs = Math.abs(getScrollY());
int i = this.g;
if (abs > i) {
abs = i;
}
this.d.setRotation((float) (((abs * 1.0d) / this.g) * 180.0d));
if (getScrollY() <= (-this.g)) {
this.c.setText("松开刷新");
} else {
this.c.setText("下拉刷新");
}
}
private boolean c(View view) {
if (view instanceof AdapterView) {
return a(view);
}
if (view instanceof ScrollView) {
return g(view);
}
if (view instanceof RecyclerView) {
return e(view);
}
return false;
}
private boolean b(View view) {
AdapterView adapterView = (AdapterView) view;
return adapterView.getFirstVisiblePosition() == 0 && adapterView.getChildAt(0).getTop() == 0;
}
private void d() {
scrollTo(0, this.h);
if (!this.o) {
i(this.n);
}
a(Status.LOADING);
}
public PullRefreshLayout(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.l = Status.NORMAL;
this.o = false;
this.e = context;
}
}

View File

@@ -0,0 +1,91 @@
package com.ubt.jimu.widgets;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.PopupWindow;
import android.widget.TextView;
import com.ubt.jimu.R;
/* loaded from: classes2.dex */
public class QuitPopupWindow implements View.OnClickListener {
private PopupWindow a;
private PopupWindowOnClickListener b;
private final TextView c;
private final TextView d;
private final TextView e;
public interface PopupWindowOnClickListener {
void s0();
void w0();
}
public QuitPopupWindow(final Activity activity) {
View inflate = LayoutInflater.from(activity).inflate(R.layout.popw_publish_layout, (ViewGroup) null, false);
this.a = new PopupWindow(inflate, -1, -1);
this.a.setOutsideTouchable(false);
this.a.setTouchable(true);
this.a.setAnimationStyle(R.style.popupWindow_anim_translate);
this.a.setOnDismissListener(new PopupWindow.OnDismissListener(this) { // from class: com.ubt.jimu.widgets.QuitPopupWindow.1
@Override // android.widget.PopupWindow.OnDismissListener
public void onDismiss() {
WindowManager.LayoutParams attributes = activity.getWindow().getAttributes();
attributes.alpha = 1.0f;
activity.getWindow().clearFlags(2);
activity.getWindow().setAttributes(attributes);
}
});
WindowManager.LayoutParams attributes = activity.getWindow().getAttributes();
attributes.alpha = 0.3f;
activity.getWindow().addFlags(2);
activity.getWindow().setAttributes(attributes);
this.e = (TextView) inflate.findViewById(R.id.tv_popup_cancel);
this.d = (TextView) inflate.findViewById(R.id.tv_popup_exit);
this.c = (TextView) inflate.findViewById(R.id.tv_popup_drafts);
this.e.setOnClickListener(this);
this.d.setOnClickListener(this);
this.c.setOnClickListener(this);
}
public void a(View view) {
this.a.showAtLocation(view, 80, 0, 0);
}
public boolean b() {
return this.a.isShowing();
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
switch (view.getId()) {
case R.id.tv_popup_cancel /* 2131297753 */:
a();
break;
case R.id.tv_popup_drafts /* 2131297754 */:
PopupWindowOnClickListener popupWindowOnClickListener = this.b;
if (popupWindowOnClickListener != null) {
popupWindowOnClickListener.s0();
break;
}
break;
case R.id.tv_popup_exit /* 2131297755 */:
PopupWindowOnClickListener popupWindowOnClickListener2 = this.b;
if (popupWindowOnClickListener2 != null) {
popupWindowOnClickListener2.w0();
}
a();
break;
}
}
public void a() {
this.a.dismiss();
}
public void a(PopupWindowOnClickListener popupWindowOnClickListener) {
this.b = popupWindowOnClickListener;
}
}

View File

@@ -0,0 +1,379 @@
package com.ubt.jimu.widgets;
import android.annotation.SuppressLint;
import android.content.res.ColorStateList;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.util.Log;
import android.widget.ImageView;
/* loaded from: classes2.dex */
public class RoundedDrawable extends Drawable {
private final Bitmap d;
private final Paint e;
private final int f;
private final int g;
private final Paint i;
private BitmapShader k;
private Shader.TileMode l;
private Shader.TileMode m;
private boolean n;
private float o;
private boolean p;
private float q;
private ColorStateList r;
private ImageView.ScaleType s;
private final RectF a = new RectF();
private final RectF b = new RectF();
private final RectF c = new RectF();
private final RectF h = new RectF();
private final Matrix j = new Matrix();
/* renamed from: com.ubt.jimu.widgets.RoundedDrawable$1, reason: invalid class name */
static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] a = new int[ImageView.ScaleType.values().length];
static {
try {
a[ImageView.ScaleType.CENTER.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[ImageView.ScaleType.CENTER_CROP.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
a[ImageView.ScaleType.CENTER_INSIDE.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
a[ImageView.ScaleType.FIT_CENTER.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
a[ImageView.ScaleType.FIT_END.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
a[ImageView.ScaleType.FIT_START.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
a[ImageView.ScaleType.FIT_XY.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
}
}
public RoundedDrawable(Bitmap bitmap) {
Shader.TileMode tileMode = Shader.TileMode.CLAMP;
this.l = tileMode;
this.m = tileMode;
this.n = true;
this.o = 0.0f;
this.p = false;
this.q = 0.0f;
this.r = ColorStateList.valueOf(-16777216);
this.s = ImageView.ScaleType.FIT_CENTER;
this.d = bitmap;
this.f = bitmap.getWidth();
this.g = bitmap.getHeight();
this.c.set(0.0f, 0.0f, this.f, this.g);
this.e = new Paint();
this.e.setStyle(Paint.Style.FILL);
this.e.setAntiAlias(true);
this.i = new Paint();
this.i.setStyle(Paint.Style.STROKE);
this.i.setAntiAlias(true);
this.i.setColor(this.r.getColorForState(getState(), -16777216));
this.i.setStrokeWidth(this.q);
}
public static RoundedDrawable a(Bitmap bitmap) {
if (bitmap != null) {
return new RoundedDrawable(bitmap);
}
return null;
}
public static Drawable b(Drawable drawable) {
if (drawable == null || (drawable instanceof RoundedDrawable)) {
return drawable;
}
if (!(drawable instanceof LayerDrawable)) {
Bitmap a = a(drawable);
return a != null ? new RoundedDrawable(a) : drawable;
}
LayerDrawable layerDrawable = (LayerDrawable) drawable;
int numberOfLayers = layerDrawable.getNumberOfLayers();
for (int i = 0; i < numberOfLayers; i++) {
layerDrawable.setDrawableByLayerId(layerDrawable.getId(i), b(layerDrawable.getDrawable(i)));
}
return layerDrawable;
}
@Override // android.graphics.drawable.Drawable
public void draw(Canvas canvas) {
if (this.n) {
this.k = new BitmapShader(this.d, this.l, this.m);
Shader.TileMode tileMode = this.l;
Shader.TileMode tileMode2 = Shader.TileMode.CLAMP;
if (tileMode == tileMode2 && this.m == tileMode2) {
this.k.setLocalMatrix(this.j);
}
this.e.setShader(this.k);
this.n = false;
}
if (this.p) {
if (this.q <= 0.0f) {
canvas.drawOval(this.b, this.e);
return;
} else {
canvas.drawOval(this.b, this.e);
canvas.drawOval(this.h, this.i);
return;
}
}
if (this.q <= 0.0f) {
RectF rectF = this.b;
float f = this.o;
canvas.drawRoundRect(rectF, f, f, this.e);
} else {
canvas.drawRoundRect(this.b, Math.max(this.o, 0.0f), Math.max(this.o, 0.0f), this.e);
RectF rectF2 = this.h;
float f2 = this.o;
canvas.drawRoundRect(rectF2, f2, f2, this.i);
}
}
@Override // android.graphics.drawable.Drawable
public int getAlpha() {
return this.e.getAlpha();
}
@Override // android.graphics.drawable.Drawable
@SuppressLint({"Override"})
public ColorFilter getColorFilter() {
return this.e.getColorFilter();
}
@Override // android.graphics.drawable.Drawable
public int getIntrinsicHeight() {
return this.g;
}
@Override // android.graphics.drawable.Drawable
public int getIntrinsicWidth() {
return this.f;
}
@Override // android.graphics.drawable.Drawable
public int getOpacity() {
return -3;
}
@Override // android.graphics.drawable.Drawable
public boolean isStateful() {
return this.r.isStateful();
}
@Override // android.graphics.drawable.Drawable
protected void onBoundsChange(Rect rect) {
super.onBoundsChange(rect);
this.a.set(rect);
a();
}
@Override // android.graphics.drawable.Drawable
protected boolean onStateChange(int[] iArr) {
int colorForState = this.r.getColorForState(iArr, 0);
if (this.i.getColor() == colorForState) {
return super.onStateChange(iArr);
}
this.i.setColor(colorForState);
return true;
}
@Override // android.graphics.drawable.Drawable
public void setAlpha(int i) {
this.e.setAlpha(i);
invalidateSelf();
}
@Override // android.graphics.drawable.Drawable
public void setColorFilter(ColorFilter colorFilter) {
this.e.setColorFilter(colorFilter);
invalidateSelf();
}
@Override // android.graphics.drawable.Drawable
public void setDither(boolean z) {
this.e.setDither(z);
invalidateSelf();
}
@Override // android.graphics.drawable.Drawable
public void setFilterBitmap(boolean z) {
this.e.setFilterBitmap(z);
invalidateSelf();
}
public static Bitmap a(Drawable drawable) {
if (drawable instanceof BitmapDrawable) {
return ((BitmapDrawable) drawable).getBitmap();
}
try {
Bitmap createBitmap = Bitmap.createBitmap(Math.max(drawable.getIntrinsicWidth(), 2), Math.max(drawable.getIntrinsicHeight(), 2), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(createBitmap);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
drawable.draw(canvas);
return createBitmap;
} catch (Exception e) {
e.printStackTrace();
Log.w("RoundedDrawable", "Failed to create bitmap from drawable!");
return null;
}
}
public RoundedDrawable b(float f) {
this.o = f;
return this;
}
public RoundedDrawable b(Shader.TileMode tileMode) {
if (this.m != tileMode) {
this.m = tileMode;
this.n = true;
invalidateSelf();
}
return this;
}
private void a() {
float width;
float f;
int i = AnonymousClass1.a[this.s.ordinal()];
if (i == 1) {
this.h.set(this.a);
RectF rectF = this.h;
float f2 = this.q;
rectF.inset(f2 / 2.0f, f2 / 2.0f);
this.j.reset();
this.j.setTranslate((int) (((this.h.width() - this.f) * 0.5f) + 0.5f), (int) (((this.h.height() - this.g) * 0.5f) + 0.5f));
} else if (i == 2) {
this.h.set(this.a);
RectF rectF2 = this.h;
float f3 = this.q;
rectF2.inset(f3 / 2.0f, f3 / 2.0f);
this.j.reset();
float f4 = 0.0f;
if (this.f * this.h.height() > this.h.width() * this.g) {
width = this.h.height() / this.g;
f = (this.h.width() - (this.f * width)) * 0.5f;
} else {
width = this.h.width() / this.f;
f4 = (this.h.height() - (this.g * width)) * 0.5f;
f = 0.0f;
}
this.j.setScale(width, width);
Matrix matrix = this.j;
float f5 = this.q;
matrix.postTranslate(((int) (f + 0.5f)) + f5, ((int) (f4 + 0.5f)) + f5);
} else if (i == 3) {
this.j.reset();
float min = (((float) this.f) > this.a.width() || ((float) this.g) > this.a.height()) ? Math.min(this.a.width() / this.f, this.a.height() / this.g) : 1.0f;
float width2 = (int) (((this.a.width() - (this.f * min)) * 0.5f) + 0.5f);
float height = (int) (((this.a.height() - (this.g * min)) * 0.5f) + 0.5f);
this.j.setScale(min, min);
this.j.postTranslate(width2, height);
this.h.set(this.c);
this.j.mapRect(this.h);
RectF rectF3 = this.h;
float f6 = this.q;
rectF3.inset(f6 / 2.0f, f6 / 2.0f);
this.j.setRectToRect(this.c, this.h, Matrix.ScaleToFit.FILL);
} else if (i == 5) {
this.h.set(this.c);
this.j.setRectToRect(this.c, this.a, Matrix.ScaleToFit.END);
this.j.mapRect(this.h);
RectF rectF4 = this.h;
float f7 = this.q;
rectF4.inset(f7 / 2.0f, f7 / 2.0f);
this.j.setRectToRect(this.c, this.h, Matrix.ScaleToFit.FILL);
} else if (i == 6) {
this.h.set(this.c);
this.j.setRectToRect(this.c, this.a, Matrix.ScaleToFit.START);
this.j.mapRect(this.h);
RectF rectF5 = this.h;
float f8 = this.q;
rectF5.inset(f8 / 2.0f, f8 / 2.0f);
this.j.setRectToRect(this.c, this.h, Matrix.ScaleToFit.FILL);
} else if (i != 7) {
this.h.set(this.c);
this.j.setRectToRect(this.c, this.a, Matrix.ScaleToFit.CENTER);
this.j.mapRect(this.h);
RectF rectF6 = this.h;
float f9 = this.q;
rectF6.inset(f9 / 2.0f, f9 / 2.0f);
this.j.setRectToRect(this.c, this.h, Matrix.ScaleToFit.FILL);
} else {
this.h.set(this.a);
RectF rectF7 = this.h;
float f10 = this.q;
rectF7.inset(f10 / 2.0f, f10 / 2.0f);
this.j.reset();
this.j.setRectToRect(this.c, this.h, Matrix.ScaleToFit.FILL);
}
this.b.set(this.h);
}
public RoundedDrawable a(float f) {
this.q = f;
this.i.setStrokeWidth(this.q);
return this;
}
public RoundedDrawable a(ColorStateList colorStateList) {
if (colorStateList == null) {
colorStateList = ColorStateList.valueOf(0);
}
this.r = colorStateList;
this.i.setColor(this.r.getColorForState(getState(), -16777216));
return this;
}
public RoundedDrawable a(boolean z) {
this.p = z;
return this;
}
public RoundedDrawable a(ImageView.ScaleType scaleType) {
if (scaleType == null) {
scaleType = ImageView.ScaleType.FIT_CENTER;
}
if (this.s != scaleType) {
this.s = scaleType;
a();
}
return this;
}
public RoundedDrawable a(Shader.TileMode tileMode) {
if (this.l != tileMode) {
this.l = tileMode;
this.n = true;
invalidateSelf();
}
return this;
}
}

View File

@@ -0,0 +1,414 @@
package com.ubt.jimu.widgets;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.ColorFilter;
import android.graphics.Shader;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.net.Uri;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.ImageView;
import com.ubt.jimu.R$styleable;
@SuppressLint({"AppCompatCustomView"})
/* loaded from: classes2.dex */
public class RoundedImageView extends ImageView {
public static final Shader.TileMode o = Shader.TileMode.CLAMP;
private static final ImageView.ScaleType[] p = {ImageView.ScaleType.MATRIX, ImageView.ScaleType.FIT_XY, ImageView.ScaleType.FIT_START, ImageView.ScaleType.FIT_CENTER, ImageView.ScaleType.FIT_END, ImageView.ScaleType.CENTER, ImageView.ScaleType.CENTER_CROP, ImageView.ScaleType.CENTER_INSIDE};
private float a;
private float b;
private ColorStateList c;
private boolean d;
private boolean e;
private Shader.TileMode f;
private Shader.TileMode g;
private ColorFilter h;
private boolean i;
private boolean j;
private int k;
private Drawable l;
private Drawable m;
private ImageView.ScaleType n;
/* renamed from: com.ubt.jimu.widgets.RoundedImageView$1, reason: invalid class name */
static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] a = new int[ImageView.ScaleType.values().length];
static {
try {
a[ImageView.ScaleType.CENTER.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[ImageView.ScaleType.CENTER_CROP.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
a[ImageView.ScaleType.CENTER_INSIDE.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
a[ImageView.ScaleType.FIT_CENTER.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
a[ImageView.ScaleType.FIT_START.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
a[ImageView.ScaleType.FIT_END.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
a[ImageView.ScaleType.FIT_XY.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
}
}
public RoundedImageView(Context context) {
super(context);
this.a = 0.0f;
this.b = 0.0f;
this.c = ColorStateList.valueOf(-16777216);
this.d = false;
this.e = false;
Shader.TileMode tileMode = o;
this.f = tileMode;
this.g = tileMode;
this.h = null;
this.i = false;
this.j = false;
}
private static Shader.TileMode a(int i) {
if (i == 0) {
return Shader.TileMode.CLAMP;
}
if (i == 1) {
return Shader.TileMode.REPEAT;
}
if (i != 2) {
return null;
}
return Shader.TileMode.MIRROR;
}
private Drawable b() {
Resources resources = getResources();
Drawable drawable = null;
if (resources == null) {
return null;
}
int i = this.k;
if (i != 0) {
try {
drawable = resources.getDrawable(i);
} catch (Exception e) {
Log.w("RoundedImageView", "Unable to find resource: " + this.k, e);
this.k = 0;
}
}
return RoundedDrawable.b(drawable);
}
private void c() {
a(this.l);
}
@Override // android.widget.ImageView, android.view.View
protected void drawableStateChanged() {
super.drawableStateChanged();
invalidate();
}
public int getBorderColor() {
return this.c.getDefaultColor();
}
public ColorStateList getBorderColors() {
return this.c;
}
public float getBorderWidth() {
return this.b;
}
public float getCornerRadius() {
return this.a;
}
@Override // android.widget.ImageView
public ImageView.ScaleType getScaleType() {
return this.n;
}
public Shader.TileMode getTileModeX() {
return this.f;
}
public Shader.TileMode getTileModeY() {
return this.g;
}
@Override // android.view.View
public void setBackground(Drawable drawable) {
setBackgroundDrawable(drawable);
}
@Override // android.view.View
@Deprecated
public void setBackgroundDrawable(Drawable drawable) {
this.m = drawable;
a(true);
super.setBackgroundDrawable(this.m);
}
public void setBorderColor(int i) {
setBorderColor(ColorStateList.valueOf(i));
}
public void setBorderWidth(int i) {
setBorderWidth(getResources().getDimension(i));
}
@Override // android.widget.ImageView
public void setColorFilter(ColorFilter colorFilter) {
if (this.h != colorFilter) {
this.h = colorFilter;
this.i = true;
this.j = true;
a();
invalidate();
}
}
public void setCornerRadius(float f) {
if (this.a == f) {
return;
}
this.a = f;
c();
a(false);
invalidate();
}
public void setCornerRadiusDimen(int i) {
setCornerRadius(getResources().getDimension(i));
}
@Override // android.widget.ImageView
public void setImageBitmap(Bitmap bitmap) {
this.k = 0;
this.l = RoundedDrawable.a(bitmap);
c();
super.setImageDrawable(this.l);
}
@Override // android.widget.ImageView
public void setImageDrawable(Drawable drawable) {
this.k = 0;
this.l = RoundedDrawable.b(drawable);
c();
super.setImageDrawable(this.l);
}
@Override // android.widget.ImageView
public void setImageResource(int i) {
if (this.k != i) {
this.k = i;
this.l = b();
c();
super.setImageDrawable(this.l);
}
}
@Override // android.widget.ImageView
public void setImageURI(Uri uri) {
super.setImageURI(uri);
setImageDrawable(getDrawable());
}
public void setOval(boolean z) {
this.d = z;
c();
a(false);
invalidate();
}
@Override // android.widget.ImageView
public void setScaleType(ImageView.ScaleType scaleType) {
if (this.n != scaleType) {
this.n = scaleType;
switch (AnonymousClass1.a[scaleType.ordinal()]) {
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
super.setScaleType(ImageView.ScaleType.FIT_XY);
break;
default:
super.setScaleType(scaleType);
break;
}
c();
a(false);
invalidate();
}
}
public void setTileModeX(Shader.TileMode tileMode) {
if (this.f == tileMode) {
return;
}
this.f = tileMode;
c();
a(false);
invalidate();
}
public void setTileModeY(Shader.TileMode tileMode) {
if (this.g == tileMode) {
return;
}
this.g = tileMode;
c();
a(false);
invalidate();
}
public void setBorderColor(ColorStateList colorStateList) {
if (this.c.equals(colorStateList)) {
return;
}
if (colorStateList == null) {
colorStateList = ColorStateList.valueOf(-16777216);
}
this.c = colorStateList;
c();
a(false);
if (this.b > 0.0f) {
invalidate();
}
}
public void setBorderWidth(float f) {
if (this.b == f) {
return;
}
this.b = f;
c();
a(false);
invalidate();
}
private void a(boolean z) {
if (this.e) {
if (z) {
this.m = RoundedDrawable.b(this.m);
}
a(this.m);
}
}
private void a() {
Drawable drawable = this.l;
if (drawable == null || !this.j) {
return;
}
this.l = drawable.mutate();
if (this.i) {
this.l.setColorFilter(this.h);
}
}
private void a(Drawable drawable) {
if (drawable == null) {
return;
}
if (drawable instanceof RoundedDrawable) {
RoundedDrawable roundedDrawable = (RoundedDrawable) drawable;
roundedDrawable.a(this.n);
roundedDrawable.b(this.a);
roundedDrawable.a(this.b);
roundedDrawable.a(this.c);
roundedDrawable.a(this.d);
roundedDrawable.a(this.f);
roundedDrawable.b(this.g);
a();
return;
}
if (drawable instanceof LayerDrawable) {
LayerDrawable layerDrawable = (LayerDrawable) drawable;
int numberOfLayers = layerDrawable.getNumberOfLayers();
for (int i = 0; i < numberOfLayers; i++) {
a(layerDrawable.getDrawable(i));
}
}
}
public RoundedImageView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public RoundedImageView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.a = 0.0f;
this.b = 0.0f;
this.c = ColorStateList.valueOf(-16777216);
this.d = false;
this.e = false;
Shader.TileMode tileMode = o;
this.f = tileMode;
this.g = tileMode;
this.h = null;
this.i = false;
this.j = false;
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.RoundedImageView, i, 0);
int i2 = obtainStyledAttributes.getInt(0, -1);
if (i2 >= 0) {
setScaleType(p[i2]);
} else {
setScaleType(ImageView.ScaleType.FIT_CENTER);
}
this.a = obtainStyledAttributes.getDimensionPixelSize(3, -1);
this.b = obtainStyledAttributes.getDimensionPixelSize(2, -1);
if (this.a < 0.0f) {
this.a = 0.0f;
}
if (this.b < 0.0f) {
this.b = 0.0f;
}
this.c = obtainStyledAttributes.getColorStateList(1);
if (this.c == null) {
this.c = ColorStateList.valueOf(-16777216);
}
this.e = obtainStyledAttributes.getBoolean(4, false);
this.d = obtainStyledAttributes.getBoolean(5, false);
int i3 = obtainStyledAttributes.getInt(6, -2);
if (i3 != -2) {
setTileModeX(a(i3));
setTileModeY(a(i3));
}
int i4 = obtainStyledAttributes.getInt(7, -2);
if (i4 != -2) {
setTileModeX(a(i4));
}
int i5 = obtainStyledAttributes.getInt(8, -2);
if (i5 != -2) {
setTileModeY(a(i5));
}
c();
a(true);
obtainStyledAttributes.recycle();
}
}

View File

@@ -0,0 +1,80 @@
package com.ubt.jimu.widgets;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.interpolator.view.animation.FastOutLinearInInterpolator;
import androidx.interpolator.view.animation.LinearOutSlowInInterpolator;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.ubt.jimu.R;
/* loaded from: classes2.dex */
public class ScrollAwareFABBehavior extends FloatingActionButton.Behavior {
public ScrollAwareFABBehavior(Context context, AttributeSet attributeSet) {
}
private void b(final View view) {
view.animate().cancel();
view.setAlpha(0.0f);
view.setScaleY(0.0f);
view.setScaleX(0.0f);
view.animate().scaleX(1.0f).scaleY(1.0f).alpha(1.0f).setDuration(200L).setInterpolator(new LinearOutSlowInInterpolator()).setListener(new AnimatorListenerAdapter(this) { // from class: com.ubt.jimu.widgets.ScrollAwareFABBehavior.1
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public void onAnimationEnd(Animator animator) {
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public void onAnimationStart(Animator animator) {
view.setVisibility(0);
}
});
}
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public boolean b(CoordinatorLayout coordinatorLayout, FloatingActionButton floatingActionButton, View view, View view2, int i) {
return i == 2 || super.b(coordinatorLayout, floatingActionButton, view, view2, i);
}
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
public void a(CoordinatorLayout coordinatorLayout, FloatingActionButton floatingActionButton, View view, int i, int i2, int i3, int i4) {
super.a(coordinatorLayout, (CoordinatorLayout) floatingActionButton, view, i, i2, i3, i4);
if (i2 > 10 && floatingActionButton.getVisibility() == 0 && view.getId() != R.id.rv_inspire_creative) {
a((View) floatingActionButton);
} else {
if (i2 >= -10 || floatingActionButton.getVisibility() == 0) {
return;
}
b(floatingActionButton);
}
}
private void a(final View view) {
view.animate().cancel();
view.animate().scaleX(0.0f).scaleY(0.0f).alpha(0.0f).setDuration(200L).setInterpolator(new FastOutLinearInInterpolator()).setListener(new AnimatorListenerAdapter(this) { // from class: com.ubt.jimu.widgets.ScrollAwareFABBehavior.2
private boolean a;
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public void onAnimationCancel(Animator animator) {
this.a = true;
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public void onAnimationEnd(Animator animator) {
if (this.a) {
return;
}
view.setVisibility(4);
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public void onAnimationStart(Animator animator) {
view.setVisibility(0);
this.a = false;
}
});
}
}

View File

@@ -0,0 +1,89 @@
package com.ubt.jimu.widgets;
import android.app.Activity;
import android.view.View;
import android.widget.PopupWindow;
import android.widget.TextView;
import androidx.cardview.widget.CardView;
import com.ubt.jimu.JimuApplication;
import com.ubt.jimu.R;
/* loaded from: classes2.dex */
public class ShopPopupWindow implements View.OnClickListener {
private final PopupWindow a;
private final View b;
private PopupWindowOnClickLinsenter c;
private final TextView d;
private final View e;
public interface PopupWindowOnClickLinsenter {
void C0();
void q0();
}
public ShopPopupWindow(Activity activity, View view) {
this.e = View.inflate(activity, R.layout.layout_shop_popw, null);
this.a = new PopupWindow(this.e, -1, -1);
this.a.setOutsideTouchable(false);
this.a.setTouchable(true);
this.a.setAnimationStyle(R.style.popupWindow_anim_shop);
this.e.findViewById(R.id.tv_popu_cancel).setOnClickListener(this);
TextView textView = (TextView) this.e.findViewById(R.id.tv_popu_cancel);
TextView textView2 = (TextView) this.e.findViewById(R.id.tv_popu_ok);
this.e.findViewById(R.id.view_click).setOnClickListener(this);
((CardView) this.e.findViewById(R.id.cardView)).setCardBackgroundColor(activity.getResources().getColor(R.color.bg_white));
boolean i = JimuApplication.l().i();
int i2 = R.drawable.btn_publish;
textView.setBackgroundResource(i ? R.drawable.btn_publish : R.drawable.btn_publish_phone);
textView2.setBackgroundResource(JimuApplication.l().i() ? i2 : R.drawable.btn_publish_phone);
this.e.findViewById(R.id.tv_popu_ok).setOnClickListener(this);
this.d = (TextView) this.e.findViewById(R.id.tv_shop_popup_des);
this.b = view;
}
public void a(String str) {
this.d.setText(str);
}
public void b() {
if (this.a.isShowing()) {
return;
}
this.a.showAtLocation(this.b, 17, 0, 0);
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
switch (view.getId()) {
case R.id.tv_popu_cancel /* 2131297750 */:
PopupWindowOnClickLinsenter popupWindowOnClickLinsenter = this.c;
if (popupWindowOnClickLinsenter != null) {
popupWindowOnClickLinsenter.C0();
}
a();
break;
case R.id.tv_popu_ok /* 2131297751 */:
PopupWindowOnClickLinsenter popupWindowOnClickLinsenter2 = this.c;
if (popupWindowOnClickLinsenter2 != null) {
popupWindowOnClickLinsenter2.q0();
}
a();
break;
case R.id.view_click /* 2131297934 */:
a();
break;
}
}
public void a() {
PopupWindow popupWindow = this.a;
if (popupWindow != null) {
popupWindow.dismiss();
}
}
public void a(PopupWindowOnClickLinsenter popupWindowOnClickLinsenter) {
this.c = popupWindowOnClickLinsenter;
}
}

View File

@@ -0,0 +1,5 @@
package com.ubt.jimu.widgets.SortRecyclerView;
/* loaded from: classes2.dex */
public interface OnItemCallbackListener {
}

View File

@@ -0,0 +1,546 @@
package com.ubt.jimu.widgets.SortRecyclerView;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.text.Editable;
import android.text.InputFilter;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestBuilder;
import com.bumptech.glide.request.RequestOptions;
import com.google.android.material.textfield.TextInputEditText;
import com.twitter.sdk.android.core.TwitterAuthConfig;
import com.ubt.jimu.JimuApplication;
import com.ubt.jimu.R;
import com.ubt.jimu.base.entities.PublishItemBean;
import com.ubt.jimu.base.entities.PublishLabelBean;
import com.ubt.jimu.base.entities.PublishType;
import com.ubt.jimu.utils.LogUtils;
import com.ubt.jimu.utils.fileUpdataTool.VideoUtils;
import com.ubt.jimu.widgets.TagFlowLayout;
import io.reactivex.functions.Consumer;
import java.io.File;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
/* loaded from: classes2.dex */
public class PublishEditAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements OnItemCallbackListener {
private final PublishItemBean a;
private final Context b;
private List<PublishItemBean.ItemBean> d;
private OnAddContentListener e;
private OnDeleteItemFeedbackListener g;
private WordLimitListener h;
private List<PublishLabelBean> j;
private OnClickLabelItemListener k;
private String l;
private OnVideoItemClickListener c = null;
private LinkedHashMap<String, Bitmap> f = new LinkedHashMap<>();
private int i = 0;
class BaseItemVideoHolder extends RecyclerView.ViewHolder implements OnDeleteItemListener {
private final ImageView a;
public BaseItemVideoHolder(View view) {
super(view);
this.a = (ImageView) view.findViewById(R.id.tv_publish_delete);
}
public void a(final int i) {
ImageView imageView = this.a;
if (imageView == null) {
return;
}
imageView.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.SortRecyclerView.PublishEditAdapter.BaseItemVideoHolder.1
@Override // android.view.View.OnClickListener
public void onClick(View view) {
PublishEditAdapter publishEditAdapter = PublishEditAdapter.this;
publishEditAdapter.b(i, publishEditAdapter.d);
if (PublishEditAdapter.this.g != null) {
PublishEditAdapter.this.g.i0();
}
}
});
}
}
class ItemEmptyHolder extends BaseItemVideoHolder {
TextView c;
public ItemEmptyHolder(PublishEditAdapter publishEditAdapter, View view) {
super(view);
this.c = (TextView) view.findViewById(R.id.tv_empty_des);
}
}
class ItemImageHolder extends BaseItemVideoHolder {
private final ImageView c;
private final RelativeLayout d;
private final TextInputEditText e;
private ItemImageHolder(PublishEditAdapter publishEditAdapter, View view) {
super(view);
this.c = (ImageView) view.findViewById(R.id.im_publish_image);
this.d = (RelativeLayout) view.findViewById(R.id.rl_publish_label);
this.e = (TextInputEditText) view.findViewById(R.id.et_image_des);
}
}
class ItemLabelHolder extends BaseItemVideoHolder {
TagFlowLayout c;
public ItemLabelHolder(View view) {
super(view);
this.c = (TagFlowLayout) view.findViewById(R.id.table_layout);
this.c.setOnClickLabelListener(new TagFlowLayout.OnClickLabelListener(PublishEditAdapter.this) { // from class: com.ubt.jimu.widgets.SortRecyclerView.PublishEditAdapter.ItemLabelHolder.1
@Override // com.ubt.jimu.widgets.TagFlowLayout.OnClickLabelListener
public void a(String str) {
PublishEditAdapter.this.l = str;
if (PublishEditAdapter.this.k != null) {
PublishEditAdapter.this.k.n(str);
}
}
});
}
public void a() {
if (PublishEditAdapter.this.j == null || PublishEditAdapter.this.j.size() == 0) {
return;
}
ArrayList arrayList = new ArrayList();
for (PublishLabelBean publishLabelBean : PublishEditAdapter.this.j) {
if (1 != publishLabelBean.getIsDeleted()) {
arrayList.add(publishLabelBean.getName());
}
}
LogUtils.c("lastLabel:" + PublishEditAdapter.this.l);
this.c.setLastLabelStr(PublishEditAdapter.this.l);
this.c.setMaxLines(2);
this.c.setData(arrayList);
}
}
class ItemTextDesHolder extends BaseItemVideoHolder {
private final TextInputEditText c;
public ItemTextDesHolder(View view) {
super(view);
this.c = (TextInputEditText) view.findViewById(R.id.tet_publish_des);
}
/* JADX INFO: Access modifiers changed from: private */
public void a(final int i, final List<PublishItemBean.ItemBean> list) {
this.c.setOnKeyListener(new View.OnKeyListener() { // from class: com.ubt.jimu.widgets.SortRecyclerView.PublishEditAdapter.ItemTextDesHolder.1
@Override // android.view.View.OnKeyListener
public boolean onKey(View view, int i2, KeyEvent keyEvent) {
if (i2 == 67) {
int lineCount = ItemTextDesHolder.this.c.getLineCount();
int length = (((Object) ItemTextDesHolder.this.c.getEditableText()) + "").length();
if (lineCount != 1 || length != 0 || !PublishEditAdapter.this.a(i, list)) {
return false;
}
list.remove(i);
PublishEditAdapter.this.notifyItemRemoved(i);
}
return false;
}
});
}
}
class ItemVideoHolder extends BaseItemVideoHolder {
ImageView c;
TextInputEditText d;
RelativeLayout e;
public ItemVideoHolder(PublishEditAdapter publishEditAdapter, View view) {
super(view);
this.c = (ImageView) view.findViewById(R.id.im_publish_player);
this.d = (TextInputEditText) view.findViewById(R.id.et_publish_image_des);
this.e = (RelativeLayout) view.findViewById(R.id.rl_publish_label);
}
}
public interface OnAddContentListener {
void z0();
}
public interface OnClickLabelItemListener {
void n(String str);
}
public interface OnDeleteItemFeedbackListener {
void i0();
}
interface OnDeleteItemListener {
}
public interface OnVideoItemClickListener {
void a(View view, int i, String str);
void a(View view, View view2, int i, String str);
}
public interface WordLimitListener {
void o0();
}
public PublishEditAdapter(Context context, PublishItemBean publishItemBean) {
this.b = context;
this.a = publishItemBean;
this.d = publishItemBean.getItemBeanArray();
if (this.d.size() == 0) {
PublishItemBean.ItemBean itemBean = new PublishItemBean.ItemBean();
itemBean.setItemType(PublishType.LABEL);
this.d.add(itemBean);
PublishItemBean.ItemBean itemBean2 = new PublishItemBean.ItemBean();
itemBean2.setItemType(PublishType.TEXTDES);
this.d.add(itemBean2);
PublishItemBean.ItemBean itemBean3 = new PublishItemBean.ItemBean();
itemBean3.setItemType(PublishType.EMPTY);
this.d.add(itemBean3);
}
a(this.d);
}
public void a(boolean z) {
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public int getItemCount() {
if (this.d == null) {
this.d = new ArrayList();
}
if (this.d.size() == 0) {
PublishItemBean.ItemBean itemBean = new PublishItemBean.ItemBean();
itemBean.setItemType(PublishType.EMPTY);
this.d.add(itemBean);
}
return this.d.size();
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public int getItemViewType(int i) {
if (this.d.get(i).getItemType() == PublishType.EMPTY) {
return 0;
}
if (this.d.get(i).getItemType() == PublishType.IMAGE) {
return 1;
}
if (this.d.get(i).getItemType() == PublishType.VIDEO) {
return 2;
}
return this.d.get(i).getItemType() == PublishType.LABEL ? 4 : 3;
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public void onBindViewHolder(final RecyclerView.ViewHolder viewHolder, final int i) {
PublishItemBean.ItemBean itemBean = this.d.get(i);
final String loadPath = itemBean.getLoadPath();
if (viewHolder instanceof ItemEmptyHolder) {
viewHolder.itemView.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.SortRecyclerView.PublishEditAdapter.1
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (PublishEditAdapter.this.e != null) {
PublishEditAdapter.this.e.z0();
}
}
});
} else if ((viewHolder instanceof ItemImageHolder) && itemBean.getItemType() == PublishType.IMAGE) {
RequestBuilder<Drawable> a = Glide.e(JimuApplication.l()).a(new File(loadPath));
a.a(new RequestOptions().b());
ItemImageHolder itemImageHolder = (ItemImageHolder) viewHolder;
a.a(itemImageHolder.c);
if (itemBean.isCover()) {
itemImageHolder.d.setVisibility(0);
} else {
itemImageHolder.d.setVisibility(8);
}
if (itemImageHolder.e.getTag() instanceof TextWatcher) {
itemImageHolder.e.removeTextChangedListener((TextWatcher) itemImageHolder.e.getTag());
}
itemImageHolder.e.setText(itemBean.getProcedureDes());
TextWatcher a2 = a(itemBean);
itemImageHolder.e.addTextChangedListener(a2);
itemImageHolder.e.setTag(a2);
a(itemImageHolder.e);
viewHolder.itemView.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.SortRecyclerView.PublishEditAdapter.2
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (PublishEditAdapter.this.c != null) {
PublishEditAdapter.this.c.a(((ItemImageHolder) viewHolder).c, i, loadPath);
}
}
});
} else if ((viewHolder instanceof ItemVideoHolder) && itemBean.getItemType() == PublishType.VIDEO) {
if (itemBean.isCover()) {
((ItemVideoHolder) viewHolder).e.setVisibility(0);
} else {
((ItemVideoHolder) viewHolder).e.setVisibility(8);
}
ItemVideoHolder itemVideoHolder = (ItemVideoHolder) viewHolder;
a(itemVideoHolder, loadPath);
viewHolder.itemView.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.SortRecyclerView.PublishEditAdapter.3
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (PublishEditAdapter.this.c != null) {
OnVideoItemClickListener onVideoItemClickListener = PublishEditAdapter.this.c;
RecyclerView.ViewHolder viewHolder2 = viewHolder;
onVideoItemClickListener.a(((ItemVideoHolder) viewHolder2).c, ((ItemVideoHolder) viewHolder2).d, i, loadPath);
}
}
});
if (itemVideoHolder.d.getTag() instanceof TextWatcher) {
TextInputEditText textInputEditText = itemVideoHolder.d;
textInputEditText.removeTextChangedListener((TextWatcher) textInputEditText.getTag());
}
itemVideoHolder.d.setText(itemBean.getProcedureDes());
TextWatcher a3 = a(itemBean);
itemVideoHolder.d.addTextChangedListener(a3);
itemVideoHolder.d.setTag(a3);
a(itemVideoHolder.d);
} else if (viewHolder instanceof ItemLabelHolder) {
List<PublishLabelBean> list = this.j;
if (list == null || list.size() == 0) {
((ItemLabelHolder) viewHolder).c.setVisibility(8);
} else {
ItemLabelHolder itemLabelHolder = (ItemLabelHolder) viewHolder;
itemLabelHolder.c.setVisibility(0);
itemLabelHolder.a();
}
} else {
ItemTextDesHolder itemTextDesHolder = (ItemTextDesHolder) viewHolder;
itemTextDesHolder.a(i, this.d);
if (itemTextDesHolder.c.getTag() instanceof TextWatcher) {
itemTextDesHolder.c.removeTextChangedListener((TextWatcher) itemTextDesHolder.c.getTag());
}
itemTextDesHolder.c.setText(itemBean.getProcedureDes());
TextWatcher a4 = a(itemBean);
itemTextDesHolder.c.addTextChangedListener(a4);
itemTextDesHolder.c.setTag(a4);
}
((BaseItemVideoHolder) viewHolder).a(i);
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
if (i != 0) {
if (i == 1) {
return new ItemImageHolder(View.inflate(this.b, R.layout.item_publish_image, null));
}
if (i == 2) {
return new ItemVideoHolder(this, View.inflate(this.b, R.layout.item_publish_video_layout, null));
}
if (i == 3) {
return new ItemTextDesHolder(View.inflate(this.b, R.layout.item_publish_des_layout, null));
}
if (i != 4) {
return null;
}
return new ItemLabelHolder(View.inflate(this.b, R.layout.item_publish_label_layout, null));
}
ItemEmptyHolder itemEmptyHolder = new ItemEmptyHolder(this, View.inflate(this.b, R.layout.item_publish_empty_layout, null));
int i2 = this.i;
if (i2 != -2) {
if (i2 == -1 || i2 == 1) {
itemEmptyHolder.c.setText(R.string.add_image_des_new);
return itemEmptyHolder;
}
if (i2 != 2) {
if (i2 != 5) {
return itemEmptyHolder;
}
itemEmptyHolder.c.setText(R.string.add_image_video);
return itemEmptyHolder;
}
}
itemEmptyHolder.c.setText(R.string.add_video_des);
return itemEmptyHolder;
}
public void b(int i) {
this.i = i;
}
public void b(List<PublishLabelBean> list) {
this.j = list;
notifyDataSetChanged();
}
public void a(OnVideoItemClickListener onVideoItemClickListener) {
this.c = onVideoItemClickListener;
}
/* JADX INFO: Access modifiers changed from: private */
public void b(int i, List<PublishItemBean.ItemBean> list) {
list.remove(i);
a(list);
notifyItemRemoved(i);
if (list.size() > i) {
PublishItemBean.ItemBean itemBean = list.get(i);
String procedureDes = itemBean.getProcedureDes();
if (itemBean.getItemType() != PublishType.VIDEO && itemBean.getItemType() != PublishType.IMAGE && TextUtils.isEmpty(procedureDes)) {
list.remove(i);
notifyItemRemoved(i);
} else if (itemBean.getItemType() != PublishType.VIDEO && itemBean.getItemType() != PublishType.IMAGE && !TextUtils.isEmpty(procedureDes)) {
int i2 = i - 1;
if (i2 >= 0) {
PublishItemBean.ItemBean itemBean2 = list.get(i2);
String procedureDes2 = itemBean2.getProcedureDes();
if (!TextUtils.isEmpty(procedureDes2)) {
procedureDes = procedureDes2 + "\r\n" + procedureDes;
}
itemBean2.setProcedureDes(procedureDes);
}
list.remove(i);
notifyItemRemoved(i);
}
}
if (a()) {
PublishItemBean.ItemBean itemBean3 = new PublishItemBean.ItemBean();
itemBean3.setItemType(PublishType.EMPTY);
list.add(itemBean3);
}
notifyItemRangeChanged(0, list.size());
}
public void a(OnAddContentListener onAddContentListener) {
this.e = onAddContentListener;
}
public void a(OnClickLabelItemListener onClickLabelItemListener) {
this.k = onClickLabelItemListener;
}
private void a(TextInputEditText textInputEditText) {
textInputEditText.setFilters(new InputFilter[]{new InputFilter() { // from class: com.ubt.jimu.widgets.SortRecyclerView.PublishEditAdapter.4
@Override // android.text.InputFilter
public CharSequence filter(CharSequence charSequence, int i, int i2, Spanned spanned, int i3, int i4) {
if (PublishEditAdapter.this.h != null && i3 == 140) {
PublishEditAdapter.this.h.o0();
}
return charSequence.toString();
}
}, new InputFilter.LengthFilter(TwitterAuthConfig.DEFAULT_AUTH_REQUEST_CODE)});
}
private TextWatcher a(final PublishItemBean.ItemBean itemBean) {
return new TextWatcher(this) { // from class: com.ubt.jimu.widgets.SortRecyclerView.PublishEditAdapter.5
@Override // android.text.TextWatcher
public void afterTextChanged(Editable editable) {
String obj = editable.toString();
if (TextUtils.isEmpty(obj)) {
return;
}
itemBean.setProcedureDes(obj);
}
@Override // android.text.TextWatcher
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override // android.text.TextWatcher
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
};
}
public boolean a(int i, List<PublishItemBean.ItemBean> list) {
if (list.size() == 0) {
return false;
}
if (i == 0) {
return true;
}
int i2 = i + 1;
if (list.size() > i2) {
return list.get(i2).getItemType() == PublishType.TEXTDES || list.get(i - 1).getItemType() == PublishType.TEXTDES;
}
return false;
}
private void a(final ItemVideoHolder itemVideoHolder, final String str) {
Bitmap bitmap = this.f.get(str);
if (bitmap != null) {
itemVideoHolder.c.setImageBitmap(bitmap);
} else {
VideoUtils.a().b(str).subscribe(new Consumer<Bitmap>() { // from class: com.ubt.jimu.widgets.SortRecyclerView.PublishEditAdapter.6
@Override // io.reactivex.functions.Consumer
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public void accept(Bitmap bitmap2) throws Exception {
if (itemVideoHolder.c.getTag() == null || itemVideoHolder.c.getTag().equals(str)) {
itemVideoHolder.c.setImageBitmap(bitmap2);
itemVideoHolder.c.setTag(str);
PublishEditAdapter.this.f.put(str, bitmap2);
}
}
});
}
}
public boolean a() {
for (int i = 0; i < this.d.size(); i++) {
PublishItemBean.ItemBean itemBean = this.d.get(i);
if (itemBean.getItemType() == PublishType.VIDEO || itemBean.getItemType() == PublishType.IMAGE) {
return false;
}
}
return true;
}
public void a(List<PublishItemBean.ItemBean> list) {
if (list == null || list.size() == 0) {
return;
}
int i = 0;
boolean z = false;
int i2 = 0;
while (true) {
if (i >= list.size()) {
i = i2;
break;
}
PublishItemBean.ItemBean itemBean = list.get(i);
PublishType itemType = itemBean.getItemType();
if (itemType == PublishType.IMAGE && !z) {
i2 = i;
z = true;
}
if (itemBean.isCover()) {
itemBean.setCover(false);
}
if (itemType == PublishType.VIDEO) {
z = false;
}
if (itemType == PublishType.VIDEO && !z) {
this.a.setLocalUrl(itemBean.getLoadPath());
itemBean.setCover(true);
break;
}
i++;
}
PublishItemBean.ItemBean itemBean2 = list.get(i);
itemBean2.setCover(true);
this.a.setLocalUrl(itemBean2.getLoadPath());
}
public void a(OnDeleteItemFeedbackListener onDeleteItemFeedbackListener) {
this.g = onDeleteItemFeedbackListener;
}
public void a(WordLimitListener wordLimitListener) {
this.h = wordLimitListener;
}
}

View File

@@ -0,0 +1,41 @@
package com.ubt.jimu.widgets;
import android.graphics.Rect;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
import com.ubtrobot.log.ALog;
/* loaded from: classes2.dex */
public class SpaceGridItemDecoration extends RecyclerView.ItemDecoration {
private int a;
private int b;
private int c;
private boolean d;
public SpaceGridItemDecoration(int i, int i2, int i3, boolean z) {
this.c = i3;
this.a = i;
this.b = i2;
this.d = z;
}
@Override // androidx.recyclerview.widget.RecyclerView.ItemDecoration
public void getItemOffsets(Rect rect, View view, RecyclerView recyclerView, RecyclerView.State state) {
super.getItemOffsets(rect, view, recyclerView, state);
rect.bottom = this.a;
rect.right = this.b;
rect.top = 0;
if (this.d) {
if (this.c == 0 || (recyclerView.f(view) - 1) % this.c != 0) {
rect.left = 0;
} else {
rect.left = this.b;
}
} else if (recyclerView.f(view) % this.c == 0) {
rect.left = this.b;
} else {
rect.left = 0;
}
ALog.a("outRect.right==" + rect.right + "##outRect.left==" + rect.left + "position==" + recyclerView.f(view), new Object[0]);
}
}

View File

@@ -0,0 +1,53 @@
package com.ubt.jimu.widgets;
import android.graphics.Rect;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
/* loaded from: classes2.dex */
public class SpaceItemDecoration extends RecyclerView.ItemDecoration {
private int a;
private int b;
private int c;
private boolean d;
private Rect e;
public SpaceItemDecoration(int i, int i2) {
this(i, i2, 0);
}
@Override // androidx.recyclerview.widget.RecyclerView.ItemDecoration
public void getItemOffsets(Rect rect, View view, RecyclerView recyclerView, RecyclerView.State state) {
super.getItemOffsets(rect, view, recyclerView, state);
Rect rect2 = this.e;
if (rect2 != null) {
rect.left = rect2.left;
rect.top = rect2.top;
rect.right = rect2.right;
rect.bottom = rect2.bottom;
} else {
rect.bottom = this.a;
rect.right = this.b;
rect.top = 0;
rect.left = 0;
}
if (this.d && this.c != 0 && (recyclerView.f(view) + 1) % this.c == 0) {
rect.right = 0;
}
}
public SpaceItemDecoration(int i, int i2, int i3) {
this(i, i2, i3, false);
}
public SpaceItemDecoration(int i, int i2, int i3, boolean z) {
this.c = i3;
this.a = i;
this.b = i2;
this.d = z;
}
public SpaceItemDecoration(Rect rect) {
this.e = rect;
}
}

View File

@@ -0,0 +1,101 @@
package com.ubt.jimu.widgets;
import android.content.Context;
import android.graphics.BlurMaskFilter;
import android.graphics.Canvas;
import android.graphics.EmbossMaskFilter;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.SweepGradient;
import android.util.AttributeSet;
import android.view.View;
import com.ubt.jimu.R;
/* loaded from: classes2.dex */
public class SweepGradientCircleProgressBar extends View {
private Paint a;
private Paint b;
private float[] c;
private float d;
private int[] e;
private float f;
private RectF g;
private boolean h;
private float i;
private int j;
private int k;
private int l;
public SweepGradientCircleProgressBar(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.c = new float[]{1.0f, 1.0f, 1.0f};
this.d = 0.4f;
this.e = new int[]{getContext().getResources().getColor(R.color.bg_A00A9FF), getContext().getResources().getColor(R.color.bg_A00A9FF)};
this.f = 10.0f;
this.h = false;
this.i = 3.5f;
this.j = 15;
this.k = 0;
this.l = 100;
a();
this.g = new RectF();
new EmbossMaskFilter(this.c, this.d, this.f, this.i);
new BlurMaskFilter(20.0f, BlurMaskFilter.Blur.NORMAL);
}
private void a() {
this.a = new Paint();
this.a.setAntiAlias(true);
this.a.setFlags(1);
this.a.setStyle(Paint.Style.STROKE);
this.a.setDither(true);
this.a.setStrokeJoin(Paint.Join.ROUND);
this.b = new Paint();
this.b.setAntiAlias(true);
this.b.setFlags(1);
this.b.setStyle(Paint.Style.STROKE);
this.b.setDither(false);
this.b.setStrokeJoin(Paint.Join.ROUND);
}
public int getMax() {
return this.l;
}
public int getProgress() {
return this.k;
}
@Override // android.view.View
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (this.h) {
canvas.drawColor(0);
this.h = false;
}
a(canvas);
}
public void setMax(int i) {
this.l = i;
}
public void setProgress(int i) {
this.k = i;
invalidate();
}
private void a(Canvas canvas) {
int measuredWidth = getMeasuredWidth();
int measuredWidth2 = getMeasuredWidth() / 2;
int i = measuredWidth2 - this.j;
this.b.setStrokeCap(Paint.Cap.ROUND);
this.b.setStrokeWidth(this.j + 1);
this.g.set(measuredWidth2 - i, r0 - i, measuredWidth2 + i, i + r0);
this.b.setShader(null);
this.b.setColor(getResources().getColor(R.color.progress_secondary));
canvas.drawArc(this.g, 0.0f, 360.0f, false, this.b);
this.b.setShader(new SweepGradient(measuredWidth2, measuredWidth / 2, this.e, (float[]) null));
canvas.drawArc(this.g, 0.0f, (this.k / this.l) * 360.0f, false, this.b);
}
}

View File

@@ -0,0 +1,230 @@
package com.ubt.jimu.widgets;
import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.ubt.jimu.R;
import com.ubt.jimu.controller.util.ScreenUtil;
import com.ubt.jimu.utils.LogUtils;
import java.util.List;
/* loaded from: classes2.dex */
public class TagFlowLayout extends ViewGroup {
private Context a;
private List<String> b;
private int c;
private int d;
private int e;
private TextView f;
private String g;
private OnClickLabelListener h;
public interface OnClickLabelListener {
void a(String str);
}
public TagFlowLayout(Context context) {
super(context);
this.c = 0;
this.d = 0;
this.e = Integer.MAX_VALUE;
}
public String getLastLabelStr() {
return this.g;
}
@Override // android.view.ViewGroup, android.view.View
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
int childCount;
int i5 = this.c;
int i6 = this.d;
List<String> list = this.b;
if (list == null || list.size() == 0 || (childCount = getChildCount()) == 0) {
return;
}
int i7 = i6;
int i8 = 1;
for (int i9 = 0; i9 < childCount; i9++) {
View childAt = getChildAt(i9);
int measuredWidth = childAt.getMeasuredWidth();
int measuredHeight = childAt.getMeasuredHeight();
if (i5 > (i3 - i) - measuredWidth) {
i5 = this.c;
i8++;
}
if (i8 > 1) {
if (i8 > this.e) {
return;
} else {
i7 = ((i8 - 1) * measuredHeight) + (this.d * i8);
}
}
int i10 = measuredWidth + i5;
childAt.layout(i5, i7, i10, measuredHeight + i7);
i5 = this.c + i10;
}
}
@Override // android.view.View
protected void onMeasure(int i, int i2) {
super.onMeasure(i, i2);
List<String> list = this.b;
if (list == null || list.size() == 0) {
return;
}
int mode = View.MeasureSpec.getMode(i);
int mode2 = View.MeasureSpec.getMode(i2);
int size = View.MeasureSpec.getSize(i);
measureChildren(i, i2);
int childCount = getChildCount();
int i3 = 0;
if (childCount == 0) {
setMeasuredDimension(0, 0);
return;
}
if (mode == Integer.MIN_VALUE && mode2 == Integer.MIN_VALUE) {
int i4 = 0;
int i5 = 0;
while (i3 < childCount && i3 <= this.e) {
View childAt = getChildAt(i3);
int measuredWidth = childAt.getMeasuredWidth();
int measuredHeight = childAt.getMeasuredHeight();
if (measuredWidth > i4) {
i4 = measuredWidth;
}
if (measuredHeight > i5) {
i5 = measuredHeight;
}
i3++;
}
setMeasuredDimension(i4, i5 * childCount);
return;
}
if (mode == Integer.MIN_VALUE) {
return;
}
if (mode2 == 0 || mode2 == Integer.MIN_VALUE) {
int i6 = this.c;
int i7 = 1;
int i8 = 0;
while (true) {
if (i3 >= childCount) {
break;
}
View childAt2 = getChildAt(i3);
int measuredWidth2 = childAt2.getMeasuredWidth();
i8 = childAt2.getMeasuredHeight();
if (i6 > size - measuredWidth2) {
i6 = this.c;
i7++;
}
i6 = i6 + measuredWidth2 + this.c;
if (i7 > this.e) {
i7--;
break;
}
i3++;
}
LogUtils.c("line:" + i7);
setMeasuredDimension(size, (i8 * i7) + (this.d * (i7 + 1)));
}
}
public void setData(List<String> list) {
removeAllViews();
this.b = list;
if (list == null || list.size() == 0) {
return;
}
for (int i = 0; i < list.size(); i++) {
String str = list.get(i);
TextView textView = new TextView(this.a);
textView.setText(str);
textView.setTextColor(getResources().getColor(R.color.txt_96A6B4));
textView.setTextSize(getResources().getDimension(R.dimen.txt_publish_label));
textView.setBackgroundResource(R.drawable.slt_publish_tag);
textView.setPadding(ScreenUtil.a(this.a, 20), ScreenUtil.a(this.a, 10), ScreenUtil.a(this.a, 20), ScreenUtil.a(this.a, 10));
if (!TextUtils.isEmpty(this.g) && !TextUtils.isEmpty(str) && str.equals(this.g)) {
LogUtils.c("XXXXXXX");
textView.setBackgroundResource(R.drawable.bg_publish_tag_select);
textView.setTextColor(getResources().getColor(R.color.bg_FFFFFF));
textView.setTag(true);
OnClickLabelListener onClickLabelListener = this.h;
if (onClickLabelListener != null) {
onClickLabelListener.a(str);
}
this.f = textView;
}
addView(textView);
a(textView, i);
}
LogUtils.c("childViewList:" + list.size());
}
public void setLastLabelStr(String str) {
this.g = str;
}
public void setMaxLines(int i) {
this.e = i;
}
public void setOnClickLabelListener(OnClickLabelListener onClickLabelListener) {
this.h = onClickLabelListener;
}
private void a(final TextView textView, final int i) {
if (textView == null) {
return;
}
textView.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.TagFlowLayout.1
@Override // android.view.View.OnClickListener
public void onClick(View view) {
LogUtils.c("onClick " + i);
if (TagFlowLayout.this.f != null) {
TagFlowLayout.this.f.setBackgroundResource(R.drawable.bg_publish_tag_default);
TagFlowLayout.this.f.setTextColor(TagFlowLayout.this.getResources().getColor(R.color.txt_96A6B4));
if (!TagFlowLayout.this.f.equals(view)) {
TagFlowLayout.this.f.setTag(false);
}
}
Boolean bool = (Boolean) textView.getTag();
if (bool != null && bool.booleanValue()) {
textView.setTag(false);
textView.setBackgroundResource(R.drawable.bg_publish_tag_default);
textView.setTextColor(TagFlowLayout.this.getResources().getColor(R.color.txt_96A6B4));
TagFlowLayout.this.f = null;
LogUtils.c("没有选择");
if (TagFlowLayout.this.h != null) {
TagFlowLayout.this.h.a("");
return;
}
return;
}
textView.setTag(true);
textView.setBackgroundResource(R.drawable.bg_publish_tag_select);
textView.setTextColor(TagFlowLayout.this.getResources().getColor(R.color.bg_FFFFFF));
TagFlowLayout.this.f = textView;
LogUtils.c("选择:" + ((String) TagFlowLayout.this.b.get(i)));
if (TagFlowLayout.this.h != null) {
TagFlowLayout.this.h.a((String) TagFlowLayout.this.b.get(i));
}
}
});
}
public TagFlowLayout(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.c = 0;
this.d = 0;
this.e = Integer.MAX_VALUE;
this.a = context;
this.c = ScreenUtil.a(this.a, 10);
this.d = ScreenUtil.a(this.a, 10);
LogUtils.c("新建TagFlowLayout");
}
}

View File

@@ -0,0 +1,36 @@
package com.ubt.jimu.widgets;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import com.ubt.jimu.R;
import com.ubt.jimu.utils.LocaleUtils;
/* loaded from: classes2.dex */
public class ThirdLoginView extends LinearLayout {
public ThirdLoginView(Context context) {
this(context, null);
}
private void a(Context context) {
if (LocaleUtils.f()) {
LayoutInflater.from(context).inflate(R.layout.lay_register_third_china, this);
} else {
LayoutInflater.from(context).inflate(R.layout.lay_register_third_oversea, this);
}
}
public ThirdLoginView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public ThirdLoginView(Context context, AttributeSet attributeSet, int i) {
this(context, attributeSet, i, 0);
}
public ThirdLoginView(Context context, AttributeSet attributeSet, int i, int i2) {
super(context, attributeSet, i, i2);
a(context);
}
}

View File

@@ -0,0 +1,138 @@
package com.ubt.jimu.widgets;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.ubt.jimu.R;
import com.ubt.jimu.base.UbtActivityStack;
/* loaded from: classes2.dex */
public class TitleDiyView extends RelativeLayout {
private LayoutInflater a;
private Context b;
private ImageView c;
private TextView d;
private TextView e;
private TextView f;
private RelativeLayout g;
private RightOnClickListener h;
private PreRightOnClickListener i;
private ReturnOnClickListener j;
public interface PreRightOnClickListener {
void onClick();
}
public interface ReturnOnClickListener {
void onClick();
}
public interface RightOnClickListener {
void onClick();
}
public TitleDiyView(Context context) {
super(context, null);
a(context);
}
public void setDiyPreRightResource(int i) {
if (i == 0) {
this.f.setVisibility(8);
} else {
this.f.setVisibility(0);
this.f.setBackgroundResource(i);
}
}
public void setDiyRightResource(int i) {
if (i == 0) {
this.e.setVisibility(8);
} else {
this.e.setVisibility(0);
this.e.setBackgroundResource(i);
}
}
public void setDiyTitle(String str) {
this.d.setText(str);
}
public void setPreRightListener(PreRightOnClickListener preRightOnClickListener) {
this.i = preRightOnClickListener;
}
public void setReturnListener(ReturnOnClickListener returnOnClickListener) {
this.j = returnOnClickListener;
}
public void setRightListener(RightOnClickListener rightOnClickListener) {
this.h = rightOnClickListener;
}
public void setTitleBackground(Drawable drawable) {
this.g.setBackground(drawable);
}
private void a(Context context) {
this.a = LayoutInflater.from(context);
this.b = context;
View inflate = this.a.inflate(R.layout.title_bar_diy, (ViewGroup) this, false);
addView(inflate);
a(inflate);
a();
}
public TitleDiyView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
a(context);
}
public TitleDiyView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet);
a(context);
}
private void a(View view) {
this.c = (ImageView) view.findViewById(R.id.diy_return);
this.d = (TextView) view.findViewById(R.id.diy_title);
this.e = (TextView) view.findViewById(R.id.diy_right);
this.f = (TextView) view.findViewById(R.id.diy_pre_right);
this.g = (RelativeLayout) view.findViewById(R.id.diy);
}
private void a() {
this.c.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.TitleDiyView.1
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (TitleDiyView.this.j == null) {
UbtActivityStack.getInstance().returnPreActivity(TitleDiyView.this.b);
} else {
TitleDiyView.this.j.onClick();
}
}
});
this.e.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.TitleDiyView.2
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (TitleDiyView.this.h != null) {
TitleDiyView.this.h.onClick();
}
}
});
this.f.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.TitleDiyView.3
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (TitleDiyView.this.i != null) {
TitleDiyView.this.i.onClick();
}
}
});
}
}

View File

@@ -0,0 +1,101 @@
package com.ubt.jimu.widgets;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.ubt.jimu.R;
import com.ubt.jimu.base.UbtActivityStack;
/* loaded from: classes2.dex */
public class TitleView extends RelativeLayout {
private LayoutInflater a;
private Context b;
RelativeLayout c;
ImageView d;
TextView e;
ImageView f;
private OnRightListener g;
public interface OnRightListener {
void a();
}
public TitleView(Context context) {
super(context, null);
a(context);
}
private void a(Context context) {
this.a = LayoutInflater.from(context);
this.b = context;
View inflate = this.a.inflate(R.layout.title_bar, (ViewGroup) this, false);
addView(inflate);
c(inflate);
a();
}
private void c(View view) {
this.c = (RelativeLayout) view.findViewById(R.id.title_background);
this.d = (ImageView) view.findViewById(R.id.tv_return);
this.e = (TextView) view.findViewById(R.id.tv_title);
this.f = (ImageView) view.findViewById(R.id.img_right);
}
public /* synthetic */ void b(View view) {
OnRightListener onRightListener = this.g;
if (onRightListener != null) {
onRightListener.a();
}
}
public void setOnRightListner(OnRightListener onRightListener) {
this.g = onRightListener;
}
public void setTitleBackgroundColor(int i) {
this.c.setBackgroundColor(i);
}
public void setTitleRight(int i) {
this.f.setVisibility(0);
this.f.setImageResource(i);
}
public void setTitleText(String str) {
this.e.setText(str);
}
public TitleView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
a(context);
}
public TitleView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet);
a(context);
}
private void a() {
this.d.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.i
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
TitleView.this.a(view);
}
});
this.f.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.j
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
TitleView.this.b(view);
}
});
}
public /* synthetic */ void a(View view) {
UbtActivityStack.getInstance().returnPreActivity(this.b);
}
}

View File

@@ -0,0 +1,114 @@
package com.ubt.jimu.widgets;
import android.content.Context;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatDialog;
import com.ubt.jimu.JimuApplication;
import com.ubt.jimu.R;
import com.ubt.jimu.widgets.UDialog;
import com.ubtech.utils.DisplayUtil;
import io.reactivex.disposables.CompositeDisposable;
/* loaded from: classes2.dex */
public class UDialog extends AppCompatDialog {
private CompositeDisposable c;
public static class Builder {
private Context a;
private TextView b;
private Button c;
private String d;
private String e;
private View.OnClickListener f;
private UDialog g;
public Builder(Context context) {
this.a = context;
this.g = new UDialog(context);
}
public Builder a(int i) {
this.d = this.a.getString(i);
return this;
}
public Builder a(int i, View.OnClickListener onClickListener) {
this.e = this.a.getString(i);
this.f = onClickListener;
return this;
}
public UDialog a() {
int i;
double d;
int a;
int a2;
this.g.setContentView(R.layout.dialog_common);
this.b = (TextView) this.g.findViewById(R.id.tvTips);
this.c = (Button) this.g.findViewById(R.id.btnOk);
this.g.setCancelable(false);
this.g.setCanceledOnTouchOutside(false);
this.b.setText(this.d);
this.c.setText(this.e);
this.c.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.k
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
UDialog.Builder.this.a(view);
}
});
Window window = this.g.getWindow();
WindowManager.LayoutParams attributes = window.getAttributes();
window.setBackgroundDrawableResource(R.color.translucent);
window.setWindowAnimations(R.style.dialogWindowAlphaIn);
int max = Math.max(DisplayUtil.b(JimuApplication.l()), DisplayUtil.a(JimuApplication.l()));
if (JimuApplication.l().i()) {
i = (int) (max * 0.5039d);
d = 0.624d;
} else {
i = (int) (max * 0.5165d);
d = 0.6088d;
}
int i2 = (int) (i * d);
if (JimuApplication.l().i()) {
a = DisplayUtil.a(this.a, 516.0f);
a2 = DisplayUtil.a(this.a, 322.0f);
} else {
a = DisplayUtil.a(this.a, 344.55f);
a2 = DisplayUtil.a(this.a, 209.75f);
}
if (a > i || a2 > i2) {
i = a;
i2 = a2;
}
attributes.width = i;
attributes.height = i2;
attributes.gravity = 17;
window.setAttributes(attributes);
return this.g;
}
public /* synthetic */ void a(View view) {
this.g.dismiss();
View.OnClickListener onClickListener = this.f;
if (onClickListener != null) {
onClickListener.onClick(view);
}
}
}
public UDialog(Context context) {
super(context);
this.c = new CompositeDisposable();
}
@Override // android.app.Dialog, android.content.DialogInterface
public void dismiss() {
super.dismiss();
this.c.dispose();
this.c.a();
}
}

View File

@@ -0,0 +1,100 @@
package com.ubt.jimu.widgets;
import android.content.Context;
import android.view.View;
import android.widget.PopupWindow;
import android.widget.TextView;
import com.ubt.jimu.R;
import com.ubt.jimu.utils.LogUtils;
/* loaded from: classes2.dex */
public class UniversalPopupWindow extends PopupWindow {
private static UniversalPopupWindow g;
private PopupWindow b;
private TextView c;
private TextView d;
private TextView e;
private UniversalPopupWindowListener f;
private Context a = this.a;
private Context a = this.a;
public interface UniversalPopupWindowListener {
void a();
void onCancel();
}
private UniversalPopupWindow(Context context) {
View inflate = View.inflate(context, R.layout.layout_universal_popupwindow, null);
this.b = new PopupWindow(inflate, -1, -1);
this.b.setOutsideTouchable(false);
this.b.setTouchable(true);
this.b.setAnimationStyle(R.style.popupWindow_anim_shop);
b(inflate);
a();
}
public UniversalPopupWindow c(String str) {
this.e.setText(str);
return g;
}
private void a() {
this.c.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.UniversalPopupWindow.1
@Override // android.view.View.OnClickListener
public void onClick(View view) {
LogUtils.c("点击");
UniversalPopupWindow.this.b.dismiss();
if (UniversalPopupWindow.this.f != null) {
UniversalPopupWindow.this.f.onCancel();
}
}
});
this.d.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.UniversalPopupWindow.2
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (UniversalPopupWindow.this.f != null) {
UniversalPopupWindow.this.f.a();
}
UniversalPopupWindow.this.b.dismiss();
}
});
}
private void b(View view) {
this.c = (TextView) view.findViewById(R.id.tv_cancel);
this.d = (TextView) view.findViewById(R.id.tv_ok);
this.e = (TextView) view.findViewById(R.id.tv_content);
}
public static UniversalPopupWindow a(Context context) {
if (g == null) {
g = new UniversalPopupWindow(context);
}
g.a(context.getResources().getString(R.string.btn_cancel_publish));
g.b(context.getResources().getString(R.string.ok));
return g;
}
public UniversalPopupWindow b(String str) {
this.d.setText(str);
return g;
}
public void a(View view) {
PopupWindow popupWindow = this.b;
if (popupWindow != null) {
popupWindow.showAtLocation(view, 80, 0, 0);
}
}
public UniversalPopupWindow a(String str) {
this.c.setText(str);
return g;
}
public UniversalPopupWindow a(UniversalPopupWindowListener universalPopupWindowListener) {
this.f = universalPopupWindowListener;
return g;
}
}

View File

@@ -0,0 +1,305 @@
package com.ubt.jimu.widgets;
import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
import android.view.View;
import android.view.WindowManager;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.ubt.jimu.JimuApplication;
import com.ubt.jimu.R;
import com.ubt.jimu.base.entities.Constant;
import com.ubt.jimu.utils.LogUtils;
import com.ubt.jimu.utils.SPUtils;
import com.ubtech.utils.XLog;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
import java.util.concurrent.TimeUnit;
/* loaded from: classes2.dex */
public class UploadPopupWindow implements View.OnClickListener {
private PopupWindow a;
private OnClickListener b;
private final RelativeLayout c;
private final RelativeLayout d;
private final LinearLayout e;
private final TextView f;
private final RelativeLayout g;
private final SweepGradientCircleProgressBar h;
private final CheckBox i;
private final TextView j;
private final TextView k;
private final TextView l;
private ImageView m;
private ImageView n;
private ImageView o;
private UploadState p;
private Activity q;
/* renamed from: com.ubt.jimu.widgets.UploadPopupWindow$5, reason: invalid class name */
static /* synthetic */ class AnonymousClass5 {
static final /* synthetic */ int[] a = new int[UploadState.values().length];
static {
try {
a[UploadState.UPLOAD_FAILURE.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[UploadState.UPLOAD_SUCCEED.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
a[UploadState.UPLOADING_PROGRESS.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
a[UploadState.SAVE_DRAFT.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
}
}
public interface OnClickListener {
void G();
void O();
void R();
void e0();
}
public enum UploadState {
UPLOAD_SUCCEED,
UPLOAD_FAILURE,
UPLOADING_PROGRESS,
STORAGE_SUCCEED,
STORAGE_PROGRESS,
SAVE_DRAFT
}
public UploadPopupWindow(Activity activity) {
this.q = activity;
View inflate = View.inflate(activity, R.layout.upload_popup_layout, null);
this.a = new PopupWindow(inflate, -1, -1);
this.a.setOutsideTouchable(false);
this.a.setTouchable(true);
this.a.setAnimationStyle(R.style.popupWindow_anim_shop);
((TextView) inflate.findViewById(R.id.tv_upload_back)).setOnClickListener(this);
((TextView) inflate.findViewById(R.id.tv_upload_continue)).setOnClickListener(this);
((TextView) inflate.findViewById(R.id.tv_upload_got)).setOnClickListener(this);
this.c = (RelativeLayout) inflate.findViewById(R.id.ll_upload_failure);
this.o = (ImageView) inflate.findViewById(R.id.im_publish_failure);
this.d = (RelativeLayout) inflate.findViewById(R.id.ll_upload_succeed_hint);
this.m = (ImageView) inflate.findViewById(R.id.im_upload_succeed);
this.n = (ImageView) inflate.findViewById(R.id.im_upload_succeed_2);
this.j = (TextView) inflate.findViewById(R.id.tv_upload_succeed);
this.k = (TextView) inflate.findViewById(R.id.tv_succeed_title);
this.i = (CheckBox) inflate.findViewById(R.id.cb_upload_hint);
this.e = (LinearLayout) inflate.findViewById(R.id.ll_upload_succeed);
this.f = (TextView) inflate.findViewById(R.id.tv_upload_cancel);
this.f.setOnClickListener(this);
this.g = (RelativeLayout) inflate.findViewById(R.id.ll_upload_progress);
this.h = (SweepGradientCircleProgressBar) inflate.findViewById(R.id.pro_upload_view);
this.l = (TextView) inflate.findViewById(R.id.tv_update_des);
a(activity);
WindowManager.LayoutParams attributes = activity.getWindow().getAttributes();
attributes.alpha = 0.3f;
activity.getWindow().addFlags(2);
activity.getWindow().setAttributes(attributes);
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
switch (view.getId()) {
case R.id.tv_upload_back /* 2131297829 */:
a();
break;
case R.id.tv_upload_cancel /* 2131297830 */:
a();
OnClickListener onClickListener = this.b;
if (onClickListener != null) {
onClickListener.O();
break;
}
break;
case R.id.tv_upload_continue /* 2131297831 */:
OnClickListener onClickListener2 = this.b;
if (onClickListener2 != null) {
onClickListener2.e0();
break;
}
break;
case R.id.tv_upload_got /* 2131297833 */:
a();
if (this.p == UploadState.SAVE_DRAFT) {
SPUtils.a(Constant.Publish.SAVE_DRAFT_SUCCEED_DHINT_KEY, this.i.isChecked());
} else {
SPUtils.a(Constant.Publish.SUCCEED_HINT_KEY, this.i.isChecked());
}
LogUtils.c("I got it");
OnClickListener onClickListener3 = this.b;
if (onClickListener3 != null) {
if (this.p != UploadState.SAVE_DRAFT) {
onClickListener3.G();
break;
} else {
onClickListener3.R();
break;
}
}
break;
}
}
private void b(String str) {
this.j.setText(str);
}
private void d() {
this.q.runOnUiThread(new Runnable() { // from class: com.ubt.jimu.widgets.UploadPopupWindow.2
@Override // java.lang.Runnable
public void run() {
UploadPopupWindow.this.c.setVisibility(0);
UploadPopupWindow.this.d.setVisibility(8);
UploadPopupWindow.this.e.setVisibility(8);
UploadPopupWindow.this.g.setVisibility(8);
((AnimationDrawable) UploadPopupWindow.this.o.getBackground()).start();
}
});
}
private void e() {
this.c.setVisibility(8);
this.d.setVisibility(8);
this.e.setVisibility(8);
this.g.setVisibility(0);
}
public void a(String str) {
this.l.setText(str);
}
public boolean c() {
return this.a.isShowing();
}
private void a(final Activity activity) {
this.a.setOnDismissListener(new PopupWindow.OnDismissListener(this) { // from class: com.ubt.jimu.widgets.UploadPopupWindow.1
@Override // android.widget.PopupWindow.OnDismissListener
public void onDismiss() {
WindowManager.LayoutParams attributes = activity.getWindow().getAttributes();
attributes.alpha = 1.0f;
activity.getWindow().clearFlags(2);
activity.getWindow().setAttributes(attributes);
}
});
}
public int b() {
return this.h.getMax();
}
public void a(View view, UploadState uploadState) {
int i = AnonymousClass5.a[uploadState.ordinal()];
if (i == 1) {
d();
} else if (i == 2) {
a(uploadState);
} else if (i == 3) {
e();
} else if (i != 4) {
XLog.b("upload", "unknown upload state : %d", uploadState);
} else {
a(uploadState);
}
if (this.a.isShowing()) {
return;
}
this.a.showAtLocation(view, 80, 0, 0);
}
public void b(int i) {
this.h.setProgress(i);
}
private void a(UploadState uploadState) {
boolean a = SPUtils.a(Constant.Publish.SUCCEED_HINT_KEY);
boolean a2 = SPUtils.a(Constant.Publish.SAVE_DRAFT_SUCCEED_DHINT_KEY);
if (a && uploadState == UploadState.UPLOAD_SUCCEED) {
this.c.setVisibility(8);
this.d.setVisibility(8);
this.e.setVisibility(0);
this.g.setVisibility(8);
((AnimationDrawable) this.n.getBackground()).start();
Observable.timer(1500L, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.b()).observeOn(AndroidSchedulers.a()).subscribe(new Consumer<Long>() { // from class: com.ubt.jimu.widgets.UploadPopupWindow.3
@Override // io.reactivex.functions.Consumer
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public void accept(Long l) throws Exception {
UploadPopupWindow.this.a();
if (UploadPopupWindow.this.b != null) {
UploadPopupWindow.this.b.G();
UploadPopupWindow.this.n.clearAnimation();
}
}
});
return;
}
if (!a && uploadState == UploadState.UPLOAD_SUCCEED) {
this.c.setVisibility(8);
this.d.setVisibility(0);
b(JimuApplication.l().getResources().getString(R.string.upload_completed) + ". " + JimuApplication.l().getResources().getString(R.string.upload_completed_des));
this.e.setVisibility(8);
this.g.setVisibility(8);
((AnimationDrawable) this.m.getBackground()).start();
return;
}
if (a2 && uploadState == UploadState.SAVE_DRAFT) {
this.k.setText(JimuApplication.l().getResources().getString(R.string.save_draft));
this.p = UploadState.SAVE_DRAFT;
this.c.setVisibility(8);
this.d.setVisibility(8);
this.e.setVisibility(0);
this.g.setVisibility(8);
((AnimationDrawable) this.n.getBackground()).start();
Observable.timer(1500L, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.b()).observeOn(AndroidSchedulers.a()).subscribe(new Consumer<Long>() { // from class: com.ubt.jimu.widgets.UploadPopupWindow.4
@Override // io.reactivex.functions.Consumer
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public void accept(Long l) throws Exception {
UploadPopupWindow.this.a();
if (UploadPopupWindow.this.b == null || UploadPopupWindow.this.p != UploadState.SAVE_DRAFT) {
return;
}
UploadPopupWindow.this.b.R();
}
});
return;
}
b(JimuApplication.l().getResources().getString(R.string.save_draft) + ". " + JimuApplication.l().getResources().getString(R.string.save_succeed));
this.p = UploadState.SAVE_DRAFT;
this.c.setVisibility(8);
this.d.setVisibility(0);
this.e.setVisibility(8);
this.g.setVisibility(8);
((AnimationDrawable) this.m.getBackground()).start();
}
public void a() {
this.a.dismiss();
}
public void a(int i) {
this.h.setMax(i);
}
public void a(OnClickListener onClickListener) {
this.b = onClickListener;
}
}

View File

@@ -0,0 +1,514 @@
package com.ubt.jimu.widgets.choosePhotos;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.media.MediaMetadataRetriever;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.CheckBox;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.liulishuo.filedownloader.model.FileDownloadModel;
import com.ubt.jimu.R;
import com.ubt.jimu.base.entities.Constant;
import com.ubt.jimu.utils.SPUtils;
import com.ubt.jimu.widgets.NavigationBarView;
import com.ubt.jimu.widgets.choosePhotos.media.HPImage;
import com.ubt.jimu.widgets.choosePhotos.media.HPMedia;
import com.ubt.jimu.widgets.choosePhotos.media.HPVideo;
import com.ubt.jimu.widgets.player.UbtPlayer;
import com.ubtech.permission.JimuPermissionRequest;
import com.ubtech.permission.PermissionRequestListener;
import com.ubtech.utils.BitmapFile;
import com.ubtech.view.widget.ToastView;
import java.io.File;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
/* loaded from: classes2.dex */
public class AlbumActivity extends BaseActivity implements AlbumOnClickListener {
private static StaticHandler m;
private View a;
private RecyclerView c;
private AlbumRecyclerViewAdapter d;
private int k;
private NavigationBarView l;
private final String b = AlbumActivity.class.getSimpleName();
private ArrayList<HPMedia> e = new ArrayList<>();
private List<HPMedia> f = new ArrayList();
private List<HPMedia> g = new ArrayList();
private ArrayList<HPMedia> h = new ArrayList<>();
public String i = "MULTITERM_VIDEO_IMAGE";
private int j = 5;
private static class StaticHandler extends Handler {
private WeakReference<AlbumActivity> a;
public StaticHandler(AlbumActivity albumActivity) {
this.a = new WeakReference<>(albumActivity);
}
public WeakReference<AlbumActivity> a() {
return this.a;
}
}
/* JADX INFO: Access modifiers changed from: private */
public void F0() {
this.e.add(D0());
this.e.addAll(this.g);
this.e.addAll(this.f);
Collections.sort(this.e, new HPMediaComparator());
this.d.a(this.i);
this.d.a(this.e);
}
/* JADX INFO: Access modifiers changed from: private */
public void initData() {
this.c.setLayoutManager(new GridLayoutManager(this, 6));
this.d = new AlbumRecyclerViewAdapter(this);
this.d.a(this);
this.c.setAdapter(this.d);
Intent intent = getIntent();
ArrayList arrayList = (ArrayList) intent.getSerializableExtra("selected_items");
if (arrayList != null && arrayList.size() > 0) {
this.h.addAll(arrayList);
}
if (intent.getIntExtra("type", 0) == 1 && "UNITERMING_IMAGE".equals(intent.getStringExtra("FROM_PAGE_KEY"))) {
this.l.setTitle(R.string.my_albums);
this.i = "UNITERMING_IMAGE";
this.l.setMode(0);
}
if ("MULTITERM_VIDEO_IMAGE".equals(intent.getStringExtra("FROM_PAGE_KEY"))) {
this.l.setTitle(R.string.title_album);
this.l.setRightIcon(R.drawable.community_collection_icon);
this.l.setRightAlpha(0.3f);
this.l.setLeftIcon(R.drawable.community_cancel);
}
if ("MULTITERM_VIDEO".equals(intent.getStringExtra("FROM_PAGE_KEY"))) {
this.i = "MULTITERM_VIDEO";
this.l.setTitle(R.string.video);
this.l.setRightIcon(R.drawable.community_collection_icon);
}
if ("MULTITERM_IMAGE".equals(intent.getStringExtra("FROM_PAGE_KEY"))) {
this.i = "MULTITERM_IMAGE";
this.l.setTitle(R.string.title_photo);
this.l.setRightIcon(R.drawable.community_collection_icon);
}
if ("UNITERMING_VIDEO".equals(intent.getStringExtra("FROM_PAGE_KEY"))) {
this.i = "UNITERMING_VIDEO";
this.l.setTitle(R.string.video);
this.l.setRightIcon(R.drawable.community_collection_icon);
}
new Thread(new Runnable() { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumActivity.8
@Override // java.lang.Runnable
public void run() {
if (AlbumActivity.this.j == 1 || AlbumActivity.this.j == -1) {
AlbumActivity.this.f.addAll(HPImage.getImages(AlbumActivity.this));
} else if (AlbumActivity.this.j == 2) {
AlbumActivity.this.g.addAll(HPVideo.getVideos(AlbumActivity.this));
} else {
AlbumActivity.this.f.addAll(HPImage.getImages(AlbumActivity.this));
AlbumActivity.this.g.addAll(HPVideo.getVideos(AlbumActivity.this));
}
AlbumActivity.m.sendEmptyMessage(Constant.Publish.REQUEST_CODE_PICK_FILE);
ArrayList arrayList2 = new ArrayList();
Iterator it = AlbumActivity.this.h.iterator();
while (it.hasNext()) {
HPMedia hPMedia = (HPMedia) it.next();
for (HPMedia hPMedia2 : AlbumActivity.this.f) {
if (hPMedia.getId() == hPMedia2.getId() || hPMedia.getPath().equals(hPMedia2.getPath())) {
hPMedia2.setSelected(true);
arrayList2.add(hPMedia2);
break;
}
}
}
Iterator it2 = AlbumActivity.this.h.iterator();
while (it2.hasNext()) {
HPMedia hPMedia3 = (HPMedia) it2.next();
for (HPMedia hPMedia4 : AlbumActivity.this.g) {
if (hPMedia3.getId() == hPMedia4.getId() || hPMedia3.getPath().equals(hPMedia4.getPath())) {
hPMedia4.setSelected(true);
arrayList2.add(hPMedia4);
break;
}
}
}
AlbumActivity.this.h.clear();
AlbumActivity.this.h.addAll(arrayList2);
final ArrayList arrayList3 = new ArrayList();
ArrayList<HPMedia> arrayList4 = new ArrayList();
arrayList4.addAll(AlbumActivity.this.g);
for (HPMedia hPMedia5 : arrayList4) {
if (((HPVideo) hPMedia5).getDuration() < 500) {
arrayList3.add(hPMedia5);
} else {
HPVideo.getVideoThumnail(AlbumActivity.this, hPMedia5);
}
}
AlbumActivity.m.post(new Runnable() { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumActivity.8.1
@Override // java.lang.Runnable
public void run() {
AlbumActivity.this.g.removeAll(arrayList3);
AlbumActivity.this.e.removeAll(arrayList3);
AlbumActivity.this.d.notifyDataSetChanged();
}
});
}
}).start();
}
private void initView() {
this.l = (NavigationBarView) findViewById(R.id.nbv_bar);
this.l.setRightIcon(R.drawable.ic_nav_finish);
this.l.setRightAlpha(0.3f);
this.l.setRightEnabled(false);
this.l.setListener(new NavigationBarView.OnActionClickListener.Stub() { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumActivity.7
@Override // com.ubt.jimu.widgets.NavigationBarView.OnActionClickListener.Stub
public void onLeftClick(View view) {
AlbumActivity.this.e(false);
}
@Override // com.ubt.jimu.widgets.NavigationBarView.OnActionClickListener.Stub
public void onRightClick(View view) {
AlbumActivity.this.e(true);
}
});
this.k = getIntent().getIntExtra(FileDownloadModel.TOTAL, 10);
this.j = getIntent().getIntExtra("type", 5);
this.c = (RecyclerView) findViewById(R.id.rv_album_list);
}
public HPMedia D0() {
HPMedia hPMedia = new HPMedia();
hPMedia.setId(Integer.MAX_VALUE);
hPMedia.setModifyDate("2147483647");
return hPMedia;
}
@Override // com.ubt.jimu.widgets.choosePhotos.AlbumOnClickListener
public void n0() {
if (this.h.size() == this.k) {
ToastView.a(this, getString(R.string.choose_more_pictures), ToastView.Type.ERROR).a();
} else {
JimuPermissionRequest.a((Context) this, new PermissionRequestListener() { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumActivity.9
@Override // com.ubtech.permission.PermissionRequestListener
public void onDenied() {
Log.i(AlbumActivity.this.b, "User denied CAMERA permission.");
}
@Override // com.ubtech.permission.PermissionRequestListener
public void onGranted() {
AlbumActivity albumActivity = AlbumActivity.this;
int i = 5;
if (albumActivity.j != 5) {
i = AlbumActivity.this.j;
} else if (AlbumActivity.this.h.size() != 0) {
i = 1;
}
VideoCaptureActivity.a(albumActivity, 102, i);
}
});
}
}
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
public void onActivityResult(int i, int i2, Intent intent) {
if (i == 101) {
a(i2, intent);
} else if (i == 102) {
b(i2, intent);
}
}
@Override // com.ubt.jimu.widgets.choosePhotos.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
m = new StaticHandler(this, this) { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumActivity.5
@Override // android.os.Handler
public void handleMessage(Message message) {
if (a() == null || a().get() == null) {
return;
}
int i = message.what;
if (i == 201) {
a().get().a(message);
} else if (i == 202) {
a().get().F0();
}
}
};
this.a = View.inflate(this, R.layout.activity_album_select, null);
setContentView(this.a);
initView();
JimuPermissionRequest.c(this, new PermissionRequestListener() { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumActivity.6
@Override // com.ubtech.permission.PermissionRequestListener
public void onDenied() {
Log.e(AlbumActivity.this.b, "Should not to here, should check storage permission before goto AlbumActivity!");
AlbumActivity.this.finish();
}
@Override // com.ubtech.permission.PermissionRequestListener
public void onGranted() {
AlbumActivity.this.initData();
}
});
}
@Override // com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
public void onDestroy() {
m.removeCallbacksAndMessages(null);
this.f.clear();
this.g.clear();
super.onDestroy();
}
@Override // androidx.appcompat.app.AppCompatActivity, android.app.Activity, android.view.KeyEvent.Callback
public boolean onKeyDown(int i, KeyEvent keyEvent) {
if (i != 4) {
return super.onKeyDown(i, keyEvent);
}
e(false);
return true;
}
@Override // com.ubt.jimu.ScreenRotationManageActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
protected void onPause() {
super.onPause();
}
@Override // com.ubt.jimu.ScreenRotationManageActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
protected void onResume() {
super.onResume();
}
@Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
protected void onStart() {
super.onStart();
}
@Override // com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
protected void onStop() {
super.onStop();
}
private void b(int i, Intent intent) {
if (i == 0) {
return;
}
String stringExtra = intent.getStringExtra("data");
if (!TextUtils.isEmpty(stringExtra) && new File(stringExtra).exists()) {
int intExtra = intent.getIntExtra("data_type", -1);
if (1 == intExtra) {
try {
HPVideo searchVideoByName = HPVideo.searchVideoByName(this, stringExtra);
if (searchVideoByName == null) {
searchVideoByName = new HPVideo();
searchVideoByName.setPath(stringExtra);
searchVideoByName.setMediaType(intExtra);
File file = new File(stringExtra);
if (!file.exists()) {
finish();
return;
} else {
searchVideoByName.setSize(file.length());
searchVideoByName.setDuration(HPVideo.getVideoDuration(stringExtra));
}
}
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
mediaMetadataRetriever.setDataSource(stringExtra);
String str = stringExtra.substring(0, stringExtra.lastIndexOf(".")) + ".jpg";
BitmapFile.a(mediaMetadataRetriever.getFrameAtTime(), str);
searchVideoByName.setPreview(str);
this.h.clear();
this.h.add(searchVideoByName);
} catch (Exception e) {
e.printStackTrace();
}
} else {
HPMedia searchImageByName = HPImage.searchImageByName(this, stringExtra);
if (searchImageByName == null) {
searchImageByName = new HPImage();
searchImageByName.setId(0);
searchImageByName.setPath(stringExtra);
searchImageByName.setPreview(stringExtra);
}
this.h.add(searchImageByName);
}
e(true);
}
}
/* JADX INFO: Access modifiers changed from: private */
public void e(boolean z) {
if (this.h.size() == 0) {
finish();
return;
}
Intent intent = new Intent();
if (z) {
intent.putExtra("result_data", this.h);
setResult(-1, intent);
} else {
setResult(0, intent);
}
finish();
}
public static void a(final Activity activity, final int i, final int i2, final ArrayList<HPMedia> arrayList, final int i3, final String str) {
JimuPermissionRequest.c(activity, new PermissionRequestListener() { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumActivity.2
@Override // com.ubtech.permission.PermissionRequestListener
public void onDenied() {
}
@Override // com.ubtech.permission.PermissionRequestListener
public void onGranted() {
Intent intent = new Intent(activity, (Class<?>) AlbumActivity.class);
intent.putExtra(FileDownloadModel.TOTAL, i2);
intent.putExtra("selected_items", arrayList);
intent.putExtra("type", i3);
intent.putExtra("FROM_PAGE_KEY", str);
activity.startActivityForResult(intent, i);
}
});
}
private void a(int i, Intent intent) {
if (i == 0) {
return;
}
List list = (List) intent.getSerializableExtra("selected");
List list2 = (List) SPUtils.c("ResultDate");
int intExtra = intent.getIntExtra("current", 0);
intent.getIntExtra("type", -1);
intent.getBooleanExtra("done", false);
if (list == null) {
list = new ArrayList();
this.l.setRightEnabled(false);
} else if (list.size() > 0) {
this.l.setRightEnabled(true);
} else {
this.l.setRightEnabled(false);
}
this.h.clear();
this.h.addAll(list);
this.e.clear();
this.e.addAll(list2);
if (i == 105) {
e(true);
return;
}
ArrayList<HPMedia> arrayList = this.h;
if (arrayList != null && arrayList.size() > 0) {
this.l.setRightEnabled(true);
this.l.setRightAlpha(1.0f);
} else {
this.l.setRightEnabled(false);
this.l.setRightAlpha(0.3f);
}
Message message = new Message();
message.what = 201;
message.arg1 = intExtra;
m.sendMessage(message);
}
/* JADX INFO: Access modifiers changed from: private */
public void a(Message message) {
if (this.h.size() == 0) {
this.l.setRightAlpha(0.4f);
} else {
this.l.setRightAlpha(1.0f);
}
this.d.notifyDataSetChanged();
}
@Override // com.ubt.jimu.widgets.choosePhotos.AlbumOnClickListener
public void a(CheckBox checkBox, HPMedia hPMedia, int i) {
if (this.i.equals("UNITERMING_IMAGE")) {
checkBox.setVisibility(0);
checkBox.setChecked(true);
Intent intent = new Intent();
this.h.add(hPMedia);
intent.putExtra("result_data", this.h);
setResult(-1, intent);
finish();
return;
}
PreviewActivity.a(this, this.e, this.h, this.k, i);
}
@Override // com.ubt.jimu.widgets.choosePhotos.AlbumOnClickListener
public void a(HPVideo hPVideo, int i) {
if (this.i.equals("UNITERMING_VIDEO")) {
UbtPlayer.a(this, null, hPVideo.getPath());
} else {
PreviewActivity.a(this, this.e, this.h, this.k, i);
}
}
@Override // com.ubt.jimu.widgets.choosePhotos.AlbumOnClickListener
public void a(CheckBox checkBox, boolean z, HPMedia hPMedia) {
if (z) {
if ("MULTITERM_VIDEO".equals(this.i) && hPMedia.getMediaType() == 0) {
Iterator<HPMedia> it = this.h.iterator();
while (it.hasNext()) {
if (it.next().isVideo()) {
ToastView.a(this, getString(R.string.tips_type_limit), ToastView.Type.ERROR).a();
hPMedia.setSelected(false);
checkBox.setChecked(false);
return;
}
}
}
if ("MULTITERM_VIDEO".equals(this.i) && hPMedia.getMediaType() == 1) {
Iterator<HPMedia> it2 = this.h.iterator();
while (it2.hasNext()) {
if (it2.next().getMediaType() == 0) {
ToastView.a(this, getString(R.string.tips_type_limit), ToastView.Type.ERROR).a();
hPMedia.setSelected(false);
checkBox.setChecked(false);
return;
}
}
}
if (this.h.size() >= this.k) {
checkBox.setSelected(false);
ToastView.a(this, getString(R.string.choose_more_pictures), ToastView.Type.ERROR).a();
} else {
hPMedia.setSelected(true);
this.h.add(hPMedia);
this.l.setRightEnabled(true);
}
} else {
hPMedia.setSelected(false);
Iterator<HPMedia> it3 = this.h.iterator();
while (true) {
if (!it3.hasNext()) {
break;
}
HPMedia next = it3.next();
if (next.getId() == hPMedia.getId()) {
this.h.remove(next);
break;
}
}
}
if (this.h.size() <= 0) {
this.l.setRightAlpha(0.3f);
this.l.setRightEnabled(false);
} else {
this.l.setRightAlpha(1.0f);
this.l.setRightEnabled(true);
}
}
}

View File

@@ -0,0 +1,16 @@
package com.ubt.jimu.widgets.choosePhotos;
import android.widget.CheckBox;
import com.ubt.jimu.widgets.choosePhotos.media.HPMedia;
import com.ubt.jimu.widgets.choosePhotos.media.HPVideo;
/* loaded from: classes2.dex */
public interface AlbumOnClickListener {
void a(CheckBox checkBox, HPMedia hPMedia, int i);
void a(CheckBox checkBox, boolean z, HPMedia hPMedia);
void a(HPVideo hPVideo, int i);
void n0();
}

View File

@@ -0,0 +1,178 @@
package com.ubt.jimu.widgets.choosePhotos;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestBuilder;
import com.bumptech.glide.request.RequestOptions;
import com.ubt.jimu.JimuApplication;
import com.ubt.jimu.R;
import com.ubt.jimu.widgets.choosePhotos.media.HPMedia;
import com.ubt.jimu.widgets.choosePhotos.media.HPVideo;
import java.util.List;
/* loaded from: classes2.dex */
public class AlbumRecyclerViewAdapter extends RecyclerView.Adapter {
private List<HPMedia> a;
private Context b;
private AlbumOnClickListener c;
private String d;
class AlbumHolder extends RecyclerView.ViewHolder {
public ImageView a;
public RelativeLayout b;
public TextView c;
public CheckBox d;
public ImageView e;
public AlbumHolder(AlbumRecyclerViewAdapter albumRecyclerViewAdapter, View view) {
super(view);
a(view);
}
private void a(View view) {
this.a = (ImageView) view.findViewById(R.id.imgMask);
this.b = (RelativeLayout) view.findViewById(R.id.llVideo);
this.c = (TextView) view.findViewById(R.id.tvDuration);
this.d = (CheckBox) view.findViewById(R.id.cb_select);
this.e = (ImageView) view.findViewById(R.id.view_shade);
}
}
class PhotographyHolder extends RecyclerView.ViewHolder {
public PhotographyHolder(View view) {
super(view);
a(view);
}
private void a(View view) {
view.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumRecyclerViewAdapter.PhotographyHolder.1
@Override // android.view.View.OnClickListener
public void onClick(View view2) {
if (AlbumRecyclerViewAdapter.this.c != null) {
AlbumRecyclerViewAdapter.this.c.n0();
}
}
});
}
}
public AlbumRecyclerViewAdapter(Context context) {
this.b = context;
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public int getItemCount() {
List<HPMedia> list = this.a;
if (list == null || list.size() == 0) {
return 0;
}
return this.a.size();
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public int getItemViewType(int i) {
return i == 0 ? 0 : 1;
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, final int i) {
if (viewHolder instanceof PhotographyHolder) {
return;
}
final HPMedia hPMedia = this.a.get(i);
int mediaType = hPMedia.getMediaType();
final AlbumHolder albumHolder = (AlbumHolder) viewHolder;
if (mediaType == 0) {
albumHolder.b.setVisibility(8);
if ("UNITERMING_IMAGE".equals(this.d)) {
albumHolder.d.setVisibility(8);
} else {
albumHolder.d.setVisibility(0);
}
albumHolder.a.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumRecyclerViewAdapter.1
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (AlbumRecyclerViewAdapter.this.c != null) {
AlbumRecyclerViewAdapter.this.c.a(albumHolder.d, hPMedia, i);
}
}
});
a(hPMedia.getPreview(), albumHolder);
} else if (1 == mediaType) {
final HPVideo hPVideo = (HPVideo) hPMedia;
albumHolder.b.setVisibility(0);
albumHolder.c.setText(Utils.a(hPVideo.getDuration()));
albumHolder.d.setVisibility(hPVideo.getDuration() > 50499 ? 8 : 0);
albumHolder.e.setVisibility(hPVideo.getDuration() > 50499 ? 0 : 8);
albumHolder.e.setOnClickListener(new View.OnClickListener(this) { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumRecyclerViewAdapter.2
@Override // android.view.View.OnClickListener
public void onClick(View view) {
}
});
albumHolder.a.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumRecyclerViewAdapter.3
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (AlbumRecyclerViewAdapter.this.c != null) {
AlbumRecyclerViewAdapter.this.c.a(hPVideo, i);
}
}
});
a(hPVideo.getPath(), albumHolder);
}
albumHolder.d.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumRecyclerViewAdapter.4
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (AlbumRecyclerViewAdapter.this.c != null) {
AlbumOnClickListener albumOnClickListener = AlbumRecyclerViewAdapter.this.c;
CheckBox checkBox = albumHolder.d;
albumOnClickListener.a(checkBox, checkBox.isChecked(), hPMedia);
AlbumRecyclerViewAdapter.this.notifyItemChanged(i);
}
}
});
if (hPMedia.isSelected()) {
albumHolder.d.setChecked(true);
} else {
albumHolder.d.setChecked(false);
}
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
return i == 0 ? new PhotographyHolder(View.inflate(this.b, R.layout.item_album_photography, null)) : new AlbumHolder(this, View.inflate(this.b, R.layout.item_album_layout, null));
}
public void a(String str) {
this.d = str;
}
public void a(List<HPMedia> list) {
this.a = list;
notifyDataSetChanged();
}
private void a(String str, AlbumHolder albumHolder) {
if (TextUtils.isEmpty(str)) {
RequestBuilder<Drawable> a = Glide.e(JimuApplication.l()).a(Integer.valueOf(R.mipmap.load_failed));
a.a(new RequestOptions().b());
a.a(albumHolder.a);
} else {
RequestBuilder<Drawable> a2 = Glide.e(JimuApplication.l()).a(str);
a2.a(new RequestOptions().b().a(R.mipmap.load_failed));
a2.a(albumHolder.a);
}
}
public void a(AlbumOnClickListener albumOnClickListener) {
this.c = albumOnClickListener;
}
}

View File

@@ -0,0 +1,18 @@
package com.ubt.jimu.widgets.choosePhotos;
import android.os.Bundle;
import com.ubt.jimu.R;
import com.ubt.jimu.ScreenRotationManageActivity;
/* loaded from: classes2.dex */
public class BaseActivity extends ScreenRotationManageActivity {
@Override // com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
try {
getResources().getBoolean(R.bool.isTablet);
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -0,0 +1,53 @@
package com.ubt.jimu.widgets.choosePhotos;
import com.ubt.jimu.widgets.choosePhotos.media.HPMedia;
import java.util.Comparator;
/* loaded from: classes2.dex */
public class HPMediaComparator implements Comparator<HPMedia> {
@Override // java.util.Comparator
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public int compare(HPMedia hPMedia, HPMedia hPMedia2) {
String str;
if (hPMedia == null && hPMedia2 == null) {
return 0;
}
if (hPMedia == null) {
return 1;
}
if (hPMedia2 == null) {
return -1;
}
String str2 = null;
try {
str = hPMedia.getModifyDate();
} catch (Exception unused) {
str = null;
}
try {
str2 = hPMedia2.getModifyDate();
} catch (Exception unused2) {
}
if (str == null) {
return 1;
}
if (str2 == null) {
return -1;
}
if (str.equals(str2)) {
return 0;
}
if (!Utils.a(str) || !Utils.a(str2)) {
if (Utils.a(str) || Utils.a(str2)) {
return !Utils.a(str) ? 1 : -1;
}
return 0;
}
long parseLong = Long.parseLong(hPMedia.getModifyDate());
long parseLong2 = Long.parseLong(hPMedia2.getModifyDate());
if (parseLong == parseLong2) {
return 0;
}
return parseLong > parseLong2 ? -1 : 1;
}
}

View File

@@ -0,0 +1,190 @@
package com.ubt.jimu.widgets.choosePhotos;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import androidx.viewpager.widget.ViewPager;
import com.bottle.hp.album.photoview.HackyViewPager;
import com.ubt.jimu.R;
import com.ubt.jimu.base.SuperActivity;
import com.ubt.jimu.utils.SPUtils;
import com.ubt.jimu.utils.TSnackbarUtils;
import com.ubt.jimu.widgets.choosePhotos.media.HPMedia;
import com.ubt.jimu.widgets.player.UbtPlayerView;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
/* loaded from: classes2.dex */
public class PreviewActivity extends SuperActivity implements View.OnClickListener, ViewPager.OnPageChangeListener {
private ArrayList<HPMedia> a;
ArrayList<HPMedia> b;
private int c = 1;
CheckBox cbChoose;
private View d;
private PreviewAdapter e;
private String f;
private int g;
ImageView im_preview_back;
HackyViewPager mHackyViewPager;
@Override // com.ubt.jimu.base.SuperActivity
public void initData() {
Intent intent = getIntent();
this.b = (ArrayList) intent.getSerializableExtra("selected");
this.a = (ArrayList) SPUtils.c("data");
this.c = intent.getIntExtra("startIndex", 1);
this.g = intent.getIntExtra("selectedAmount", 10);
this.e = new PreviewAdapter(this, this.a, this.b);
this.e.a(this.a);
this.mHackyViewPager.setOffscreenPageLimit(0);
this.mHackyViewPager.setAdapter(this.e);
this.mHackyViewPager.setCurrentItem(this.c);
this.cbChoose.setChecked(this.a.get(this.c).isSelected());
}
@Override // com.ubt.jimu.base.SuperActivity
public void initEvent() {
this.im_preview_back.setOnClickListener(this);
this.mHackyViewPager.setOnPageChangeListener(this);
this.cbChoose.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { // from class: com.ubt.jimu.widgets.choosePhotos.PreviewActivity.1
@Override // android.widget.CompoundButton.OnCheckedChangeListener
public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
if (z && PreviewActivity.this.b.size() >= PreviewActivity.this.g) {
TSnackbarUtils.a(PreviewActivity.this.d, PreviewActivity.this.getString(R.string.choose_more_pictures));
PreviewActivity.this.cbChoose.setChecked(false);
return;
}
HPMedia hPMedia = (HPMedia) PreviewActivity.this.a.get(PreviewActivity.this.mHackyViewPager.getCurrentItem());
if (z) {
hPMedia.setSelected(true);
Iterator<HPMedia> it = PreviewActivity.this.b.iterator();
while (it.hasNext()) {
if (it.next().getId() == hPMedia.getId()) {
return;
}
}
PreviewActivity.this.b.add(hPMedia);
return;
}
int i = 0;
while (true) {
if (i >= PreviewActivity.this.b.size()) {
break;
}
if (hPMedia.getId() == PreviewActivity.this.b.get(i).getId()) {
PreviewActivity.this.b.remove(i);
break;
}
i++;
}
hPMedia.setSelected(false);
}
});
}
@Override // com.ubt.jimu.base.SuperActivity
public View initView() {
this.d = View.inflate(this, R.layout.activity_preview_layout, null);
return this.d;
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
int id = view.getId();
if (id == R.id.btnCompleted) {
Intent intent = new Intent();
SPUtils.a("ResultDate", this.a);
intent.putExtra("selected", this.b);
setResult(105, intent);
finish();
return;
}
if (id != R.id.im_preview_back) {
return;
}
Intent intent2 = new Intent();
SPUtils.a("ResultDate", this.a);
intent2.putExtra("selected", this.b);
setResult(101, intent2);
finish();
}
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
protected void onDestroy() {
super.onDestroy();
}
@Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
public void onPageScrollStateChanged(int i) {
}
@Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
public void onPageScrolled(int i, float f, int i2) {
Map<String, UbtPlayerView> a;
if (i == 0) {
this.mHackyViewPager.setCurrentItem(1);
}
if (this.mHackyViewPager == null || (a = this.e.a()) == null || a.size() == 0) {
return;
}
UbtPlayerView ubtPlayerView = a.get(i + "");
if (ubtPlayerView == null) {
return;
}
HPMedia hPMedia = this.a.get(i);
if (hPMedia.isVideo()) {
this.f = hPMedia.getPath();
ubtPlayerView.setVideoPath(this.f);
ubtPlayerView.f();
}
}
@Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
public void onPageSelected(int i) {
ArrayList<HPMedia> arrayList = this.a;
if (arrayList == null || arrayList.size() < i) {
return;
}
HPMedia hPMedia = this.a.get(i);
if (hPMedia.isSelected()) {
this.cbChoose.setChecked(true);
} else {
this.cbChoose.setChecked(false);
}
Map<String, UbtPlayerView> a = this.e.a();
if (a == null || a.size() == 0) {
return;
}
if (a.get(i + "") == null) {
return;
}
this.f = hPMedia.getPath();
}
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
protected void onPause() {
Map<String, UbtPlayerView> a;
super.onPause();
PreviewAdapter previewAdapter = this.e;
if (previewAdapter == null || (a = previewAdapter.a()) == null || a.size() <= 0) {
return;
}
Iterator<UbtPlayerView> it = a.values().iterator();
while (it.hasNext()) {
it.next().g();
}
}
public static void a(Activity activity, ArrayList<HPMedia> arrayList, ArrayList<HPMedia> arrayList2, int i, int i2) {
Intent intent = new Intent(activity, (Class<?>) PreviewActivity.class);
intent.putExtra("selected", arrayList2);
intent.putExtra("selectedAmount", i);
SPUtils.a("data", arrayList);
intent.putExtra("startIndex", i2);
activity.startActivityForResult(intent, 101);
}
}

View File

@@ -0,0 +1,32 @@
package com.ubt.jimu.widgets.choosePhotos;
import android.view.View;
import android.widget.CheckBox;
import android.widget.ImageView;
import butterknife.Unbinder;
import com.bottle.hp.album.photoview.HackyViewPager;
import com.ubt.jimu.R;
/* loaded from: classes2.dex */
public class PreviewActivity_ViewBinding implements Unbinder {
private PreviewActivity b;
public PreviewActivity_ViewBinding(PreviewActivity previewActivity, View view) {
this.b = previewActivity;
previewActivity.cbChoose = (CheckBox) butterknife.internal.Utils.b(view, R.id.cbChoose, "field 'cbChoose'", CheckBox.class);
previewActivity.mHackyViewPager = (HackyViewPager) butterknife.internal.Utils.b(view, R.id.hackyViewPager, "field 'mHackyViewPager'", HackyViewPager.class);
previewActivity.im_preview_back = (ImageView) butterknife.internal.Utils.b(view, R.id.im_preview_back, "field 'im_preview_back'", ImageView.class);
}
@Override // butterknife.Unbinder
public void unbind() {
PreviewActivity previewActivity = this.b;
if (previewActivity == null) {
throw new IllegalStateException("Bindings already cleared.");
}
this.b = null;
previewActivity.cbChoose = null;
previewActivity.mHackyViewPager = null;
previewActivity.im_preview_back = null;
}
}

View File

@@ -0,0 +1,85 @@
package com.ubt.jimu.widgets.choosePhotos;
import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.viewpager.widget.PagerAdapter;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestBuilder;
import com.bumptech.glide.request.RequestOptions;
import com.github.chrisbanes.photoview.PhotoView;
import com.ubt.jimu.R;
import com.ubt.jimu.widgets.choosePhotos.media.HPMedia;
import com.ubt.jimu.widgets.player.UbtPlayerView;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/* loaded from: classes2.dex */
public class PreviewAdapter extends PagerAdapter {
private Activity a;
private List<HPMedia> b;
private Map<String, UbtPlayerView> c = new HashMap();
public PreviewAdapter(Activity activity, List<HPMedia> list, List<HPMedia> list2) {
this.a = activity;
this.b = list;
}
public void a(List<HPMedia> list) {
this.b = list;
notifyDataSetChanged();
}
@Override // androidx.viewpager.widget.PagerAdapter
public void destroyItem(ViewGroup viewGroup, int i, Object obj) {
viewGroup.removeView((View) obj);
}
@Override // androidx.viewpager.widget.PagerAdapter
public int getCount() {
List<HPMedia> list = this.b;
if (list == null) {
return 0;
}
return list.size();
}
@Override // androidx.viewpager.widget.PagerAdapter
public boolean isViewFromObject(View view, Object obj) {
return view == obj;
}
@Override // androidx.viewpager.widget.PagerAdapter
public View instantiateItem(ViewGroup viewGroup, int i) {
View inflate = View.inflate(this.a, R.layout.adapter_preview_layout, null);
HPMedia hPMedia = this.b.get(i);
int mediaType = hPMedia.getMediaType();
PhotoView photoView = (PhotoView) inflate.findViewById(R.id.photoView);
ImageView imageView = (ImageView) inflate.findViewById(R.id.im_play_bnt);
inflate.findViewById(R.id.view_background).setVisibility(8);
UbtPlayerView ubtPlayerView = (UbtPlayerView) inflate.findViewById(R.id.sv_play);
if (mediaType == 0) {
RequestBuilder<Drawable> a = Glide.a(this.a).a(hPMedia.getPath());
a.a(new RequestOptions().b());
a.a((ImageView) photoView);
imageView.setVisibility(8);
ubtPlayerView.setVisibility(8);
} else if (mediaType == 1) {
ubtPlayerView.setVisibility(0);
Log.e("Test", "URL:" + hPMedia.getPath() + " position:" + i);
photoView.setVisibility(8);
imageView.setVisibility(8);
this.c.put(i + "", ubtPlayerView);
}
viewGroup.addView(inflate, -1, -1);
return inflate;
}
public Map<String, UbtPlayerView> a() {
return this.c;
}
}

View File

@@ -0,0 +1,27 @@
package com.ubt.jimu.widgets.choosePhotos;
import android.text.TextUtils;
import java.util.regex.Pattern;
/* loaded from: classes2.dex */
public class Utils {
public static String a(long j) {
long j2 = j / 1000;
long j3 = j2 % 60;
long j4 = (j2 / 60) % 60;
long j5 = j2 / 3600;
return j5 > 0 ? String.format("%d:%02d:%02d", Long.valueOf(j5), Long.valueOf(j4), Long.valueOf(j3)) : String.format("%02d:%02d", Long.valueOf(j4), Long.valueOf(j3));
}
public static boolean a(String str) {
if (TextUtils.isEmpty(str)) {
return false;
}
try {
return Pattern.compile("[0-9]{1,}").matcher(str).matches();
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
}

View File

@@ -0,0 +1,638 @@
package com.ubt.jimu.widgets.choosePhotos;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.hardware.Camera;
import android.net.Uri;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Environment;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.OrientationEventListener;
import android.view.View;
import android.view.WindowManager;
import com.bottle.hp.album.capture.VideoFile;
import com.bottle.hp.album.capture.VideoPreviewActivity;
import com.bottle.hp.album.capture.camera.CameraWrapper;
import com.bottle.hp.album.capture.camera.NativeCamera;
import com.bottle.hp.album.capture.configuration.CaptureConfiguration;
import com.bottle.hp.album.capture.configuration.PredefinedCaptureConfigurations$CaptureQuality;
import com.bottle.hp.album.capture.configuration.PredefinedCaptureConfigurations$CaptureResolution;
import com.bottle.hp.album.capture.preview.CapturePreviewInterface;
import com.bottle.hp.album.capture.recorder.AlreadyUsedException;
import com.bottle.hp.album.capture.recorder.VideoRecorder;
import com.bottle.hp.album.capture.recorder.VideoRecorderInterface;
import com.bottle.hp.album.capture.view.VideoCaptureView;
import com.ubt.jimu.R;
import com.ubt.jimu.widgets.choosePhotos.VideoCaptureActivity;
import com.ubt.jimu.widgets.player.UbtPlayer;
import com.ubtech.permission.JimuPermissionRequest;
import com.ubtrobot.log.ALog;
import com.yanzhenjie.permission.Permission$Group;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Timer;
import java.util.TimerTask;
/* loaded from: classes2.dex */
public class VideoCaptureActivity extends com.bottle.hp.album.BaseActivity implements Camera.PictureCallback, CapturePreviewInterface, VideoCaptureView.IVideoCaptureUIListener, VideoRecorderInterface, View.OnClickListener, Camera.PreviewCallback {
private static int y = 50000;
private VideoCaptureView d;
private CameraWrapper e;
private String g;
private Timer l;
private CaptureConfiguration p;
private VideoRecorder q;
private AlbumOrientationEventListener s;
private int t;
private TimeCounter u;
private final String c = VideoCaptureActivity.class.getSimpleName();
private int f = 5;
private boolean h = false;
private long i = 0;
private boolean j = false;
private long k = 0;
private Handler m = new Handler();
private boolean n = false;
private VideoFile o = null;
private int r = 0;
private int v = 100;
private boolean x = false;
private class AlbumOrientationEventListener extends OrientationEventListener {
public AlbumOrientationEventListener(Context context, int i) {
super(context, i);
}
@Override // android.view.OrientationEventListener
public void onOrientationChanged(int i) {
int i2;
if (i == -1 || (i2 = (((i + 45) / 90) * 90) % 360) == VideoCaptureActivity.this.t) {
return;
}
VideoCaptureActivity.this.t = i2;
ALog.a(VideoCaptureActivity.this.c).d("角度" + VideoCaptureActivity.this.t);
VideoCaptureActivity videoCaptureActivity = VideoCaptureActivity.this;
videoCaptureActivity.l(videoCaptureActivity.t);
}
}
/* JADX INFO: Access modifiers changed from: private */
class StartRecordTask extends TimerTask {
private StartRecordTask() {
}
public /* synthetic */ void a() {
VideoCaptureActivity.this.b(R.string.unsupport_recording, 2);
}
@Override // java.util.TimerTask, java.lang.Runnable
public void run() {
try {
VideoCaptureActivity.this.x = false;
VideoCaptureActivity.this.q.f();
VideoCaptureActivity.this.m.postDelayed(new Runnable() { // from class: com.ubt.jimu.widgets.choosePhotos.VideoCaptureActivity.StartRecordTask.1
@Override // java.lang.Runnable
public void run() {
if (VideoCaptureActivity.this.e.c() == null) {
VideoCaptureActivity.this.b(R.string.tips_ask_camera_permission, 2);
} else {
VideoCaptureActivity.this.d.d();
}
}
}, 10L);
} catch (AlreadyUsedException unused) {
ALog.a(VideoCaptureActivity.this.c).b("Cannot toggle recording after cleaning up all resources", new Object[0]);
} catch (UnsupportedOperationException e) {
e.printStackTrace();
ALog.a(VideoCaptureActivity.this.c).b(e.getMessage(), new Object[0]);
VideoCaptureActivity.this.m.post(new Runnable() { // from class: com.ubt.jimu.widgets.choosePhotos.a
@Override // java.lang.Runnable
public final void run() {
VideoCaptureActivity.StartRecordTask.this.a();
}
});
}
}
}
private class TimeCounter extends CountDownTimer {
private long a;
public TimeCounter(long j, long j2) {
super(j, j2);
this.a = 0L;
}
public long a() {
return this.a;
}
@Override // android.os.CountDownTimer
public void onFinish() {
VideoCaptureActivity.this.d.a(100);
}
@Override // android.os.CountDownTimer
public void onTick(long j) {
int i = (int) (VideoCaptureActivity.y - j);
this.a = i;
VideoCaptureActivity.this.d.a((i * 100) / VideoCaptureActivity.y);
}
}
private void G0() {
TimeCounter timeCounter = this.u;
if (timeCounter != null) {
timeCounter.cancel();
}
}
public static String H0() {
File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath() + File.separator + "Jimu");
if (!file.exists()) {
file.mkdirs();
}
return file.getAbsolutePath();
}
private File I0() {
this.g = H0() + File.separator + com.bottle.hp.album.Utils.a() + ".png";
return new File(this.g);
}
/* JADX INFO: Access modifiers changed from: private */
public void J0() {
try {
if (this.q != null) {
this.d.getPreviewSurfaceHolder().removeCallback(this.q.b());
this.q.d();
}
this.e = new CameraWrapper(new NativeCamera(), ((WindowManager) getSystemService("window")).getDefaultDisplay().getRotation(), this.r, this);
this.o = a((Bundle) null);
this.q = new VideoRecorder(this, this.p, this.o, this.e, this.d.getPreviewSurfaceHolder());
} catch (Exception e) {
e.printStackTrace();
Log.e(this.c, e.getMessage());
}
}
private void K0() {
if (System.currentTimeMillis() - this.k < 1000) {
return;
}
if (this.e.c() != null) {
try {
this.e.a((Camera.ShutterCallback) null, (Camera.PictureCallback) null, this);
} catch (RuntimeException e) {
e.printStackTrace();
Log.e(this.c, "拍照失败:" + e.getMessage());
b(R.string.tips_ask_camera_permission, 2);
}
} else {
Log.e(this.c, "camera 对象为空");
b(R.string.tips_ask_camera_permission, 2);
}
this.k = System.currentTimeMillis();
}
private boolean L0() {
TimeCounter timeCounter = this.u;
if (timeCounter == null || timeCounter.a() >= 1500) {
return false;
}
K0();
VideoFile videoFile = this.o;
if (videoFile != null && videoFile.a().exists()) {
this.o.a().delete();
sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE", Uri.fromFile(this.o.a())));
}
return true;
}
private void initView() {
this.d = (VideoCaptureView) findViewById(R.id.videoCaptureView);
this.d.setUIListener(this);
}
@Override // com.bottle.hp.album.capture.view.VideoCaptureView.IVideoCaptureUIListener
public void B0() {
if (this.r == 0) {
this.r = 1;
} else {
this.r = 0;
}
J0();
}
protected CaptureConfiguration E0() {
CaptureConfiguration captureConfiguration = (CaptureConfiguration) getIntent().getParcelableExtra("com.bottle.extracaptureconfiguration");
if (captureConfiguration != null) {
return captureConfiguration;
}
CaptureConfiguration captureConfiguration2 = new CaptureConfiguration();
ALog.a(this.c).d("No captureconfiguration passed - using default configuration");
return captureConfiguration2;
}
@Override // com.bottle.hp.album.capture.recorder.VideoRecorderInterface
public void f0() {
if (!this.j) {
this.m.post(new Runnable() { // from class: com.ubt.jimu.widgets.choosePhotos.VideoCaptureActivity.3
@Override // java.lang.Runnable
public void run() {
VideoCaptureActivity.this.q.a("user cancel");
}
});
return;
}
this.g = null;
ALog.a(this.c).d("开始录制");
this.m.postDelayed(new Runnable() { // from class: com.ubt.jimu.widgets.choosePhotos.VideoCaptureActivity.4
@Override // java.lang.Runnable
public void run() {
VideoCaptureActivity videoCaptureActivity = VideoCaptureActivity.this;
videoCaptureActivity.u = videoCaptureActivity.new TimeCounter(VideoCaptureActivity.y, VideoCaptureActivity.this.v);
VideoCaptureActivity.this.u.start();
}
}, 300L);
}
@Override // com.bottle.hp.album.capture.view.VideoCaptureView.IVideoCaptureUIListener
public void h0() {
this.j = true;
if (this.f == 1) {
return;
}
this.i = System.currentTimeMillis();
this.l = new Timer();
this.l.schedule(new StartRecordTask(), 300L);
}
@Override // com.bottle.hp.album.capture.recorder.VideoRecorderInterface
public boolean j0() {
return JimuPermissionRequest.b(this, Permission$Group.c);
}
@Override // com.bottle.hp.album.capture.recorder.VideoRecorderInterface
public void l(String str) {
ALog.a(this.c).d("停止录制");
G0();
if (this.x) {
this.g = "";
} else {
if (L0()) {
return;
}
onCancel();
}
}
@Override // com.bottle.hp.album.capture.recorder.VideoRecorderInterface
public void m(String str) {
ALog.a(this.c).d("录制失败");
G0();
setResult(0);
finish();
}
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
public void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
if (101 == i) {
if (i2 == -1) {
x0();
} else {
onCancel();
}
}
}
@Override // com.bottle.hp.album.capture.view.VideoCaptureView.IVideoCaptureUIListener
public void onCancel() {
VideoFile videoFile = this.o;
if (videoFile != null && videoFile.a().exists()) {
this.o.a().delete();
sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE", Uri.fromFile(this.o.a())));
}
if (!TextUtils.isEmpty(this.g)) {
File file = new File(this.g);
if (file.exists()) {
file.delete();
sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE", Uri.fromFile(file)));
}
}
this.m.postDelayed(new Runnable() { // from class: com.ubt.jimu.widgets.choosePhotos.VideoCaptureActivity.1
@Override // java.lang.Runnable
public void run() {
VideoCaptureActivity.this.J0();
}
}, 10L);
this.m.postDelayed(new Runnable() { // from class: com.ubt.jimu.widgets.choosePhotos.VideoCaptureActivity.2
@Override // java.lang.Runnable
public void run() {
VideoCaptureActivity.this.d.b();
}
}, 500L);
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
}
@Override // com.bottle.hp.album.BaseActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_video_capture);
c(bundle);
initView();
this.s = new AlbumOrientationEventListener(this, 3);
if (this.s.canDetectOrientation()) {
this.s.enable();
} else {
Log.e(this.c, "Can't Detect Orientation");
}
this.f = getIntent().getIntExtra("recordType", 5);
int i = this.f;
if (i == 1) {
this.d.c();
} else if (i == 2) {
this.d.e();
} else {
this.d.a();
}
}
@Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
protected void onDestroy() {
this.m.removeCallbacksAndMessages(null);
this.m = null;
VideoRecorder videoRecorder = this.q;
if (videoRecorder != null) {
videoRecorder.d();
}
this.s.disable();
super.onDestroy();
}
@Override // androidx.appcompat.app.AppCompatActivity, android.app.Activity, android.view.KeyEvent.Callback
public boolean onKeyDown(int i, KeyEvent keyEvent) {
if (this.j) {
return true;
}
if (i != 4) {
return super.onKeyDown(i, keyEvent);
}
setResult(0);
finish();
return true;
}
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
public void onPause() {
super.onPause();
}
@Override // android.hardware.Camera.PictureCallback
public void onPictureTaken(byte[] bArr, Camera camera) {
a(bArr);
}
@Override // android.hardware.Camera.PreviewCallback
public void onPreviewFrame(byte[] bArr, Camera camera) {
if (bArr == null || bArr.length == 0) {
}
}
@Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
public void onSaveInstanceState(Bundle bundle) {
bundle.putBoolean("com.bottle.savedrecordedboolean", this.n);
bundle.putString("com.bottle.savedoutputfilename", this.o.b());
super.onSaveInstanceState(bundle);
}
@Override // android.app.Activity, android.view.Window.Callback
public void onWindowFocusChanged(boolean z) {
super.onWindowFocusChanged(z);
if (this.h) {
return;
}
this.h = true;
J0();
}
@Override // com.bottle.hp.album.capture.view.VideoCaptureView.IVideoCaptureUIListener
public void r0() {
this.j = false;
if (this.f == 1) {
K0();
return;
}
this.l.cancel();
if (System.currentTimeMillis() - this.i >= 300) {
this.q.a("stop recoding");
} else if (this.f == 5) {
K0();
}
}
@Override // com.bottle.hp.album.capture.view.VideoCaptureView.IVideoCaptureUIListener
public void t0() {
VideoPreviewActivity.a(this, 1001, this.o.b());
}
@Override // com.bottle.hp.album.capture.recorder.VideoRecorderInterface
public void u0() {
sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE", Uri.fromFile(this.o.a())));
this.x = true;
if (this.u.a() < 1500) {
this.x = false;
} else {
this.m.post(new Runnable() { // from class: com.ubt.jimu.widgets.choosePhotos.VideoCaptureActivity.5
@Override // java.lang.Runnable
public void run() {
VideoCaptureActivity videoCaptureActivity = VideoCaptureActivity.this;
UbtPlayer.a(videoCaptureActivity, 101, null, videoCaptureActivity.o.b(), true);
try {
VideoCaptureActivity.this.e.j();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
@Override // com.bottle.hp.album.capture.view.VideoCaptureView.IVideoCaptureUIListener
public void x0() {
Intent intent = new Intent();
if (TextUtils.isEmpty(this.g)) {
intent.putExtra("data", this.o.b());
intent.putExtra("data_type", 1);
} else {
intent.putExtra("data", this.g);
intent.putExtra("data_type", 0);
}
setResult(-1, intent);
finish();
}
@Override // com.bottle.hp.album.capture.view.VideoCaptureView.IVideoCaptureUIListener
public void y0() {
if (this.j) {
return;
}
setResult(0);
finish();
}
public static CaptureConfiguration c(int i, int i2) {
PredefinedCaptureConfigurations$CaptureResolution predefinedCaptureConfigurations$CaptureResolution = PredefinedCaptureConfigurations$CaptureResolution.RES_720P;
PredefinedCaptureConfigurations$CaptureQuality predefinedCaptureConfigurations$CaptureQuality = PredefinedCaptureConfigurations$CaptureQuality.LOW;
if (i2 != 1) {
if (i2 == 2) {
predefinedCaptureConfigurations$CaptureQuality = PredefinedCaptureConfigurations$CaptureQuality.MEDIUM;
} else if (i2 == 3) {
predefinedCaptureConfigurations$CaptureQuality = PredefinedCaptureConfigurations$CaptureQuality.HIGH;
}
}
return new CaptureConfiguration(predefinedCaptureConfigurations$CaptureResolution, predefinedCaptureConfigurations$CaptureQuality, i, -1);
}
@Override // com.bottle.hp.album.capture.preview.CapturePreviewInterface
public void i() {
finish();
}
private boolean b(Bundle bundle) {
if (bundle == null) {
return false;
}
return bundle.getBoolean("com.bottle.savedrecordedboolean", false);
}
public static void a(Activity activity, int i, int i2) {
Intent intent = new Intent(activity, (Class<?>) VideoCaptureActivity.class);
intent.putExtra("com.bottle.extracaptureconfiguration", c(y / 1000, 1));
intent.putExtra("com.bottle.extraoutputfilename", H0());
intent.putExtra("recordType", i2);
activity.startActivityForResult(intent, i);
}
private void c(Bundle bundle) {
this.p = E0();
this.n = b(bundle);
this.o = a(bundle);
}
/* JADX INFO: Access modifiers changed from: private */
public void l(int i) {
int i2;
CameraWrapper cameraWrapper = this.e;
if (cameraWrapper == null || cameraWrapper.c() == null) {
return;
}
try {
Camera.Parameters parameters = this.e.c().getParameters();
Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
Camera.getCameraInfo(this.r, cameraInfo);
int i3 = ((i + 45) / 90) * 90;
if (cameraInfo.facing == 1) {
i2 = ((cameraInfo.orientation - i3) + 360) % 360;
} else {
i2 = (cameraInfo.orientation + i3) % 360;
}
parameters.setRotation(i2);
this.e.c().setParameters(parameters);
} catch (RuntimeException e) {
e.printStackTrace();
Log.e(this.c, e.getMessage());
}
}
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:45:0x002e -> B:9:0x0079). Please report as a decompilation issue!!! */
private void a(byte[] bArr) {
FileOutputStream fileOutputStream = null;
try {
} catch (Exception e) {
e.printStackTrace();
}
try {
try {
File I0 = I0();
FileOutputStream fileOutputStream2 = new FileOutputStream(I0);
try {
fileOutputStream2.write(bArr);
a(I0);
fileOutputStream2.close();
} catch (FileNotFoundException e2) {
e = e2;
fileOutputStream = fileOutputStream2;
e.printStackTrace();
Log.e(this.c, "File not found: " + e.getMessage());
if (fileOutputStream != null) {
fileOutputStream.close();
}
} catch (IOException e3) {
e = e3;
fileOutputStream = fileOutputStream2;
e.printStackTrace();
Log.e(this.c, "Error accessing file: " + e.getMessage());
if (fileOutputStream != null) {
fileOutputStream.close();
}
} catch (Exception e4) {
e = e4;
fileOutputStream = fileOutputStream2;
e.printStackTrace();
if (fileOutputStream != null) {
fileOutputStream.close();
}
} catch (Throwable th) {
th = th;
fileOutputStream = fileOutputStream2;
if (fileOutputStream != null) {
try {
fileOutputStream.close();
} catch (Exception e5) {
e5.printStackTrace();
}
}
throw th;
}
} catch (FileNotFoundException e6) {
e = e6;
} catch (IOException e7) {
e = e7;
} catch (Exception e8) {
e = e8;
}
} catch (Throwable th2) {
th = th2;
}
}
private void a(File file) {
try {
sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE", Uri.fromFile(file)));
this.e.j();
this.d.a(file.getAbsolutePath(), 0);
} catch (Exception e) {
e.printStackTrace();
Log.e(this.c, e.getMessage());
}
}
protected VideoFile a(Bundle bundle) {
if (bundle != null) {
return new VideoFile(bundle.getString("com.bottle.savedoutputfilename"));
}
return new VideoFile(VideoFile.a(getIntent().getStringExtra("com.bottle.extraoutputfilename")));
}
}

View File

@@ -0,0 +1,93 @@
package com.ubt.jimu.widgets.choosePhotos.media;
import android.content.Context;
import android.database.Cursor;
import android.provider.MediaStore;
import com.liulishuo.filedownloader.model.FileDownloadModel;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes2.dex */
public class HPAudio extends HPMedia implements Serializable {
private String album;
private String artist;
private long duration;
public HPAudio() {
this.mediaType = 2;
}
public static List<HPAudio> getAudios(Context context) {
ArrayList arrayList = new ArrayList();
if (context == null) {
return arrayList;
}
Cursor query = context.getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, new String[]{FileDownloadModel.ID, "title", "_data", "_display_name", "mime_type", "_size", "album", "artist", "duration", "date_modified"}, null, null, "date_modified DESC");
if (query != null) {
int columnIndex = query.getColumnIndex(FileDownloadModel.ID);
int columnIndex2 = query.getColumnIndex("title");
int columnIndex3 = query.getColumnIndex("_data");
int columnIndex4 = query.getColumnIndex("_display_name");
int columnIndex5 = query.getColumnIndex("mime_type");
int columnIndex6 = query.getColumnIndex("_size");
int columnIndex7 = query.getColumnIndex("album");
int columnIndex8 = query.getColumnIndex("artist");
int columnIndex9 = query.getColumnIndex("duration");
int columnIndex10 = query.getColumnIndex("date_modified");
while (query.moveToNext()) {
int i = query.getInt(columnIndex);
String string = query.getString(columnIndex2);
String string2 = query.getString(columnIndex3);
String string3 = query.getString(columnIndex4);
String string4 = query.getString(columnIndex5);
long j = query.getLong(columnIndex6);
String string5 = query.getString(columnIndex7);
String string6 = query.getString(columnIndex8);
int i2 = columnIndex;
long j2 = query.getInt(columnIndex9);
int i3 = columnIndex3;
HPAudio hPAudio = new HPAudio(i, string, string2, string3, string4, j, "", query.getString(columnIndex10));
hPAudio.setAlbum(string5);
hPAudio.setArtist(string6);
hPAudio.setDuration(j2);
arrayList.add(hPAudio);
columnIndex = i2;
columnIndex2 = columnIndex2;
columnIndex3 = i3;
columnIndex4 = columnIndex4;
}
query.close();
}
return arrayList;
}
public String getAlbum() {
return this.album;
}
public String getArtist() {
return this.artist;
}
public long getDuration() {
return this.duration;
}
public void setAlbum(String str) {
this.album = str;
}
public void setArtist(String str) {
this.artist = str;
}
public void setDuration(long j) {
this.duration = j;
}
public HPAudio(int i, String str, String str2, String str3, String str4, long j, String str5, String str6) {
super(i, str, str2, str3, str4, j, str5, str6);
this.mediaType = 2;
}
}

View File

@@ -0,0 +1,70 @@
package com.ubt.jimu.widgets.choosePhotos.media;
import android.content.Context;
import android.database.Cursor;
import android.provider.MediaStore;
import com.liulishuo.filedownloader.model.FileDownloadModel;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes2.dex */
public class HPImage extends HPMedia implements Serializable {
private static final String TAG = HPMedia.class.getSimpleName();
private static String[] thumbColumns = {FileDownloadModel.ID, "image_id", "_data"};
private static String[] projection = {FileDownloadModel.ID, "title", "_data", "_display_name", "mime_type", "_size", "date_modified"};
public HPImage() {
this.mediaType = 0;
}
public static List<HPMedia> getImages(Context context) {
Cursor query;
ArrayList arrayList = new ArrayList();
if (context != null && (query = context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, null, null, "date_modified DESC")) != null) {
int columnIndex = query.getColumnIndex(FileDownloadModel.ID);
int columnIndex2 = query.getColumnIndex("title");
int columnIndex3 = query.getColumnIndex("_data");
int columnIndex4 = query.getColumnIndex("_display_name");
int columnIndex5 = query.getColumnIndex("mime_type");
int columnIndex6 = query.getColumnIndex("_size");
int columnIndex7 = query.getColumnIndex("date_modified");
while (query.moveToNext()) {
int i = query.getInt(columnIndex);
String string = query.getString(columnIndex2);
String string2 = query.getString(columnIndex3);
arrayList.add(new HPImage(i, string, query.getString(columnIndex4), query.getString(columnIndex5), string2, query.getLong(columnIndex6), string2, query.getString(columnIndex7)));
}
query.close();
}
return arrayList;
}
public static HPMedia searchImageByName(Context context, String str) {
Cursor query = context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, "_data=?", new String[]{str + ""}, null);
HPImage hPImage = null;
if (query == null) {
return null;
}
int columnIndex = query.getColumnIndex(FileDownloadModel.ID);
int columnIndex2 = query.getColumnIndex("title");
int columnIndex3 = query.getColumnIndex("_data");
int columnIndex4 = query.getColumnIndex("_display_name");
int columnIndex5 = query.getColumnIndex("mime_type");
int columnIndex6 = query.getColumnIndex("_size");
int columnIndex7 = query.getColumnIndex("date_modified");
if (query.moveToNext()) {
int i = query.getInt(columnIndex);
String string = query.getString(columnIndex2);
String string2 = query.getString(columnIndex3);
hPImage = new HPImage(i, string, query.getString(columnIndex4), query.getString(columnIndex5), string2, query.getLong(columnIndex6), string2, query.getString(columnIndex7));
}
query.close();
return hPImage;
}
public HPImage(int i, String str, String str2, String str3, String str4, long j, String str5, String str6) {
super(i, str, str2, str3, str4, j, str5, str6);
this.mediaType = 0;
}
}

View File

@@ -0,0 +1,136 @@
package com.ubt.jimu.widgets.choosePhotos.media;
import java.io.Serializable;
/* loaded from: classes2.dex */
public class HPMedia implements Serializable {
public static final int MEDIA_TYPE_AUDIO = 2;
public static final int MEDIA_TYPE_IMAGE = 0;
public static final int MEDIA_TYPE_NONE = -1;
public static final int MEDIA_TYPE_VIDEO = 1;
protected String compressPath;
protected String displayName;
protected int id;
protected int mediaType;
protected String mimeType;
protected String modifyDate;
protected String path;
protected String preview;
protected boolean selected;
protected long size;
protected String title;
public HPMedia() {
}
public String getCompressPath() {
return this.compressPath;
}
public String getDisplayName() {
return this.displayName;
}
public int getId() {
return this.id;
}
public int getMediaType() {
return this.mediaType;
}
public String getMimeType() {
return this.mimeType;
}
public String getModifyDate() {
return this.modifyDate;
}
public String getPath() {
return this.path;
}
public String getPreview() {
return this.preview;
}
public long getSize() {
return this.size;
}
public String getTitle() {
return this.title;
}
public boolean isSelected() {
return this.selected;
}
public boolean isVideo() {
return this.mediaType == 1;
}
public void setCompressPath(String str) {
this.compressPath = str;
}
public void setDisplayName(String str) {
this.displayName = str;
}
public void setId(int i) {
this.id = i;
}
public void setMediaType(int i) {
this.mediaType = i;
}
public void setMimeType(String str) {
this.mimeType = str;
}
public void setModifyDate(String str) {
this.modifyDate = str;
}
public void setPath(String str) {
this.path = str;
}
public void setPreview(String str) {
this.preview = str;
}
public void setSelected(boolean z) {
this.selected = z;
}
public void setSize(long j) {
this.size = j;
}
public void setTitle(String str) {
this.title = str;
}
public String toString() {
return "HPMedia{id=" + this.id + ", title='" + this.title + "', displayName='" + this.displayName + "', mimeType='" + this.mimeType + "', path='" + this.path + "', size=" + this.size + ", modifyDate='" + this.modifyDate + "', preview='" + this.preview + "', selected=" + this.selected + ", mediaType=" + this.mediaType + '}';
}
public HPMedia(int i) {
this.id = i;
}
public HPMedia(int i, String str, String str2, String str3, String str4, long j, String str5, String str6) {
this.id = i;
this.title = str;
this.displayName = str2;
this.mimeType = str3;
this.path = str4;
this.size = j;
this.preview = str5;
this.modifyDate = str6;
}
}

View File

@@ -0,0 +1,239 @@
package com.ubt.jimu.widgets.choosePhotos.media;
import android.content.Context;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.media.MediaMetadataRetriever;
import android.media.ThumbnailUtils;
import android.provider.MediaStore;
import android.text.TextUtils;
import com.liulishuo.filedownloader.model.FileDownloadModel;
import com.ubtech.utils.BitmapFile;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes2.dex */
public class HPVideo extends HPMedia implements Serializable {
private static String[] projection = {FileDownloadModel.ID, "title", "_data", "_display_name", "mime_type", "_size", "album", "artist", "duration", "date_modified"};
private static String[] thumbColumns = {FileDownloadModel.ID, "video_id", "_data"};
private String album;
private String artist;
private long duration;
public HPVideo() {
super(0, "title", "displayName", "mimeType", "", 0L, "", "");
this.mediaType = 1;
}
private static void createThumbnail(HPMedia hPMedia) {
String path = hPMedia.getPath();
Bitmap createVideoThumbnail = ThumbnailUtils.createVideoThumbnail(path, 3);
if (createVideoThumbnail != null) {
String str = path.substring(0, path.lastIndexOf(".")) + ".jpg";
try {
BitmapFile.a(createVideoThumbnail, str);
hPMedia.setPreview(str);
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static long getVideoDuration(String str) {
try {
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
mediaMetadataRetriever.setDataSource(str);
return Long.parseLong(mediaMetadataRetriever.extractMetadata(9));
} catch (IllegalArgumentException e) {
e.printStackTrace();
return 0L;
}
}
public static HPMedia getVideoThumnail(Context context, HPMedia hPMedia) {
Cursor query = context.getContentResolver().query(MediaStore.Video.Thumbnails.EXTERNAL_CONTENT_URI, thumbColumns, "video_id=?", new String[]{hPMedia.getId() + ""}, null);
if (query == null || !query.moveToFirst()) {
createThumbnail(hPMedia);
} else {
String string = query.getString(query.getColumnIndex("_data"));
if (TextUtils.isEmpty(string)) {
createThumbnail(hPMedia);
} else if (new File(string).exists()) {
hPMedia.setPreview(string);
} else {
createThumbnail(hPMedia);
}
}
if (query != null) {
query.close();
}
return hPMedia;
}
public static List<HPMedia> getVideos(Context context) {
Cursor query;
ArrayList arrayList = new ArrayList();
if (context == null || (query = context.getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, projection, null, null, "date_modified DESC")) == null) {
return arrayList;
}
int columnIndex = query.getColumnIndex(FileDownloadModel.ID);
int columnIndex2 = query.getColumnIndex("title");
int columnIndex3 = query.getColumnIndex("_data");
int columnIndex4 = query.getColumnIndex("_display_name");
int columnIndex5 = query.getColumnIndex("mime_type");
int columnIndex6 = query.getColumnIndex("_size");
int columnIndex7 = query.getColumnIndex("album");
int columnIndex8 = query.getColumnIndex("artist");
int columnIndex9 = query.getColumnIndex("duration");
int columnIndex10 = query.getColumnIndex("date_modified");
if (query.moveToFirst()) {
while (true) {
int i = query.getInt(columnIndex);
String string = query.getString(columnIndex2);
String string2 = query.getString(columnIndex3);
String string3 = query.getString(columnIndex4);
String string4 = query.getString(columnIndex5);
long j = query.getLong(columnIndex6);
String string5 = query.getString(columnIndex7);
String string6 = query.getString(columnIndex8);
int i2 = columnIndex;
int i3 = columnIndex2;
long j2 = query.getInt(columnIndex9);
int i4 = columnIndex3;
int i5 = columnIndex4;
HPVideo hPVideo = new HPVideo(i, string, string3, string4, string2, j, "", query.getString(columnIndex10));
hPVideo.setAlbum(string5);
hPVideo.setArtist(string6);
hPVideo.setDuration(j2);
arrayList.add(hPVideo);
if (!query.moveToNext()) {
break;
}
columnIndex = i2;
columnIndex2 = i3;
columnIndex3 = i4;
columnIndex4 = i5;
}
}
query.close();
return arrayList;
}
public static HPVideo searchVideoByName(Context context, String str) {
Cursor query = context.getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, projection, "_data=?", new String[]{str + ""}, null);
HPVideo hPVideo = null;
if (query == null) {
return null;
}
int columnIndex = query.getColumnIndex(FileDownloadModel.ID);
int columnIndex2 = query.getColumnIndex("title");
int columnIndex3 = query.getColumnIndex("_data");
int columnIndex4 = query.getColumnIndex("_display_name");
int columnIndex5 = query.getColumnIndex("mime_type");
int columnIndex6 = query.getColumnIndex("_size");
int columnIndex7 = query.getColumnIndex("album");
int columnIndex8 = query.getColumnIndex("artist");
int columnIndex9 = query.getColumnIndex("duration");
int columnIndex10 = query.getColumnIndex("date_modified");
if (query.moveToFirst()) {
int i = query.getInt(columnIndex);
String string = query.getString(columnIndex2);
String string2 = query.getString(columnIndex3);
String string3 = query.getString(columnIndex4);
String string4 = query.getString(columnIndex5);
long j = query.getLong(columnIndex6);
String string5 = query.getString(columnIndex7);
String string6 = query.getString(columnIndex8);
long j2 = query.getInt(columnIndex9);
HPVideo hPVideo2 = new HPVideo(i, string, string3, string4, string2, j, "", query.getString(columnIndex10));
hPVideo2.setAlbum(string5);
hPVideo2.setArtist(string6);
hPVideo2.setDuration(j2);
hPVideo = hPVideo2;
}
query.close();
return hPVideo;
}
public String getAlbum() {
return this.album;
}
public String getArtist() {
return this.artist;
}
public long getDuration() {
return this.duration;
}
/* JADX WARN: Code restructure failed: missing block: B:13:0x001f, code lost:
if (r1 == null) goto L15;
*/
/* JADX WARN: Removed duplicated region for block: B:17:0x0026 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public android.graphics.Bitmap getFirstFrame() {
/*
r4 = this;
r0 = 0
android.media.MediaMetadataRetriever r1 = new android.media.MediaMetadataRetriever // Catch: java.lang.Throwable -> L15 java.lang.Exception -> L1a
r1.<init>() // Catch: java.lang.Throwable -> L15 java.lang.Exception -> L1a
java.lang.String r2 = r4.path // Catch: java.lang.Exception -> L13 java.lang.Throwable -> L23
r1.setDataSource(r2) // Catch: java.lang.Exception -> L13 java.lang.Throwable -> L23
android.graphics.Bitmap r0 = r1.getFrameAtTime() // Catch: java.lang.Exception -> L13 java.lang.Throwable -> L23
Lf:
r1.release()
goto L22
L13:
r2 = move-exception
goto L1c
L15:
r1 = move-exception
r3 = r1
r1 = r0
r0 = r3
goto L24
L1a:
r2 = move-exception
r1 = r0
L1c:
r2.printStackTrace() // Catch: java.lang.Throwable -> L23
if (r1 == 0) goto L22
goto Lf
L22:
return r0
L23:
r0 = move-exception
L24:
if (r1 == 0) goto L29
r1.release()
L29:
throw r0
*/
throw new UnsupportedOperationException("Method not decompiled: com.ubt.jimu.widgets.choosePhotos.media.HPVideo.getFirstFrame():android.graphics.Bitmap");
}
public void setAlbum(String str) {
this.album = str;
}
public void setArtist(String str) {
this.artist = str;
}
public void setDuration(long j) {
this.duration = j;
}
public HPVideo(int i, String str, String str2, String str3, String str4, long j, String str5, String str6) {
super(i, str, str2, str3, str4, j, str5, str6);
this.mediaType = 1;
}
}

View File

@@ -0,0 +1,26 @@
package com.ubt.jimu.widgets.error;
import com.baidu.cloud.media.player.IMediaPlayer;
import com.ubt.jimu.R;
import com.ubtech.view.widget.ErrorView;
/* loaded from: classes2.dex */
public class ErrorAgent implements ErrorView.ResAgent {
@Override // com.ubtech.view.widget.ErrorView.ResAgent
public ErrorView.ResData[] a() {
ErrorView.ResData[] b = b();
ErrorView.ResData[] c = c();
ErrorView.ResData[] resDataArr = new ErrorView.ResData[b.length + c.length];
System.arraycopy(b, 0, resDataArr, 0, b.length);
System.arraycopy(c, 0, resDataArr, b.length, c.length);
return resDataArr;
}
public ErrorView.ResData[] b() {
return new ErrorView.ResData[]{new ErrorView.ResData(10001, R.drawable.ic_network_error, R.string.video_network_error), new ErrorView.ResData(10002, R.drawable.ic_try_reload, R.string.loading_service_error), new ErrorView.ResData(IMediaPlayer.MEDIA_INFO_FRAMECHASING_START, R.drawable.icon_no_login, R.string.login_tip_text), new ErrorView.ResData(IMediaPlayer.MEDIA_INFO_FRAMECHASING_END, R.drawable.icon_favourate_empty, R.string.search_no_content)};
}
public ErrorView.ResData[] c() {
return new ErrorView.ResData[0];
}
}

View File

@@ -0,0 +1,25 @@
package com.ubt.jimu.widgets.error;
import android.content.Context;
import android.util.AttributeSet;
import com.ubtech.view.widget.ErrorView;
/* loaded from: classes2.dex */
public class UErrorView extends ErrorView {
public UErrorView(Context context) {
this(context, null);
}
public UErrorView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public UErrorView(Context context, AttributeSet attributeSet, int i) {
this(context, attributeSet, i, 0);
}
public UErrorView(Context context, AttributeSet attributeSet, int i, int i2) {
super(context, attributeSet, i, i2);
a(new ErrorAgent());
}
}

View File

@@ -0,0 +1,5 @@
package com.ubt.jimu.widgets.player;
/* loaded from: classes2.dex */
public interface FullScreenSwitchoverListener {
}

View File

@@ -0,0 +1,184 @@
package com.ubt.jimu.widgets.player;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewStub;
import android.widget.ImageView;
import android.widget.TextView;
import com.ubt.jimu.R;
import com.ubt.jimu.ScreenRotationManageActivity;
import com.ubt.jimu.base.entities.Constant;
import com.ubt.jimu.utils.BitmapUtils;
import com.ubt.jimu.utils.LogUtils;
import com.ubt.jimu.widgets.player.UbtPlayerView;
/* loaded from: classes2.dex */
public class UbtPlayer extends ScreenRotationManageActivity implements UbtPlayerView.VideoErrorListener, View.OnClickListener {
private UbtPlayerView a;
private View b;
private ViewStub c;
private View d;
private ImageView e;
private ImageView f;
private boolean g;
private String h = "";
private void initData() {
Intent intent = getIntent();
this.h = intent.getStringExtra(Constant.Publish.VIDEO_PATH_KEY);
String stringExtra = intent.getStringExtra(Constant.Publish.VIDEO_TITLE_KEY);
this.g = intent.getBooleanExtra(Constant.Publish.IS_SHOW_CONFIRM_KEY, false);
this.f.setVisibility(this.g ? 0 : 8);
if (!TextUtils.isEmpty(stringExtra)) {
this.a.setTitle(stringExtra);
}
LogUtils.c("视频播放路径:" + this.h);
if (TextUtils.isEmpty(this.h)) {
return;
}
this.a.setVideoPath(this.h);
this.a.f();
LogUtils.c("设置视频路径:" + this.h);
}
private void initView() {
this.a = (UbtPlayerView) findViewById(R.id.ubt_player);
this.c = (ViewStub) findViewById(R.id.vs_load_failure);
this.e = (ImageView) findViewById(R.id.im_back);
this.f = (ImageView) findViewById(R.id.im_publish_confirm);
this.a.setVideoErrorListener(this);
this.e.setOnClickListener(this);
this.f.setOnClickListener(this);
}
@Override // com.ubt.jimu.widgets.player.UbtPlayerView.VideoErrorListener
public void j(final int i) {
LogUtils.c("视频播放失败errorCode:" + i);
this.a.post(new Runnable() { // from class: com.ubt.jimu.widgets.player.UbtPlayer.1
@Override // java.lang.Runnable
public void run() {
UbtPlayer ubtPlayer = UbtPlayer.this;
Bitmap a = BitmapUtils.a(ubtPlayer, ubtPlayer.b);
if (UbtPlayer.this.d == null) {
UbtPlayer ubtPlayer2 = UbtPlayer.this;
ubtPlayer2.d = ubtPlayer2.c.inflate();
UbtPlayer.this.d.setOnClickListener(UbtPlayer.this);
} else {
UbtPlayer.this.d.setVisibility(0);
}
ImageView imageView = (ImageView) UbtPlayer.this.d.findViewById(R.id.im_error_icon);
TextView textView = (TextView) UbtPlayer.this.d.findViewById(R.id.tv_load_failed_hint);
imageView.setOnClickListener(UbtPlayer.this);
if (a != null) {
new BitmapDrawable(a);
UbtPlayer.this.d.setBackgroundColor(UbtPlayer.this.getResources().getColor(R.color.video_error_shade));
}
int i2 = i;
if (i2 == -10000) {
imageView.setBackgroundResource(R.drawable.ic_network_error);
textView.setText(R.string.video_network_error);
} else {
if (i2 != 12345) {
return;
}
imageView.setBackgroundResource(R.drawable.community_bg_content);
textView.setText(R.string.video_failed);
}
}
});
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
int id = view.getId();
if (id == R.id.im_back) {
if (this.g) {
c(0, this.h);
return;
} else {
finish();
return;
}
}
if (id != R.id.im_error_icon) {
if (id != R.id.im_publish_confirm) {
return;
}
c(-1, this.h);
return;
}
View view2 = this.d;
if (view2 != null) {
view2.setVisibility(8);
}
UbtPlayerView ubtPlayerView = this.a;
if (ubtPlayerView != null) {
ubtPlayerView.getCurrentPosition();
this.a.e();
}
}
@Override // com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
requestWindowFeature(1);
getWindow().requestFeature(12);
this.b = View.inflate(this, R.layout.activity_ubtplayer, null);
setContentView(this.b);
initView();
initData();
}
@Override // com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
protected void onDestroy() {
super.onDestroy();
this.a.g();
}
@Override // com.ubt.jimu.ScreenRotationManageActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
protected void onPause() {
super.onPause();
this.a.b();
}
@Override // android.app.Activity
protected void onRestart() {
super.onRestart();
this.a.c();
}
@Override // com.ubt.jimu.ScreenRotationManageActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
protected void onResume() {
super.onResume();
this.a.d();
}
private void c(int i, String str) {
Intent intent = new Intent();
intent.putExtra("url", str);
setResult(i, intent);
this.a.g();
finish();
}
public static void a(Context context, String str, String str2) {
Intent intent = new Intent(context, (Class<?>) UbtPlayer.class);
intent.putExtra(Constant.Publish.VIDEO_PATH_KEY, str2);
intent.putExtra(Constant.Publish.VIDEO_TITLE_KEY, str);
context.startActivity(intent);
}
public static void a(Activity activity, int i, String str, String str2, boolean z) {
Intent intent = new Intent(activity, (Class<?>) UbtPlayer.class);
intent.putExtra(Constant.Publish.VIDEO_PATH_KEY, str2);
intent.putExtra(Constant.Publish.VIDEO_TITLE_KEY, str);
intent.putExtra(Constant.Publish.IS_SHOW_CONFIRM_KEY, z);
activity.startActivityForResult(intent, i);
}
}

View File

@@ -0,0 +1,285 @@
package com.ubt.jimu.widgets.player;
import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.baidu.cloud.media.player.IMediaPlayer;
import com.ubt.jimu.R;
import com.ubt.jimu.utils.LogUtils;
import com.ubt.jimu.widgets.player.bar.SimpleMediaController;
import com.ubt.jimu.widgets.player.widget.BDCloudVideoView;
/* loaded from: classes2.dex */
public class UbtPlayerView extends RelativeLayout implements IMediaPlayer.OnPreparedListener, IMediaPlayer.OnCompletionListener, IMediaPlayer.OnErrorListener, IMediaPlayer.OnInfoListener, IMediaPlayer.OnBufferingUpdateListener, BDCloudVideoView.OnPlayerStateListener, FullScreenSwitchoverListener, View.OnClickListener {
private String a;
private String b;
private SimpleMediaController c;
private RelativeLayout d;
private Context e;
private BDCloudVideoView f;
private String g;
private Toast h;
private RelativeLayout i;
private RelativeLayout j;
private ImageView k;
private ImageView l;
private boolean m;
private VideoErrorListener n;
public interface VideoErrorListener {
void j(int i);
}
public UbtPlayerView(Context context) {
this(context, null);
}
private void h() {
this.k.setOnClickListener(this);
}
private void i() {
BDCloudVideoView.setAppId(this.b);
BDCloudVideoView.setAK(this.a);
this.f = new BDCloudVideoView(this.e);
this.f.setOnPreparedListener(this);
this.f.setOnCompletionListener(this);
this.f.setOnErrorListener(this);
this.f.setOnInfoListener(this);
this.f.setOnBufferingUpdateListener(this);
this.f.setOnPlayerStateListener(this);
}
private void j() {
this.i = (RelativeLayout) ((LayoutInflater) getContext().getSystemService("layout_inflater")).inflate(R.layout.layout_ubt_player, this);
this.d = (RelativeLayout) this.i.findViewById(R.id.rl_player_container);
this.j = (RelativeLayout) this.i.findViewById(R.id.rl_normalscreen_controller);
this.c = (SimpleMediaController) findViewById(R.id.media_controller_bar);
this.k = (ImageView) findViewById(R.id.playButton);
this.l = (ImageView) findViewById(R.id.im_cover);
this.c.setFullScreenSwitchoverListener(this);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
layoutParams.addRule(13);
this.d.addView(this.f, layoutParams);
this.c.setMediaPlayerControl(this.f);
this.f.setLogEnabled(true);
this.f.setMaxProbeTime(2000);
this.f.setTimeoutInUs(1000000);
this.i.setEnabled(false);
this.i.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.player.UbtPlayerView.1
@Override // android.view.View.OnClickListener
public void onClick(View view) {
UbtPlayerView.this.a();
}
});
}
@Override // com.ubt.jimu.widgets.player.widget.BDCloudVideoView.OnPlayerStateListener
public void a(BDCloudVideoView.PlayerState playerState) {
SimpleMediaController simpleMediaController = this.c;
if (simpleMediaController != null) {
simpleMediaController.a();
}
BDCloudVideoView bDCloudVideoView = this.f;
if (bDCloudVideoView == null) {
return;
}
BDCloudVideoView.PlayerState currentPlayerState = bDCloudVideoView.getCurrentPlayerState();
if (currentPlayerState == BDCloudVideoView.PlayerState.STATE_PLAYING) {
this.i.setEnabled(true);
this.k.setVisibility(8);
}
if (this.m && currentPlayerState == BDCloudVideoView.PlayerState.STATE_PLAYING) {
this.m = false;
this.f.pause();
this.k.setVisibility(0);
}
}
public void b() {
BDCloudVideoView bDCloudVideoView = this.f;
if (bDCloudVideoView != null) {
bDCloudVideoView.pause();
}
}
public void c() {
BDCloudVideoView bDCloudVideoView;
if (this.k.getVisibility() != 8 || (bDCloudVideoView = this.f) == null) {
return;
}
bDCloudVideoView.start();
}
public void d() {
RelativeLayout relativeLayout = this.d;
if (relativeLayout == null) {
return;
}
relativeLayout.removeAllViews();
this.j.removeAllViews();
BDCloudVideoView bDCloudVideoView = this.f;
if (bDCloudVideoView != null) {
this.d.addView(bDCloudVideoView);
}
this.j.addView(this.c);
}
public void e() {
BDCloudVideoView bDCloudVideoView = this.f;
if (bDCloudVideoView != null) {
bDCloudVideoView.seekTo((int) this.c.getPreviousProgress());
this.f.start();
}
}
public void f() {
if (TextUtils.isEmpty(this.g)) {
this.h = Toast.makeText(this.e, "播放错误:视频播发源出错(001)", 0);
this.h.show();
} else {
this.m = false;
this.f.setVideoPath(this.g);
this.f.start();
}
}
public void g() {
BDCloudVideoView bDCloudVideoView = this.f;
if (bDCloudVideoView != null) {
bDCloudVideoView.b();
}
BDCloudVideoView bDCloudVideoView2 = this.f;
if (bDCloudVideoView2 != null) {
bDCloudVideoView2.e();
this.f.d();
}
this.f = null;
Toast toast = this.h;
if (toast != null) {
toast.cancel();
}
}
public long getCurrentPosition() {
if (this.f != null) {
return r0.getCurrentPosition();
}
return -1L;
}
@Override // com.baidu.cloud.media.player.IMediaPlayer.OnBufferingUpdateListener
public void onBufferingUpdate(IMediaPlayer iMediaPlayer, int i) {
BDCloudVideoView bDCloudVideoView;
SimpleMediaController simpleMediaController = this.c;
if (simpleMediaController == null || (bDCloudVideoView = this.f) == null) {
return;
}
simpleMediaController.a((i * bDCloudVideoView.getDuration()) / 100);
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
LogUtils.c("开始播放");
if (view.getId() != R.id.playButton) {
return;
}
this.k.setVisibility(8);
this.l.setVisibility(8);
BDCloudVideoView bDCloudVideoView = this.f;
if (bDCloudVideoView != null) {
this.m = false;
bDCloudVideoView.start();
}
}
@Override // com.baidu.cloud.media.player.IMediaPlayer.OnCompletionListener
public void onCompletion(IMediaPlayer iMediaPlayer) {
this.k.setVisibility(0);
this.l.setVisibility(0);
this.m = true;
}
@Override // com.baidu.cloud.media.player.IMediaPlayer.OnErrorListener
public boolean onError(IMediaPlayer iMediaPlayer, int i, int i2) {
VideoErrorListener videoErrorListener = this.n;
if (videoErrorListener == null) {
return true;
}
videoErrorListener.j(i);
return true;
}
@Override // com.baidu.cloud.media.player.IMediaPlayer.OnInfoListener
public boolean onInfo(IMediaPlayer iMediaPlayer, int i, int i2) {
if (i == 701) {
this.i.setEnabled(false);
this.k.setVisibility(8);
} else if (i == 702 && this.c != null) {
this.i.setEnabled(true);
this.k.setVisibility(8);
BDCloudVideoView bDCloudVideoView = this.f;
if (bDCloudVideoView != null) {
bDCloudVideoView.start();
}
}
return false;
}
@Override // com.baidu.cloud.media.player.IMediaPlayer.OnPreparedListener
public void onPrepared(IMediaPlayer iMediaPlayer) {
if (this.f == null) {
}
}
public void setTitle(String str) {
this.c.setTitle(str);
}
public void setVideoErrorListener(VideoErrorListener videoErrorListener) {
this.n = videoErrorListener;
}
public void setVideoPath(String str) {
this.g = str;
}
public UbtPlayerView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public UbtPlayerView(Context context, AttributeSet attributeSet, int i) {
this(context, attributeSet, i, 0);
}
public UbtPlayerView(Context context, AttributeSet attributeSet, int i, int i2) {
super(context, attributeSet, i, i2);
this.a = "637ccdcd7133452fab2cd63c0ad326e7";
this.b = "83120902010953728101p";
this.f = null;
this.e = context;
i();
j();
h();
}
public void a() {
BDCloudVideoView bDCloudVideoView = this.f;
if (bDCloudVideoView == null) {
return;
}
if (bDCloudVideoView.isPlaying()) {
this.k.setVisibility(0);
this.f.pause();
} else {
this.k.setVisibility(8);
this.l.setVisibility(8);
this.f.start();
}
}
}

View File

@@ -0,0 +1,269 @@
package com.ubt.jimu.widgets.player.bar;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import com.ubt.jimu.R;
import com.ubt.jimu.widgets.player.FullScreenSwitchoverListener;
import com.ubt.jimu.widgets.player.widget.BDCloudVideoView;
import com.ubtrobot.log.ALog;
import java.util.Timer;
import java.util.TimerTask;
/* loaded from: classes2.dex */
public class SimpleMediaController extends RelativeLayout {
private TextView a;
private SeekBar b;
private TextView c;
private Timer d;
private Handler e;
private long f;
private BDCloudVideoView g;
boolean h;
private TextView i;
private View j;
private boolean k;
private long l;
public SimpleMediaController(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.e = new Handler(Looper.getMainLooper());
this.g = null;
this.h = false;
this.k = false;
this.l = 0L;
c();
}
public boolean getIsDragging() {
return this.h;
}
public Handler getMainThreadHandler() {
return this.e;
}
public long getPreviousProgress() {
return this.f;
}
public void setCache(int i) {
SeekBar seekBar = this.b;
if (seekBar == null || i == seekBar.getSecondaryProgress()) {
return;
}
this.b.setSecondaryProgress(i);
}
public void setFullScreenSwitchoverListener(FullScreenSwitchoverListener fullScreenSwitchoverListener) {
}
public void setMax(int i) {
if (this.k) {
return;
}
SeekBar seekBar = this.b;
if (seekBar != null) {
seekBar.setMax(i);
}
b(i);
if (i > 0) {
this.k = true;
}
}
public void setMediaPlayerControl(BDCloudVideoView bDCloudVideoView) {
this.g = bDCloudVideoView;
}
public void setProgress(int i) {
if (this.b != null) {
this.f = this.g.getCurrentPosition();
this.b.setProgress(i);
}
}
public void setTitle(String str) {
this.j.setVisibility(0);
this.i.setVisibility(0);
this.i.setText(str);
}
private void c() {
View inflate = ((LayoutInflater) getContext().getSystemService("layout_inflater")).inflate(R.layout.layout_simple_controller, this);
this.i = (TextView) inflate.findViewById(R.id.tv_content);
this.j = inflate.findViewById(R.id.view_background);
this.a = (TextView) inflate.findViewById(R.id.tv_position);
this.b = (SeekBar) inflate.findViewById(R.id.seekbar);
this.b.setMax(0);
this.c = (TextView) inflate.findViewById(R.id.tv_duration);
this.b.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { // from class: com.ubt.jimu.widgets.player.bar.SimpleMediaController.1
@Override // android.widget.SeekBar.OnSeekBarChangeListener
public void onProgressChanged(SeekBar seekBar, int i, boolean z) {
SimpleMediaController.this.c(i);
}
@Override // android.widget.SeekBar.OnSeekBarChangeListener
public void onStartTrackingTouch(SeekBar seekBar) {
SimpleMediaController.this.h = true;
}
@Override // android.widget.SeekBar.OnSeekBarChangeListener
public void onStopTrackingTouch(SeekBar seekBar) {
if (SimpleMediaController.this.g.getDuration() > 0) {
SimpleMediaController.this.l = seekBar.getProgress();
if (SimpleMediaController.this.g != null) {
SimpleMediaController.this.g.seekTo(seekBar.getProgress());
}
}
SimpleMediaController.this.h = false;
}
});
a(false);
}
/* JADX INFO: Access modifiers changed from: private */
public void d() {
Timer timer = this.d;
if (timer != null) {
timer.cancel();
this.d = null;
}
this.d = new Timer();
this.d.schedule(new TimerTask() { // from class: com.ubt.jimu.widgets.player.bar.SimpleMediaController.3
@Override // java.util.TimerTask, java.lang.Runnable
public void run() {
SimpleMediaController.this.e.post(new Runnable() { // from class: com.ubt.jimu.widgets.player.bar.SimpleMediaController.3.1
@Override // java.lang.Runnable
public void run() {
SimpleMediaController.this.b();
}
});
}
}, 0L, 500L);
}
/* JADX INFO: Access modifiers changed from: private */
public void e() {
Timer timer = this.d;
if (timer != null) {
timer.cancel();
this.d = null;
}
}
/* JADX INFO: Access modifiers changed from: private */
public void b(int i) {
TextView textView = this.c;
if (textView != null) {
textView.setText(a(i));
}
}
public void a() {
final BDCloudVideoView.PlayerState currentPlayerState = this.g.getCurrentPlayerState();
ALog.a("SimpleMediaController").d("mediaController: changeStatus=" + currentPlayerState.name());
this.k = false;
this.e.post(new Runnable() { // from class: com.ubt.jimu.widgets.player.bar.SimpleMediaController.2
@Override // java.lang.Runnable
public void run() {
BDCloudVideoView.PlayerState playerState = currentPlayerState;
if (playerState == BDCloudVideoView.PlayerState.STATE_IDLE || playerState == BDCloudVideoView.PlayerState.STATE_ERROR) {
SimpleMediaController.this.e();
SimpleMediaController.this.b.setEnabled(false);
SimpleMediaController simpleMediaController = SimpleMediaController.this;
simpleMediaController.c(simpleMediaController.g == null ? 0 : SimpleMediaController.this.g.getCurrentPosition());
SimpleMediaController simpleMediaController2 = SimpleMediaController.this;
simpleMediaController2.b(simpleMediaController2.g != null ? SimpleMediaController.this.g.getDuration() : 0);
return;
}
if (playerState == BDCloudVideoView.PlayerState.STATE_PREPARING) {
SimpleMediaController.this.b.setEnabled(false);
return;
}
if (playerState == BDCloudVideoView.PlayerState.STATE_PREPARED) {
SimpleMediaController.this.b.setEnabled(true);
SimpleMediaController simpleMediaController3 = SimpleMediaController.this;
simpleMediaController3.b(simpleMediaController3.g != null ? SimpleMediaController.this.g.getDuration() : 0);
SimpleMediaController.this.b.setMax(SimpleMediaController.this.g.getDuration());
return;
}
if (playerState == BDCloudVideoView.PlayerState.STATE_PLAYBACK_COMPLETED) {
SimpleMediaController.this.e();
SimpleMediaController.this.b.setProgress(SimpleMediaController.this.b.getMax());
SimpleMediaController.this.b.setEnabled(false);
} else if (playerState != BDCloudVideoView.PlayerState.STATE_PLAYING) {
BDCloudVideoView.PlayerState playerState2 = BDCloudVideoView.PlayerState.STATE_PAUSED;
} else {
SimpleMediaController.this.d();
SimpleMediaController.this.b.setEnabled(true);
}
}
});
}
public boolean b() {
int duration;
BDCloudVideoView bDCloudVideoView = this.g;
if (bDCloudVideoView == null) {
return false;
}
long currentPosition = bDCloudVideoView.getCurrentPosition();
long j = this.l;
if (currentPosition > 0 && !getIsDragging()) {
this.l = currentPosition;
}
if (getVisibility() == 0 && !getIsDragging() && (duration = this.g.getDuration()) > 0) {
setMax(duration);
if (j != currentPosition) {
setProgress((int) currentPosition);
}
}
return false;
}
public SimpleMediaController(Context context) {
super(context);
this.e = new Handler(Looper.getMainLooper());
this.g = null;
this.h = false;
this.k = false;
this.l = 0L;
c();
}
private String a(int i) {
int i2 = i / 1000;
int i3 = i2 / 3600;
int i4 = (i2 % 3600) / 60;
int i5 = i2 % 60;
return i3 != 0 ? String.format("%02d:%02d:%02d", Integer.valueOf(i3), Integer.valueOf(i4), Integer.valueOf(i5)) : String.format("%02d:%02d", Integer.valueOf(i4), Integer.valueOf(i5));
}
/* JADX INFO: Access modifiers changed from: private */
public void c(int i) {
TextView textView = this.a;
if (textView != null) {
textView.setText(a(i));
}
}
public void a(boolean z) {
this.b.setEnabled(z);
}
public void a(final long j) {
this.e.post(new Runnable() { // from class: com.ubt.jimu.widgets.player.bar.SimpleMediaController.4
@Override // java.lang.Runnable
public void run() {
SimpleMediaController.this.setCache((int) j);
}
});
}
}

View File

@@ -0,0 +1,119 @@
package com.ubt.jimu.widgets.player.info;
import android.os.Parcel;
import android.os.Parcelable;
import com.tencent.open.SocialConstants;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class VideoInfo implements Parcelable {
public static final Parcelable.Creator<VideoInfo> CREATOR = new Parcelable.Creator<VideoInfo>() { // from class: com.ubt.jimu.widgets.player.info.VideoInfo.1
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public VideoInfo createFromParcel(Parcel parcel) {
String readString = parcel.readString();
String readString2 = parcel.readString();
String readString3 = parcel.readString();
boolean[] zArr = new boolean[1];
parcel.readBooleanArray(zArr);
VideoInfo videoInfo = new VideoInfo(readString, readString2);
videoInfo.setImageUrl(readString3);
videoInfo.setCanDelete(zArr[0]);
return videoInfo;
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public VideoInfo[] newArray(int i) {
return new VideoInfo[i];
}
};
private String title;
private String url;
private String imageUrl = "";
private boolean canDelete = true;
public VideoInfo(String str, String str2) {
this.title = "";
this.url = "";
this.title = str;
this.url = str2;
}
public static VideoInfo fromJson(JSONObject jSONObject) {
VideoInfo videoInfo;
try {
videoInfo = new VideoInfo(jSONObject.getString("title"), jSONObject.getString("url"));
try {
videoInfo.setImageUrl(jSONObject.optString(SocialConstants.PARAM_IMAGE_URL, ""));
videoInfo.setCanDelete(jSONObject.optBoolean("canDelete", true));
} catch (Exception e) {
e = e;
e.printStackTrace();
return videoInfo;
}
} catch (Exception e2) {
e = e2;
videoInfo = null;
}
return videoInfo;
}
@Override // android.os.Parcelable
public int describeContents() {
return 0;
}
public String getImageUrl() {
return this.imageUrl;
}
public String getTitle() {
return this.title;
}
public String getUrl() {
return this.url;
}
public boolean isCanDelete() {
return this.canDelete;
}
public void setCanDelete(boolean z) {
this.canDelete = z;
}
public void setImageUrl(String str) {
this.imageUrl = str;
}
public void setTitle(String str) {
this.title = str;
}
public void setUrl(String str) {
this.url = str;
}
public JSONObject toJson() {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("url", this.url);
jSONObject.put("title", this.title);
jSONObject.put(SocialConstants.PARAM_IMAGE_URL, this.imageUrl);
jSONObject.put("canDelete", this.canDelete);
} catch (Exception e) {
e.printStackTrace();
}
return jSONObject;
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel parcel, int i) {
parcel.writeString(this.title);
parcel.writeString(this.url);
parcel.writeString(this.imageUrl);
parcel.writeBooleanArray(new boolean[]{this.canDelete});
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,43 @@
package com.ubt.jimu.widgets.player.widget;
import android.graphics.Bitmap;
import android.view.View;
import com.baidu.cloud.media.player.IMediaPlayer;
/* loaded from: classes2.dex */
public interface IRenderView {
public interface IRenderCallback {
void a(ISurfaceHolder iSurfaceHolder);
void a(ISurfaceHolder iSurfaceHolder, int i, int i2);
void a(ISurfaceHolder iSurfaceHolder, int i, int i2, int i3);
}
public interface ISurfaceHolder {
IRenderView a();
void a(IMediaPlayer iMediaPlayer);
}
void a(int i, int i2);
void a(IRenderCallback iRenderCallback);
boolean a();
void b(int i, int i2);
void b(IRenderCallback iRenderCallback);
Bitmap getBitmap();
View getView();
void release();
void setAspectRatio(int i);
void setVideoRotation(int i);
}

View File

@@ -0,0 +1,78 @@
package com.ubt.jimu.widgets.player.widget;
import android.view.View;
import java.lang.ref.WeakReference;
/* loaded from: classes2.dex */
public final class MeasureHelper {
private int a;
private int b;
private int c;
private int d;
private int e;
private int f;
private int g;
private int h = 0;
public MeasureHelper(View view) {
new WeakReference(view);
}
/* JADX WARN: Code restructure failed: missing block: B:32:0x00ab, code lost:
if (r4 != false) goto L52;
*/
/* JADX WARN: Code restructure failed: missing block: B:33:0x00b0, code lost:
r12 = (int) (r0 / r1);
*/
/* JADX WARN: Code restructure failed: missing block: B:34:0x00b4, code lost:
r11 = (int) (r3 * r1);
*/
/* JADX WARN: Code restructure failed: missing block: B:35:0x00ae, code lost:
if (r4 != false) goto L51;
*/
/* JADX WARN: Code restructure failed: missing block: B:64:0x00f4, code lost:
if (r1 > r11) goto L83;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public void a(int r11, int r12) {
/*
Method dump skipped, instructions count: 288
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.ubt.jimu.widgets.player.widget.MeasureHelper.a(int, int):void");
}
public void b(int i, int i2) {
this.c = i;
this.d = i2;
}
public void c(int i, int i2) {
this.a = i;
this.b = i2;
}
public void b(int i) {
this.e = i;
}
public int b() {
return this.f;
}
public int a() {
return this.g;
}
public void a(int i) {
this.h = i;
}
}

View File

@@ -0,0 +1,217 @@
package com.ubt.jimu.widgets.player.widget;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import com.baidu.cloud.media.player.IMediaPlayer;
import com.ubt.jimu.widgets.player.widget.IRenderView;
import java.lang.ref.WeakReference;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/* loaded from: classes2.dex */
public class SurfaceRenderView extends SurfaceView implements IRenderView {
private MeasureHelper a;
private SurfaceCallback b;
private static final class InternalSurfaceHolder implements IRenderView.ISurfaceHolder {
private SurfaceRenderView a;
private SurfaceHolder b;
public InternalSurfaceHolder(SurfaceRenderView surfaceRenderView, SurfaceHolder surfaceHolder) {
this.a = surfaceRenderView;
this.b = surfaceHolder;
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView.ISurfaceHolder
public void a(IMediaPlayer iMediaPlayer) {
if (iMediaPlayer != null) {
iMediaPlayer.setDisplay(this.b);
}
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView.ISurfaceHolder
public IRenderView a() {
return this.a;
}
}
private static final class SurfaceCallback implements SurfaceHolder.Callback {
private SurfaceHolder a;
private boolean b;
private int c;
private int d;
private int e;
private WeakReference<SurfaceRenderView> f;
private Map<IRenderView.IRenderCallback, Object> g = new ConcurrentHashMap();
public SurfaceCallback(SurfaceRenderView surfaceRenderView) {
this.f = new WeakReference<>(surfaceRenderView);
}
public void a(IRenderView.IRenderCallback iRenderCallback) {
InternalSurfaceHolder internalSurfaceHolder;
this.g.put(iRenderCallback, iRenderCallback);
if (this.a != null) {
internalSurfaceHolder = new InternalSurfaceHolder(this.f.get(), this.a);
iRenderCallback.a(internalSurfaceHolder, this.d, this.e);
} else {
internalSurfaceHolder = null;
}
if (this.b) {
if (internalSurfaceHolder == null) {
internalSurfaceHolder = new InternalSurfaceHolder(this.f.get(), this.a);
}
iRenderCallback.a(internalSurfaceHolder, this.c, this.d, this.e);
}
}
public void b(IRenderView.IRenderCallback iRenderCallback) {
this.g.remove(iRenderCallback);
}
@Override // android.view.SurfaceHolder.Callback
public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i2, int i3) {
this.a = surfaceHolder;
this.b = true;
this.c = i;
this.d = i2;
this.e = i3;
InternalSurfaceHolder internalSurfaceHolder = new InternalSurfaceHolder(this.f.get(), this.a);
Iterator<IRenderView.IRenderCallback> it = this.g.keySet().iterator();
while (it.hasNext()) {
it.next().a(internalSurfaceHolder, i, i2, i3);
}
}
@Override // android.view.SurfaceHolder.Callback
public void surfaceCreated(SurfaceHolder surfaceHolder) {
this.a = surfaceHolder;
this.b = false;
this.c = 0;
this.d = 0;
this.e = 0;
Log.d("SurfaceRenderView", "surfaceCreated: " + surfaceHolder.getSurface());
InternalSurfaceHolder internalSurfaceHolder = new InternalSurfaceHolder(this.f.get(), this.a);
Iterator<IRenderView.IRenderCallback> it = this.g.keySet().iterator();
while (it.hasNext()) {
it.next().a(internalSurfaceHolder, 0, 0);
}
}
@Override // android.view.SurfaceHolder.Callback
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
this.a = null;
this.b = false;
this.c = 0;
this.d = 0;
this.e = 0;
InternalSurfaceHolder internalSurfaceHolder = new InternalSurfaceHolder(this.f.get(), this.a);
Iterator<IRenderView.IRenderCallback> it = this.g.keySet().iterator();
while (it.hasNext()) {
it.next().a(internalSurfaceHolder);
}
}
}
public SurfaceRenderView(Context context) {
super(context);
a(context);
}
private void a(Context context) {
this.a = new MeasureHelper(this);
this.b = new SurfaceCallback(this);
getHolder().addCallback(this.b);
getHolder().setType(0);
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView
public boolean a() {
return true;
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView
public void b(int i, int i2) {
if (i <= 0 || i2 <= 0) {
return;
}
this.a.b(i, i2);
requestLayout();
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView
public Bitmap getBitmap() {
return null;
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView
public View getView() {
return this;
}
@Override // android.view.View
@TargetApi(14)
public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
super.onInitializeAccessibilityEvent(accessibilityEvent);
accessibilityEvent.setClassName(SurfaceRenderView.class.getName());
}
@Override // android.view.View
@TargetApi(14)
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
if (Build.VERSION.SDK_INT >= 14) {
accessibilityNodeInfo.setClassName(SurfaceRenderView.class.getName());
}
}
@Override // android.view.SurfaceView, android.view.View
protected void onMeasure(int i, int i2) {
this.a.a(i, i2);
setMeasuredDimension(this.a.b(), this.a.a());
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView
public void release() {
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView
public void setAspectRatio(int i) {
this.a.a(i);
requestLayout();
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView
public void setVideoRotation(int i) {
Log.e("", "SurfaceView doesn't support rotation (" + i + ")!\n");
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView
public void b(IRenderView.IRenderCallback iRenderCallback) {
this.b.a(iRenderCallback);
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView
public void a(int i, int i2) {
if (i <= 0 || i2 <= 0) {
return;
}
this.a.c(i, i2);
getHolder().setFixedSize(i, i2);
requestLayout();
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView
public void a(IRenderView.IRenderCallback iRenderCallback) {
this.b.b(iRenderCallback);
}
}

View File

@@ -0,0 +1,266 @@
package com.ubt.jimu.widgets.player.widget;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.SurfaceTexture;
import android.util.Log;
import android.view.Surface;
import android.view.TextureView;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import com.baidu.cloud.media.player.IMediaPlayer;
import com.ubt.jimu.widgets.player.widget.IRenderView;
import java.lang.ref.WeakReference;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@TargetApi(14)
/* loaded from: classes2.dex */
public class TextureRenderView extends TextureView implements IRenderView {
private MeasureHelper a;
private int b;
private SurfaceTexture c;
private SurfaceCallback d;
private static final class SurfaceCallback implements TextureView.SurfaceTextureListener {
private SurfaceTexture a;
private boolean b;
private int c;
private int d;
private WeakReference<TextureRenderView> f;
private volatile boolean e = false;
private Map<IRenderView.IRenderCallback, Object> g = new ConcurrentHashMap();
public SurfaceCallback(TextureRenderView textureRenderView) {
this.f = new WeakReference<>(textureRenderView);
}
public void a(boolean z) {
this.e = z;
}
public void b(IRenderView.IRenderCallback iRenderCallback) {
this.g.remove(iRenderCallback);
}
@Override // android.view.TextureView.SurfaceTextureListener
@TargetApi(16)
public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i2) {
this.a = surfaceTexture;
if (this.f.get() == null) {
Log.e("TextureRenderView", "!!!!!Too bad, textureview in callback is released. function will not work normally");
} else if (this.f.get().getLastSurfaceTexture() == null) {
this.f.get().setLastSurfaceTexture(surfaceTexture);
}
this.b = false;
this.c = 0;
this.d = 0;
InternalSurfaceHolder internalSurfaceHolder = new InternalSurfaceHolder(this.f.get());
Iterator<IRenderView.IRenderCallback> it = this.g.keySet().iterator();
while (it.hasNext()) {
it.next().a(internalSurfaceHolder, 0, 0);
}
}
@Override // android.view.TextureView.SurfaceTextureListener
public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
this.a = surfaceTexture;
this.b = false;
this.c = 0;
this.d = 0;
InternalSurfaceHolder internalSurfaceHolder = new InternalSurfaceHolder(this.f.get());
Iterator<IRenderView.IRenderCallback> it = this.g.keySet().iterator();
while (it.hasNext()) {
it.next().a(internalSurfaceHolder);
}
return this.e;
}
@Override // android.view.TextureView.SurfaceTextureListener
public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i, int i2) {
this.a = surfaceTexture;
this.b = true;
this.c = i;
this.d = i2;
InternalSurfaceHolder internalSurfaceHolder = new InternalSurfaceHolder(this.f.get());
Iterator<IRenderView.IRenderCallback> it = this.g.keySet().iterator();
while (it.hasNext()) {
it.next().a(internalSurfaceHolder, 0, i, i2);
}
}
@Override // android.view.TextureView.SurfaceTextureListener
public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
}
public void a(IRenderView.IRenderCallback iRenderCallback) {
InternalSurfaceHolder internalSurfaceHolder;
this.g.put(iRenderCallback, iRenderCallback);
if (this.a != null) {
internalSurfaceHolder = new InternalSurfaceHolder(this.f.get());
iRenderCallback.a(internalSurfaceHolder, this.c, this.d);
} else {
internalSurfaceHolder = null;
}
if (this.b) {
if (internalSurfaceHolder == null) {
internalSurfaceHolder = new InternalSurfaceHolder(this.f.get());
}
iRenderCallback.a(internalSurfaceHolder, 0, this.c, this.d);
}
}
}
public TextureRenderView(Context context) {
super(context);
this.b = 0;
a(context);
}
private void a(Context context) {
this.a = new MeasureHelper(this);
this.d = new SurfaceCallback(this);
setSurfaceTextureListener(this.d);
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView
public boolean a() {
return false;
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView
public void b(int i, int i2) {
if (i <= 0 || i2 <= 0) {
return;
}
this.a.b(i, i2);
requestLayout();
}
public int getCurrentMediaPlayerCode() {
return this.b;
}
public SurfaceTexture getLastSurfaceTexture() {
return this.c;
}
public IRenderView.ISurfaceHolder getSurfaceHolder() {
return new InternalSurfaceHolder(this);
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView
public View getView() {
return this;
}
@Override // android.view.View
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
Log.d("TextureRenderView", "onDetachedFromWindow");
}
@Override // android.view.View
public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
super.onInitializeAccessibilityEvent(accessibilityEvent);
accessibilityEvent.setClassName(TextureRenderView.class.getName());
}
@Override // android.view.View
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
accessibilityNodeInfo.setClassName(TextureRenderView.class.getName());
}
@Override // android.view.View
protected void onMeasure(int i, int i2) {
this.a.a(i, i2);
setMeasuredDimension(this.a.b(), this.a.a());
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView
@TargetApi(16)
public void release() {
if (this.c != null) {
if (isAvailable()) {
this.d.a(true);
} else {
this.c.release();
this.c = null;
}
}
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView
public void setAspectRatio(int i) {
this.a.a(i);
requestLayout();
}
public void setCurrentMediaPlayerCode(int i) {
this.b = i;
}
public void setLastSurfaceTexture(SurfaceTexture surfaceTexture) {
this.c = surfaceTexture;
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView
public void setVideoRotation(int i) {
this.a.b(i);
setRotation(i);
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView
public void b(IRenderView.IRenderCallback iRenderCallback) {
this.d.a(iRenderCallback);
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView
public void a(int i, int i2) {
if (i <= 0 || i2 <= 0) {
return;
}
this.a.c(i, i2);
requestLayout();
}
private static final class InternalSurfaceHolder implements IRenderView.ISurfaceHolder {
private TextureRenderView a;
public InternalSurfaceHolder(TextureRenderView textureRenderView) {
this.a = textureRenderView;
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView.ISurfaceHolder
@TargetApi(16)
public void a(IMediaPlayer iMediaPlayer) {
if (iMediaPlayer == null || this.a.getSurfaceTexture() == null) {
return;
}
if (iMediaPlayer.hashCode() != this.a.getCurrentMediaPlayerCode()) {
iMediaPlayer.setSurface(b());
} else if (!this.a.getLastSurfaceTexture().equals(this.a.getSurfaceTexture())) {
TextureRenderView textureRenderView = this.a;
textureRenderView.setSurfaceTexture(textureRenderView.getLastSurfaceTexture());
}
this.a.setCurrentMediaPlayerCode(iMediaPlayer.hashCode());
}
public Surface b() {
return new Surface(this.a.getSurfaceTexture());
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView.ISurfaceHolder
public IRenderView a() {
return this.a;
}
}
@Override // com.ubt.jimu.widgets.player.widget.IRenderView
public void a(IRenderView.IRenderCallback iRenderCallback) {
this.d.b(iRenderCallback);
}
}

View File

@@ -0,0 +1,47 @@
package com.ubt.jimu.widgets.player.widget.datasource;
import android.util.Log;
import com.baidu.cloud.media.player.misc.IMediaDataSource;
import java.io.IOException;
import java.io.InputStream;
/* loaded from: classes2.dex */
public class ExtDataSourceProvider implements IMediaDataSource {
private InputStream a;
private long b = 0;
public ExtDataSourceProvider(InputStream inputStream) {
this.a = inputStream;
}
@Override // com.baidu.cloud.media.player.misc.IMediaDataSource
public void close() throws IOException {
InputStream inputStream = this.a;
if (inputStream != null) {
inputStream.close();
}
this.a = null;
}
@Override // com.baidu.cloud.media.player.misc.IMediaDataSource
public long getSize() throws IOException {
Log.w("ExtDataSourceProvider", "data available length: " + this.a.available());
return this.a.available();
}
@Override // com.baidu.cloud.media.player.misc.IMediaDataSource
public int readAt(long j, byte[] bArr, int i, int i2) throws IOException {
if (i2 <= 0) {
return i2;
}
if (this.b != j) {
this.a.reset();
this.b = this.a.skip(j);
Log.w("ExtDataSourceProvider", "Seek pos to " + this.b);
}
int read = this.a.read(bArr, i, i2);
this.b += read;
Log.w("ExtDataSourceProvider", "Current Pos " + this.b + " read length: " + read);
return read;
}
}

View File

@@ -0,0 +1,105 @@
package com.ubt.jimu.widgets.screenAdaptive;
import android.content.Context;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;
/* loaded from: classes2.dex */
public class XFrameLayout extends FrameLayout {
private Context a;
private float b;
private float c;
private float d;
private float e;
class AutoLayoutParams extends FrameLayout.LayoutParams {
public AutoLayoutParams(XFrameLayout xFrameLayout, Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
}
public XFrameLayout(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.a = context;
a(context);
}
private void a(Context context) {
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
float f = displayMetrics.density;
int i = displayMetrics.densityDpi;
this.b = displayMetrics.heightPixels;
this.c = displayMetrics.widthPixels;
float f2 = this.c;
float f3 = this.b;
if (f2 < f3) {
this.c = f3;
this.b = f2;
}
this.d = this.c / 1024.0f;
this.e = this.b / 768.0f;
}
@Override // android.view.ViewGroup
public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) {
if (view instanceof TextView) {
TextView textView = (TextView) view;
textView.setTextSize(0, textView.getTextSize() * this.e);
}
float paddingBottom = view.getPaddingBottom();
float paddingTop = view.getPaddingTop();
float paddingLeft = view.getPaddingLeft();
float paddingRight = view.getPaddingRight();
if (paddingBottom != 0.0f || paddingTop != 0.0f || paddingLeft != 0.0f || paddingRight != 0.0f) {
view.setPadding((int) paddingLeft, (int) paddingTop, (int) paddingRight, (int) paddingBottom);
}
if (layoutParams instanceof FrameLayout.LayoutParams) {
FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) layoutParams;
float f = layoutParams2.width;
float f2 = layoutParams2.height;
float f3 = layoutParams2.topMargin;
float f4 = layoutParams2.leftMargin;
float f5 = layoutParams2.bottomMargin;
float f6 = layoutParams2.rightMargin;
if (f3 != 0.0f) {
layoutParams2.topMargin = (int) ((f3 * this.e) + 0.5d);
}
if (f5 != 0.0f) {
layoutParams2.bottomMargin = (int) ((f5 * this.e) + 0.5d);
}
if (f4 != 0.0f) {
layoutParams2.leftMargin = (int) ((f4 * this.d) + 0.5d);
}
if (f6 != 0.0f) {
layoutParams2.rightMargin = (int) ((f6 * this.d) + 0.5d);
}
int i2 = (int) ((this.e * f2) + 0.5d);
if (f2 > 0.0f) {
layoutParams2.height = i2;
}
if (f > 0.0f) {
layoutParams2.width = (int) ((i2 * (f / f2)) + 0.5d);
}
}
super.addView(view, i, layoutParams);
}
@Override // android.widget.FrameLayout, android.view.View
protected void onMeasure(int i, int i2) {
if (getLayoutParams() instanceof FrameLayout.LayoutParams) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) getLayoutParams();
int i3 = layoutParams.width;
int i4 = layoutParams.height;
}
super.onMeasure(i, i2);
}
@Override // android.widget.FrameLayout, android.view.ViewGroup
public FrameLayout.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
return new AutoLayoutParams(this, this.a, attributeSet);
}
}

View File

@@ -0,0 +1,106 @@
package com.ubt.jimu.widgets.screenAdaptive;
import android.content.Context;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
/* loaded from: classes2.dex */
public class XLinearLayout extends LinearLayout {
private Context a;
private float b;
private float c;
private float d;
private float e;
class AutoLayoutParams extends LinearLayout.LayoutParams {
public AutoLayoutParams(XLinearLayout xLinearLayout, Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
}
public XLinearLayout(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.a = context;
getScreenInfo();
}
private void getScreenInfo() {
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
float f = displayMetrics.density;
int i = displayMetrics.densityDpi;
this.b = displayMetrics.heightPixels;
this.c = displayMetrics.widthPixels;
float f2 = this.c;
float f3 = this.b;
if (f2 < f3) {
this.c = f3;
this.b = f2;
}
this.d = this.c / 1024.0f;
this.e = this.b / 768.0f;
}
@Override // android.view.ViewGroup
public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) {
if (view instanceof TextView) {
TextView textView = (TextView) view;
textView.setTextSize(0, textView.getTextSize() * this.e);
}
float paddingBottom = view.getPaddingBottom();
float paddingTop = view.getPaddingTop();
float paddingLeft = view.getPaddingLeft();
float paddingRight = view.getPaddingRight();
if (paddingBottom != 0.0f || paddingTop != 0.0f || paddingLeft != 0.0f || paddingRight != 0.0f) {
view.setPadding((int) paddingLeft, (int) paddingTop, (int) paddingRight, (int) paddingBottom);
}
LinearLayout.LayoutParams layoutParams2 = (LinearLayout.LayoutParams) layoutParams;
float f = layoutParams2.width;
float f2 = layoutParams2.height;
Log.e("xLinearLayout", "childWidth==" + f);
float f3 = (float) layoutParams2.topMargin;
float f4 = (float) layoutParams2.leftMargin;
float f5 = (float) layoutParams2.bottomMargin;
float f6 = layoutParams2.rightMargin;
if (f3 != 0.0f) {
layoutParams2.topMargin = (int) ((f3 * this.e) + 0.5d);
}
if (f5 != 0.0f) {
layoutParams2.bottomMargin = (int) ((f5 * this.e) + 0.5d);
}
if (f4 != 0.0f) {
layoutParams2.leftMargin = (int) ((f4 * this.d) + 0.5d);
}
if (f6 != 0.0f) {
layoutParams2.rightMargin = (int) ((f6 * this.d) + 0.5d);
}
int i2 = (int) ((this.e * f2) + 0.5d);
if (f2 > 0.0f) {
layoutParams2.height = i2;
}
if (f > 0.0f) {
layoutParams2.width = (int) ((i2 * (f / f2)) + 0.5d);
}
super.addView(view, i, layoutParams);
}
@Override // android.widget.LinearLayout, android.view.View
protected void onMeasure(int i, int i2) {
if (getLayoutParams() instanceof FrameLayout.LayoutParams) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) getLayoutParams();
int i3 = layoutParams.width;
int i4 = layoutParams.height;
}
super.onMeasure(i, i2);
}
@Override // android.widget.LinearLayout, android.view.ViewGroup
public LinearLayout.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
return new AutoLayoutParams(this, this.a, attributeSet);
}
}

View File

@@ -0,0 +1,146 @@
package com.ubt.jimu.widgets.screenAdaptive;
import android.content.Context;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.ubt.jimu.utils.LogUtils;
/* loaded from: classes2.dex */
public class XRelativeLayout extends RelativeLayout {
private Context a;
private float b;
private int c;
private float d;
private float e;
private float f;
private float g;
protected boolean h;
class AutoLayoutParams extends RelativeLayout.LayoutParams {
public AutoLayoutParams(XRelativeLayout xRelativeLayout, Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
}
public XRelativeLayout(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.h = false;
this.a = context;
a(context);
}
private void a(Context context) {
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
this.b = displayMetrics.density;
this.c = displayMetrics.densityDpi;
this.d = displayMetrics.heightPixels;
this.e = displayMetrics.widthPixels;
float f = this.e;
float f2 = this.d;
if (f < f2) {
this.e = f2;
this.d = f;
}
this.f = this.e / 1024.0f;
this.g = this.d / 768.0f;
LogUtils.c("Density is " + this.b + " densityDpi is " + this.c + " height: " + this.d + " width: " + this.e);
}
@Override // android.view.ViewGroup
public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) {
if (view instanceof TextView) {
TextView textView = (TextView) view;
textView.setTextSize(0, textView.getTextSize() * this.g);
}
int paddingBottom = view.getPaddingBottom();
int paddingTop = view.getPaddingTop();
int paddingLeft = view.getPaddingLeft();
int paddingRight = view.getPaddingRight();
if (paddingBottom != 0 || paddingTop != 0 || paddingLeft != 0 || paddingRight != 0) {
view.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
}
if (layoutParams instanceof RelativeLayout.LayoutParams) {
RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) layoutParams;
float f = layoutParams2.width;
float f2 = layoutParams2.height;
int i2 = layoutParams2.topMargin;
int i3 = layoutParams2.leftMargin;
int i4 = layoutParams2.bottomMargin;
int i5 = layoutParams2.rightMargin;
if (i2 != 0) {
layoutParams2.topMargin = (int) ((i2 * this.g) + 0.5d);
}
if (i4 != 0) {
layoutParams2.bottomMargin = (int) ((i4 * this.g) + 0.5d);
}
if (i3 != 0) {
layoutParams2.leftMargin = (int) ((i3 * this.f) + 0.5d);
}
if (i5 != 0) {
layoutParams2.rightMargin = (int) ((i5 * this.f) + 0.5d);
}
int i6 = (int) ((this.g * f2) + 0.5d);
if (f2 > 0.0f) {
layoutParams2.height = i6;
}
float f3 = f / f2;
int i7 = (int) ((i6 * f3) + 0.5d);
if (f > 0.0f) {
layoutParams2.width = i7;
}
Log.e("XRelativeLayout Test", "childWidth=" + f + "--childHeight" + f2 + "--adapterHeight=" + i6 + "--adapterWidth=" + i7 + "aspectRatio=" + f3 + "--heightRatio=" + this.g + "---widthRatio=" + this.f);
}
super.addView(view, i, layoutParams);
}
@Override // android.view.ViewGroup, android.view.View
public boolean dispatchTouchEvent(MotionEvent motionEvent) {
boolean z = this.h;
return z ? z : super.dispatchTouchEvent(motionEvent);
}
@Override // android.view.ViewGroup
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
LogUtils.d("isIntercept==" + this.h + "ev==" + getId());
boolean z = this.h;
return z ? z : super.onInterceptTouchEvent(motionEvent);
}
@Override // android.widget.RelativeLayout, 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);
LogUtils.d("l==" + i + "t==" + i2 + "r==" + i3 + "b==" + i4);
}
@Override // android.widget.RelativeLayout, android.view.View
protected void onMeasure(int i, int i2) {
if (getLayoutParams() instanceof FrameLayout.LayoutParams) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) getLayoutParams();
int i3 = layoutParams.width;
int i4 = layoutParams.height;
}
super.onMeasure(i, i2);
}
@Override // android.view.View
public boolean onTouchEvent(MotionEvent motionEvent) {
return super.onTouchEvent(motionEvent);
}
public void setIntercept(boolean z) {
LogUtils.d("setIntercept==" + z);
this.h = z;
}
@Override // android.widget.RelativeLayout, android.view.ViewGroup
public RelativeLayout.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
return new AutoLayoutParams(this, this.a, attributeSet);
}
}