688 lines
26 KiB
Java
688 lines
26 KiB
Java
package com.ubt.jimu.utils.topsnackbar;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.TypedArray;
|
|
import android.os.Build;
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.os.Message;
|
|
import android.util.AttributeSet;
|
|
import android.view.LayoutInflater;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.ViewParent;
|
|
import android.view.accessibility.AccessibilityManager;
|
|
import android.view.animation.Animation;
|
|
import android.widget.Button;
|
|
import android.widget.FrameLayout;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.TextView;
|
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
|
import androidx.core.view.OnApplyWindowInsetsListener;
|
|
import androidx.core.view.ViewCompat;
|
|
import androidx.core.view.ViewPropertyAnimatorCompat;
|
|
import androidx.core.view.ViewPropertyAnimatorListenerAdapter;
|
|
import androidx.core.view.WindowInsetsCompat;
|
|
import com.google.android.material.behavior.SwipeDismissBehavior;
|
|
import com.google.android.material.snackbar.Snackbar$SnackbarLayout;
|
|
import com.ubt.jimu.R;
|
|
import com.ubt.jimu.R$styleable;
|
|
import com.ubt.jimu.utils.topsnackbar.SnackbarManager;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class TSnackbar {
|
|
static final Handler i = new Handler(Looper.getMainLooper(), new Handler.Callback() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.1
|
|
@Override // android.os.Handler.Callback
|
|
public boolean handleMessage(Message message) {
|
|
int i2 = message.what;
|
|
if (i2 == 0) {
|
|
((TSnackbar) message.obj).f();
|
|
return true;
|
|
}
|
|
if (i2 != 1) {
|
|
return false;
|
|
}
|
|
((TSnackbar) message.obj).b(message.arg1);
|
|
return true;
|
|
}
|
|
});
|
|
private final ViewGroup a;
|
|
private final Context b;
|
|
final SnackbarLayout c;
|
|
private int d;
|
|
private Callback e;
|
|
private final AccessibilityManager g;
|
|
private int f = 0;
|
|
final SnackbarManager.Callback h = new SnackbarManager.Callback() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.3
|
|
@Override // com.ubt.jimu.utils.topsnackbar.SnackbarManager.Callback
|
|
public void a() {
|
|
Handler handler = TSnackbar.i;
|
|
handler.sendMessage(handler.obtainMessage(0, TSnackbar.this));
|
|
}
|
|
|
|
@Override // com.ubt.jimu.utils.topsnackbar.SnackbarManager.Callback
|
|
public void a(int i2) {
|
|
Handler handler = TSnackbar.i;
|
|
handler.sendMessage(handler.obtainMessage(1, i2, 0, TSnackbar.this));
|
|
}
|
|
};
|
|
|
|
final class Behavior extends SwipeDismissBehavior<Snackbar$SnackbarLayout> {
|
|
Behavior() {
|
|
}
|
|
|
|
@Override // com.google.android.material.behavior.SwipeDismissBehavior
|
|
public boolean a(View view) {
|
|
return view instanceof Snackbar$SnackbarLayout;
|
|
}
|
|
|
|
@Override // com.google.android.material.behavior.SwipeDismissBehavior, androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
|
|
public boolean a(CoordinatorLayout coordinatorLayout, Snackbar$SnackbarLayout snackbar$SnackbarLayout, MotionEvent motionEvent) {
|
|
if (coordinatorLayout.a(snackbar$SnackbarLayout, (int) motionEvent.getX(), (int) motionEvent.getY())) {
|
|
int actionMasked = motionEvent.getActionMasked();
|
|
if (actionMasked == 0) {
|
|
SnackbarManager.a().a(TSnackbar.this.h);
|
|
} else if (actionMasked == 1 || actionMasked == 3) {
|
|
SnackbarManager.a().e(TSnackbar.this.h);
|
|
}
|
|
}
|
|
return super.a(coordinatorLayout, (CoordinatorLayout) snackbar$SnackbarLayout, motionEvent);
|
|
}
|
|
}
|
|
|
|
public static abstract class Callback {
|
|
public abstract void a(TSnackbar tSnackbar);
|
|
|
|
public abstract void a(TSnackbar tSnackbar, int i);
|
|
}
|
|
|
|
public static class SnackbarLayout extends LinearLayout {
|
|
private TextView a;
|
|
private Button b;
|
|
private int c;
|
|
private int d;
|
|
private OnLayoutChangeListener e;
|
|
private OnAttachStateChangeListener f;
|
|
|
|
interface OnAttachStateChangeListener {
|
|
void onViewAttachedToWindow(View view);
|
|
|
|
void onViewDetachedFromWindow(View view);
|
|
}
|
|
|
|
interface OnLayoutChangeListener {
|
|
void a(View view, int i, int i2, int i3, int i4);
|
|
}
|
|
|
|
public SnackbarLayout(Context context) {
|
|
this(context, null);
|
|
}
|
|
|
|
void a(int i, int i2) {
|
|
ViewCompat.a((View) this.a, 0.0f);
|
|
ViewPropertyAnimatorCompat a = ViewCompat.a(this.a);
|
|
a.a(1.0f);
|
|
long j = i2;
|
|
a.a(j);
|
|
long j2 = i;
|
|
a.b(j2);
|
|
a.c();
|
|
if (this.b.getVisibility() == 0) {
|
|
ViewCompat.a((View) this.b, 0.0f);
|
|
ViewPropertyAnimatorCompat a2 = ViewCompat.a(this.b);
|
|
a2.a(1.0f);
|
|
a2.a(j);
|
|
a2.b(j2);
|
|
a2.c();
|
|
}
|
|
}
|
|
|
|
void b(int i, int i2) {
|
|
ViewCompat.a((View) this.a, 1.0f);
|
|
ViewPropertyAnimatorCompat a = ViewCompat.a(this.a);
|
|
a.a(0.0f);
|
|
long j = i2;
|
|
a.a(j);
|
|
long j2 = i;
|
|
a.b(j2);
|
|
a.c();
|
|
if (this.b.getVisibility() == 0) {
|
|
ViewCompat.a((View) this.b, 1.0f);
|
|
ViewPropertyAnimatorCompat a2 = ViewCompat.a(this.b);
|
|
a2.a(0.0f);
|
|
a2.a(j);
|
|
a2.b(j2);
|
|
a2.c();
|
|
}
|
|
}
|
|
|
|
Button getActionView() {
|
|
return this.b;
|
|
}
|
|
|
|
TextView getMessageView() {
|
|
return this.a;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
protected void onAttachedToWindow() {
|
|
super.onAttachedToWindow();
|
|
OnAttachStateChangeListener onAttachStateChangeListener = this.f;
|
|
if (onAttachStateChangeListener != null) {
|
|
onAttachStateChangeListener.onViewAttachedToWindow(this);
|
|
}
|
|
ViewCompat.B(this);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
protected void onDetachedFromWindow() {
|
|
super.onDetachedFromWindow();
|
|
OnAttachStateChangeListener onAttachStateChangeListener = this.f;
|
|
if (onAttachStateChangeListener != null) {
|
|
onAttachStateChangeListener.onViewDetachedFromWindow(this);
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
protected void onFinishInflate() {
|
|
super.onFinishInflate();
|
|
this.a = (TextView) findViewById(R.id.snackbar_text);
|
|
this.b = (Button) findViewById(R.id.snackbar_action);
|
|
}
|
|
|
|
@Override // android.widget.LinearLayout, 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);
|
|
OnLayoutChangeListener onLayoutChangeListener = this.e;
|
|
if (onLayoutChangeListener != null) {
|
|
onLayoutChangeListener.a(this, i, i2, i3, i4);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:15:0x0055, code lost:
|
|
|
|
if (a(1, r0, r0 - r1) != false) goto L26;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:16:0x0063, code lost:
|
|
|
|
r4 = false;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:25:0x0060, code lost:
|
|
|
|
if (a(0, r0, r0) != false) goto L26;
|
|
*/
|
|
@Override // android.widget.LinearLayout, android.view.View
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
|
*/
|
|
protected void onMeasure(int r8, int r9) {
|
|
/*
|
|
r7 = this;
|
|
super.onMeasure(r8, r9)
|
|
int r0 = r7.c
|
|
if (r0 <= 0) goto L18
|
|
int r0 = r7.getMeasuredWidth()
|
|
int r1 = r7.c
|
|
if (r0 <= r1) goto L18
|
|
r8 = 1073741824(0x40000000, float:2.0)
|
|
int r8 = android.view.View.MeasureSpec.makeMeasureSpec(r1, r8)
|
|
super.onMeasure(r8, r9)
|
|
L18:
|
|
android.content.res.Resources r0 = r7.getResources()
|
|
r1 = 2131165631(0x7f0701bf, float:1.7945485E38)
|
|
int r0 = r0.getDimensionPixelSize(r1)
|
|
android.content.res.Resources r1 = r7.getResources()
|
|
r2 = 2131165630(0x7f0701be, float:1.7945483E38)
|
|
int r1 = r1.getDimensionPixelSize(r2)
|
|
android.widget.TextView r2 = r7.a
|
|
android.text.Layout r2 = r2.getLayout()
|
|
int r2 = r2.getLineCount()
|
|
r3 = 0
|
|
r4 = 1
|
|
if (r2 <= r4) goto L3e
|
|
r2 = 1
|
|
goto L3f
|
|
L3e:
|
|
r2 = 0
|
|
L3f:
|
|
if (r2 == 0) goto L58
|
|
int r5 = r7.d
|
|
if (r5 <= 0) goto L58
|
|
android.widget.Button r5 = r7.b
|
|
int r5 = r5.getMeasuredWidth()
|
|
int r6 = r7.d
|
|
if (r5 <= r6) goto L58
|
|
int r1 = r0 - r1
|
|
boolean r0 = r7.a(r4, r0, r1)
|
|
if (r0 == 0) goto L63
|
|
goto L64
|
|
L58:
|
|
if (r2 == 0) goto L5b
|
|
goto L5c
|
|
L5b:
|
|
r0 = r1
|
|
L5c:
|
|
boolean r0 = r7.a(r3, r0, r0)
|
|
if (r0 == 0) goto L63
|
|
goto L64
|
|
L63:
|
|
r4 = 0
|
|
L64:
|
|
if (r4 == 0) goto L69
|
|
super.onMeasure(r8, r9)
|
|
L69:
|
|
return
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.ubt.jimu.utils.topsnackbar.TSnackbar.SnackbarLayout.onMeasure(int, int):void");
|
|
}
|
|
|
|
void setOnAttachStateChangeListener(OnAttachStateChangeListener onAttachStateChangeListener) {
|
|
this.f = onAttachStateChangeListener;
|
|
}
|
|
|
|
void setOnLayoutChangeListener(OnLayoutChangeListener onLayoutChangeListener) {
|
|
this.e = onLayoutChangeListener;
|
|
}
|
|
|
|
public SnackbarLayout(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.SnackbarLayout);
|
|
this.c = obtainStyledAttributes.getDimensionPixelSize(0, -1);
|
|
this.d = obtainStyledAttributes.getDimensionPixelSize(2, -1);
|
|
if (obtainStyledAttributes.hasValue(1)) {
|
|
ViewCompat.b(this, obtainStyledAttributes.getDimensionPixelSize(1, 0));
|
|
}
|
|
obtainStyledAttributes.recycle();
|
|
setClickable(true);
|
|
LayoutInflater.from(context).inflate(R.layout.layout_snackbar_include, this);
|
|
ViewCompat.e((View) this, 1);
|
|
ViewCompat.f((View) this, 1);
|
|
ViewCompat.a((View) this, true);
|
|
ViewCompat.a(this, new OnApplyWindowInsetsListener(this) { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.SnackbarLayout.1
|
|
@Override // androidx.core.view.OnApplyWindowInsetsListener
|
|
public WindowInsetsCompat a(View view, WindowInsetsCompat windowInsetsCompat) {
|
|
view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), windowInsetsCompat.b());
|
|
return windowInsetsCompat;
|
|
}
|
|
});
|
|
}
|
|
|
|
private boolean a(int i, int i2, int i3) {
|
|
boolean z;
|
|
if (i != getOrientation()) {
|
|
setOrientation(i);
|
|
z = true;
|
|
} else {
|
|
z = false;
|
|
}
|
|
if (this.a.getPaddingTop() == i2 && this.a.getPaddingBottom() == i3) {
|
|
return z;
|
|
}
|
|
a(this.a, i2, i3);
|
|
return true;
|
|
}
|
|
|
|
private static void a(View view, int i, int i2) {
|
|
if (ViewCompat.z(view)) {
|
|
ViewCompat.a(view, ViewCompat.o(view), i, ViewCompat.n(view), i2);
|
|
} else {
|
|
view.setPadding(view.getPaddingLeft(), i, view.getPaddingRight(), i2);
|
|
}
|
|
}
|
|
}
|
|
|
|
private TSnackbar(ViewGroup viewGroup, int i2) {
|
|
this.a = viewGroup;
|
|
this.b = viewGroup.getContext();
|
|
LayoutInflater from = LayoutInflater.from(this.b);
|
|
if (i2 == 0) {
|
|
this.c = (SnackbarLayout) from.inflate(R.layout.layout_snackbar_top, this.a, false);
|
|
} else {
|
|
this.c = (SnackbarLayout) from.inflate(R.layout.layout_snackbar_bottom, this.a, false);
|
|
}
|
|
this.g = (AccessibilityManager) this.b.getSystemService("accessibility");
|
|
}
|
|
|
|
private void g(final int i2) {
|
|
if (Build.VERSION.SDK_INT < 14) {
|
|
Animation loadAnimation = android.view.animation.AnimationUtils.loadAnimation(this.c.getContext(), R.anim.design_snackbar_out);
|
|
loadAnimation.setInterpolator(AnimationUtils.a);
|
|
loadAnimation.setDuration(250L);
|
|
loadAnimation.setAnimationListener(new Animation.AnimationListener() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.10
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public void onAnimationEnd(Animation animation) {
|
|
TSnackbar.this.c(i2);
|
|
}
|
|
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public void onAnimationRepeat(Animation animation) {
|
|
}
|
|
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public void onAnimationStart(Animation animation) {
|
|
}
|
|
});
|
|
this.c.startAnimation(loadAnimation);
|
|
return;
|
|
}
|
|
ViewPropertyAnimatorCompat a = ViewCompat.a(this.c);
|
|
a.b(this.c.getHeight());
|
|
a.a(AnimationUtils.a);
|
|
a.a(250L);
|
|
a.a(new ViewPropertyAnimatorListenerAdapter() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.9
|
|
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
|
public void b(View view) {
|
|
TSnackbar.this.c(i2);
|
|
}
|
|
|
|
@Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener
|
|
public void c(View view) {
|
|
TSnackbar.this.c.b(0, 180);
|
|
}
|
|
});
|
|
a.c();
|
|
}
|
|
|
|
private void h(final int i2) {
|
|
if (Build.VERSION.SDK_INT < 14) {
|
|
Animation loadAnimation = android.view.animation.AnimationUtils.loadAnimation(this.c.getContext(), R.anim.top_out);
|
|
loadAnimation.setInterpolator(AnimationUtils.a);
|
|
loadAnimation.setDuration(250L);
|
|
loadAnimation.setAnimationListener(new Animation.AnimationListener() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.14
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public void onAnimationEnd(Animation animation) {
|
|
TSnackbar.this.c(i2);
|
|
}
|
|
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public void onAnimationRepeat(Animation animation) {
|
|
}
|
|
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public void onAnimationStart(Animation animation) {
|
|
}
|
|
});
|
|
this.c.startAnimation(loadAnimation);
|
|
return;
|
|
}
|
|
ViewPropertyAnimatorCompat a = ViewCompat.a(this.c);
|
|
a.b(-this.c.getHeight());
|
|
a.a(AnimationUtils.a);
|
|
a.a(250L);
|
|
a.a(new ViewPropertyAnimatorListenerAdapter() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.13
|
|
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
|
public void b(View view) {
|
|
TSnackbar.this.c(i2);
|
|
}
|
|
|
|
@Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener
|
|
public void c(View view) {
|
|
TSnackbar.this.c.b(0, 180);
|
|
}
|
|
});
|
|
a.c();
|
|
}
|
|
|
|
public void d(int i2) {
|
|
this.c.setBackgroundColor(this.b.getResources().getColor(i2));
|
|
}
|
|
|
|
public TSnackbar e(int i2) {
|
|
this.d = i2;
|
|
return this;
|
|
}
|
|
|
|
public TSnackbar f(int i2) {
|
|
this.f = i2;
|
|
return this;
|
|
}
|
|
|
|
public static TSnackbar a(View view, CharSequence charSequence, int i2, int i3) {
|
|
TSnackbar tSnackbar = new TSnackbar(a(view), i3);
|
|
tSnackbar.a(charSequence);
|
|
tSnackbar.e(i2);
|
|
tSnackbar.f(i3);
|
|
return tSnackbar;
|
|
}
|
|
|
|
public boolean b() {
|
|
return SnackbarManager.a().b(this.h);
|
|
}
|
|
|
|
void c() {
|
|
SnackbarManager.a().d(this.h);
|
|
Callback callback = this.e;
|
|
if (callback != null) {
|
|
callback.a(this);
|
|
}
|
|
}
|
|
|
|
boolean d() {
|
|
return !this.g.isEnabled();
|
|
}
|
|
|
|
public void e() {
|
|
SnackbarManager.a().a(this.d, this.h);
|
|
}
|
|
|
|
final void f() {
|
|
if (this.c.getParent() == null) {
|
|
ViewGroup.LayoutParams layoutParams = this.c.getLayoutParams();
|
|
if (layoutParams instanceof CoordinatorLayout.LayoutParams) {
|
|
CoordinatorLayout.LayoutParams layoutParams2 = (CoordinatorLayout.LayoutParams) layoutParams;
|
|
Behavior behavior = new Behavior();
|
|
behavior.b(0.1f);
|
|
behavior.a(0.6f);
|
|
behavior.a(0);
|
|
behavior.a(new SwipeDismissBehavior.OnDismissListener() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.4
|
|
@Override // com.google.android.material.behavior.SwipeDismissBehavior.OnDismissListener
|
|
public void a(View view) {
|
|
view.setVisibility(8);
|
|
TSnackbar.this.a(0);
|
|
}
|
|
|
|
@Override // com.google.android.material.behavior.SwipeDismissBehavior.OnDismissListener
|
|
public void a(int i2) {
|
|
if (i2 == 0) {
|
|
SnackbarManager.a().e(TSnackbar.this.h);
|
|
} else if (i2 == 1 || i2 == 2) {
|
|
SnackbarManager.a().a(TSnackbar.this.h);
|
|
}
|
|
}
|
|
});
|
|
layoutParams2.a(behavior);
|
|
layoutParams2.g = 80;
|
|
}
|
|
this.a.addView(this.c);
|
|
}
|
|
this.c.setOnAttachStateChangeListener(new SnackbarLayout.OnAttachStateChangeListener() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.5
|
|
@Override // com.ubt.jimu.utils.topsnackbar.TSnackbar.SnackbarLayout.OnAttachStateChangeListener
|
|
public void onViewAttachedToWindow(View view) {
|
|
}
|
|
|
|
@Override // com.ubt.jimu.utils.topsnackbar.TSnackbar.SnackbarLayout.OnAttachStateChangeListener
|
|
public void onViewDetachedFromWindow(View view) {
|
|
if (TSnackbar.this.b()) {
|
|
TSnackbar.i.post(new Runnable() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.5.1
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
TSnackbar.this.c(3);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
if (!ViewCompat.x(this.c)) {
|
|
this.c.setOnLayoutChangeListener(new SnackbarLayout.OnLayoutChangeListener() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.6
|
|
@Override // com.ubt.jimu.utils.topsnackbar.TSnackbar.SnackbarLayout.OnLayoutChangeListener
|
|
public void a(View view, int i2, int i3, int i4, int i5) {
|
|
TSnackbar.this.c.setOnLayoutChangeListener(null);
|
|
if (!TSnackbar.this.d()) {
|
|
TSnackbar.this.c();
|
|
} else if (TSnackbar.this.f == 0) {
|
|
TSnackbar.this.g();
|
|
} else {
|
|
TSnackbar.this.a();
|
|
}
|
|
}
|
|
});
|
|
return;
|
|
}
|
|
if (!d()) {
|
|
c();
|
|
} else if (this.f == 0) {
|
|
g();
|
|
} else {
|
|
a();
|
|
}
|
|
}
|
|
|
|
final void b(int i2) {
|
|
if (d() && this.c.getVisibility() == 0) {
|
|
if (this.f == 0) {
|
|
h(i2);
|
|
return;
|
|
} else {
|
|
g(i2);
|
|
return;
|
|
}
|
|
}
|
|
c(i2);
|
|
}
|
|
|
|
void c(int i2) {
|
|
SnackbarManager.a().c(this.h);
|
|
Callback callback = this.e;
|
|
if (callback != null) {
|
|
callback.a(this, i2);
|
|
}
|
|
if (Build.VERSION.SDK_INT < 11) {
|
|
this.c.setVisibility(8);
|
|
}
|
|
ViewParent parent = this.c.getParent();
|
|
if (parent instanceof ViewGroup) {
|
|
((ViewGroup) parent).removeView(this.c);
|
|
}
|
|
}
|
|
|
|
private static ViewGroup a(View view) {
|
|
ViewGroup viewGroup = null;
|
|
while (!(view instanceof CoordinatorLayout)) {
|
|
if (view instanceof FrameLayout) {
|
|
if (view.getId() == 16908290) {
|
|
return (ViewGroup) view;
|
|
}
|
|
viewGroup = (ViewGroup) view;
|
|
}
|
|
if (view != null) {
|
|
Object parent = view.getParent();
|
|
view = parent instanceof View ? (View) parent : null;
|
|
}
|
|
if (view == null) {
|
|
return viewGroup;
|
|
}
|
|
}
|
|
return (ViewGroup) view;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void g() {
|
|
if (Build.VERSION.SDK_INT >= 14) {
|
|
ViewCompat.k(this.c, -r0.getHeight());
|
|
ViewPropertyAnimatorCompat a = ViewCompat.a(this.c);
|
|
a.b(0.0f);
|
|
a.a(AnimationUtils.a);
|
|
a.a(250L);
|
|
a.a(new ViewPropertyAnimatorListenerAdapter() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.11
|
|
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
|
public void b(View view) {
|
|
if (TSnackbar.this.e != null) {
|
|
TSnackbar.this.e.a(TSnackbar.this);
|
|
}
|
|
SnackbarManager.a().d(TSnackbar.this.h);
|
|
}
|
|
|
|
@Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener
|
|
public void c(View view) {
|
|
TSnackbar.this.c.a(70, 180);
|
|
}
|
|
});
|
|
a.c();
|
|
return;
|
|
}
|
|
Animation loadAnimation = android.view.animation.AnimationUtils.loadAnimation(this.c.getContext(), R.anim.top_in);
|
|
loadAnimation.setInterpolator(AnimationUtils.a);
|
|
loadAnimation.setDuration(250L);
|
|
loadAnimation.setAnimationListener(new Animation.AnimationListener() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.12
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public void onAnimationEnd(Animation animation) {
|
|
if (TSnackbar.this.e != null) {
|
|
TSnackbar.this.e.a(TSnackbar.this);
|
|
}
|
|
SnackbarManager.a().d(TSnackbar.this.h);
|
|
}
|
|
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public void onAnimationRepeat(Animation animation) {
|
|
}
|
|
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public void onAnimationStart(Animation animation) {
|
|
}
|
|
});
|
|
this.c.startAnimation(loadAnimation);
|
|
}
|
|
|
|
public TSnackbar a(CharSequence charSequence) {
|
|
this.c.getMessageView().setText(charSequence);
|
|
return this;
|
|
}
|
|
|
|
void a(int i2) {
|
|
SnackbarManager.a().a(this.h, i2);
|
|
}
|
|
|
|
void a() {
|
|
if (Build.VERSION.SDK_INT >= 14) {
|
|
ViewCompat.k(this.c, r0.getHeight());
|
|
ViewPropertyAnimatorCompat a = ViewCompat.a(this.c);
|
|
a.b(0.0f);
|
|
a.a(AnimationUtils.a);
|
|
a.a(250L);
|
|
a.a(new ViewPropertyAnimatorListenerAdapter() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.7
|
|
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
|
public void b(View view) {
|
|
TSnackbar.this.c();
|
|
}
|
|
|
|
@Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener
|
|
public void c(View view) {
|
|
TSnackbar.this.c.a(70, 180);
|
|
}
|
|
});
|
|
a.c();
|
|
return;
|
|
}
|
|
Animation loadAnimation = android.view.animation.AnimationUtils.loadAnimation(this.c.getContext(), R.anim.design_snackbar_in);
|
|
loadAnimation.setInterpolator(AnimationUtils.a);
|
|
loadAnimation.setDuration(250L);
|
|
loadAnimation.setAnimationListener(new Animation.AnimationListener() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.8
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public void onAnimationEnd(Animation animation) {
|
|
TSnackbar.this.c();
|
|
}
|
|
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public void onAnimationRepeat(Animation animation) {
|
|
}
|
|
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public void onAnimationStart(Animation animation) {
|
|
}
|
|
});
|
|
this.c.startAnimation(loadAnimation);
|
|
}
|
|
}
|