what-the-bank/sources/com/google/android/material/sidesheet/SideSheetBehavior.java

715 lines
26 KiB
Java

package com.google.android.material.sidesheet;
import android.R;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.Base64;
import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewParent;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.view.ViewCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import androidx.core.view.accessibility.AccessibilityViewCommand;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.material.sidesheet.SideSheetBehavior;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.nio.charset.StandardCharsets;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
import o.AbstractC10711eMf;
import o.C14739fyr;
import o.C17052tZT;
import o.C17525xWe;
import o.C4363bXv;
import o.FLD;
import o.OSb;
import o.WBB;
import o.XgG;
import o.hqG;
import org.bouncycastle.asn1.cmp.PKIFailureInfo;
/* loaded from: classes2.dex */
public class SideSheetBehavior<V extends View> extends CoordinatorLayout.Sts<V> {
private static int B = 0;
private static byte C = 0;
private static int D = 1;
private static final int k;
/* renamed from: o, reason: collision with root package name */
private static final int f6480o;
boolean a;
public float b;
public int c;
WeakReference<View> d;
final Set<WBB> e;
public OSb f;
public int g;
public int h;
public AbstractC10711eMf i;
public int j;
public WeakReference<V> l;
private ColorStateList m;
private int n;
private float p;
private int q;
private boolean r;
private int s;
private final OSb.IeS t;
private C4363bXv u;
private VelocityTracker v;
private float w;
private final SideSheetBehavior<V>.RVV x;
private FLD y;
private void z(String str, Object[] objArr) {
byte[] decode = Base64.decode(str, 0);
byte[] bArr = new byte[decode.length];
for (int i = 0; i < decode.length; i++) {
bArr[i] = (byte) (decode[(decode.length - i) - 1] ^ C);
}
objArr[0] = new String(bArr, StandardCharsets.UTF_8);
}
static {
a();
k = C17052tZT.ojQ.side_sheet_accessibility_pane_title;
f6480o = C17052tZT.NHB.Widget_Material3_SideSheet;
}
public SideSheetBehavior() {
this.x = new RVV(this);
this.a = true;
this.h = 5;
this.s = 5;
this.b = 0.1f;
this.n = -1;
this.e = new LinkedHashSet();
this.t = new OSb.IeS(this) { // from class: com.google.android.material.sidesheet.SideSheetBehavior.1
private SideSheetBehavior c;
{
this.c = this;
}
@Override // o.OSb.IeS
public final void c(View view, int i, int i2) {
ViewGroup.MarginLayoutParams marginLayoutParams;
WeakReference<View> weakReference = this.c.d;
View view2 = weakReference != null ? weakReference.get() : null;
if (view2 != null && (marginLayoutParams = (ViewGroup.MarginLayoutParams) view2.getLayoutParams()) != null) {
AbstractC10711eMf abstractC10711eMf = this.c.i;
int left = view.getLeft();
view.getRight();
abstractC10711eMf.LE_(marginLayoutParams, left);
view2.setLayoutParams(marginLayoutParams);
}
SideSheetBehavior sideSheetBehavior = this.c;
if (sideSheetBehavior.e.isEmpty()) {
return;
}
sideSheetBehavior.i.c(i);
for (WBB wbb : sideSheetBehavior.e) {
}
}
@Override // o.OSb.IeS
public final int e(View view, int i) {
return view.getTop();
}
@Override // o.OSb.IeS
public final int b(View view, int i) {
int a = this.c.i.a();
int i2 = this.c.j;
return i < a ? a : i > i2 ? i2 : i;
}
@Override // o.OSb.IeS
public final int a(View view) {
return this.c.j;
}
@Override // o.OSb.IeS
public final void b(int i) {
if (i == 1 && this.c.a) {
this.c.d(1);
}
}
@Override // o.OSb.IeS
public final void c(View view, float f, float f2) {
this.c.b(view, this.c.i.d(view, f, f2), true);
}
@Override // o.OSb.IeS
public final boolean c(View view, int i) {
return (this.c.h == 1 || this.c.l == null || this.c.l.get() != view) ? false : true;
}
};
}
public SideSheetBehavior(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.x = new RVV(this);
this.a = true;
this.h = 5;
this.s = 5;
this.b = 0.1f;
this.n = -1;
this.e = new LinkedHashSet();
this.t = new OSb.IeS(this) { // from class: com.google.android.material.sidesheet.SideSheetBehavior.1
private SideSheetBehavior c;
{
this.c = this;
}
@Override // o.OSb.IeS
public final void c(View view, int i, int i2) {
ViewGroup.MarginLayoutParams marginLayoutParams;
WeakReference<View> weakReference = this.c.d;
View view2 = weakReference != null ? weakReference.get() : null;
if (view2 != null && (marginLayoutParams = (ViewGroup.MarginLayoutParams) view2.getLayoutParams()) != null) {
AbstractC10711eMf abstractC10711eMf = this.c.i;
int left = view.getLeft();
view.getRight();
abstractC10711eMf.LE_(marginLayoutParams, left);
view2.setLayoutParams(marginLayoutParams);
}
SideSheetBehavior sideSheetBehavior = this.c;
if (sideSheetBehavior.e.isEmpty()) {
return;
}
sideSheetBehavior.i.c(i);
for (WBB wbb : sideSheetBehavior.e) {
}
}
@Override // o.OSb.IeS
public final int e(View view, int i) {
return view.getTop();
}
@Override // o.OSb.IeS
public final int b(View view, int i) {
int a = this.c.i.a();
int i2 = this.c.j;
return i < a ? a : i > i2 ? i2 : i;
}
@Override // o.OSb.IeS
public final int a(View view) {
return this.c.j;
}
@Override // o.OSb.IeS
public final void b(int i) {
if (i == 1 && this.c.a) {
this.c.d(1);
}
}
@Override // o.OSb.IeS
public final void c(View view, float f, float f2) {
this.c.b(view, this.c.i.d(view, f, f2), true);
}
@Override // o.OSb.IeS
public final boolean c(View view, int i) {
return (this.c.h == 1 || this.c.l == null || this.c.l.get() != view) ? false : true;
}
};
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, C17052tZT.jNh.SideSheetBehavior_Layout);
if (obtainStyledAttributes.hasValue(C17052tZT.jNh.SideSheetBehavior_Layout_backgroundTint)) {
this.m = C14739fyr.Ku_(context, obtainStyledAttributes, C17052tZT.jNh.SideSheetBehavior_Layout_backgroundTint);
}
if (obtainStyledAttributes.hasValue(C17052tZT.jNh.SideSheetBehavior_Layout_shapeAppearance)) {
this.y = new FLD(FLD.Ll_(context, attributeSet, 0, f6480o, new C17525xWe(BitmapDescriptorFactory.HUE_RED)), (byte) 0);
}
if (obtainStyledAttributes.hasValue(C17052tZT.jNh.SideSheetBehavior_Layout_coplanarSiblingViewId)) {
int resourceId = obtainStyledAttributes.getResourceId(C17052tZT.jNh.SideSheetBehavior_Layout_coplanarSiblingViewId, -1);
this.n = resourceId;
WeakReference<View> weakReference = this.d;
if (weakReference != null) {
weakReference.clear();
}
this.d = null;
WeakReference<V> weakReference2 = this.l;
if (weakReference2 != null) {
V v = weakReference2.get();
if (resourceId != -1 && ViewCompat.G(v)) {
v.requestLayout();
}
}
}
if (this.y != null) {
C4363bXv c4363bXv = new C4363bXv(this.y);
this.u = c4363bXv;
c4363bXv.d(context);
ColorStateList colorStateList = this.m;
if (colorStateList == null) {
TypedValue typedValue = new TypedValue();
context.getTheme().resolveAttribute(R.attr.colorBackground, typedValue, true);
this.u.setTint(typedValue.data);
} else {
C4363bXv c4363bXv2 = this.u;
if (c4363bXv2.B.d != colorStateList) {
c4363bXv2.B.d = colorStateList;
c4363bXv2.onStateChange(c4363bXv2.getState());
}
}
}
this.p = obtainStyledAttributes.getDimension(C17052tZT.jNh.SideSheetBehavior_Layout_android_elevation, -1.0f);
this.a = obtainStyledAttributes.getBoolean(C17052tZT.jNh.SideSheetBehavior_Layout_behavior_draggable, true);
obtainStyledAttributes.recycle();
if (this.i == null) {
this.i = new hqG(this);
}
this.w = ViewConfiguration.get(context).getScaledMaximumFlingVelocity();
}
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Sts
public final Parcelable LH_(CoordinatorLayout coordinatorLayout, V v) {
return new Sts(super.LH_(coordinatorLayout, v), (SideSheetBehavior<?>) this);
}
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Sts
public final void LG_(CoordinatorLayout coordinatorLayout, V v, Parcelable parcelable) {
Sts sts = (Sts) parcelable;
if (sts.b != null) {
super.LG_(coordinatorLayout, v, sts.b);
}
int i = (sts.c == 1 || sts.c == 2) ? 5 : sts.c;
this.h = i;
this.s = i;
}
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Sts
public final void a(CoordinatorLayout.RVV rvv) {
super.a(rvv);
this.l = null;
this.f = null;
}
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Sts
public final void d() {
super.d();
this.l = null;
this.f = null;
}
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Sts
public final boolean a(CoordinatorLayout coordinatorLayout, V v, int i, int i2, int i3, int i4) {
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
int paddingLeft = coordinatorLayout.getPaddingLeft();
int paddingRight = coordinatorLayout.getPaddingRight();
int i5 = marginLayoutParams.leftMargin;
int childMeasureSpec = ViewGroup.getChildMeasureSpec(i, paddingLeft + paddingRight + i5 + marginLayoutParams.rightMargin + i2, ((ViewGroup.LayoutParams) marginLayoutParams).width);
int paddingTop = coordinatorLayout.getPaddingTop();
int paddingBottom = coordinatorLayout.getPaddingBottom();
int i6 = marginLayoutParams.topMargin;
v.measure(childMeasureSpec, ViewGroup.getChildMeasureSpec(i3, paddingTop + paddingBottom + i6 + marginLayoutParams.bottomMargin + i4, ((ViewGroup.LayoutParams) marginLayoutParams).height));
return true;
}
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Sts
public final boolean c(CoordinatorLayout coordinatorLayout, V v, int i) {
int i2;
View findViewById;
if (ViewCompat.l(coordinatorLayout) && !ViewCompat.l(v)) {
v.setFitsSystemWindows(true);
}
int i3 = 0;
if (this.l == null) {
this.l = new WeakReference<>(v);
C4363bXv c4363bXv = this.u;
if (c4363bXv != null) {
ViewCompat.sn_(v, c4363bXv);
C4363bXv c4363bXv2 = this.u;
float f = this.p;
if (f == -1.0f) {
f = ViewCompat.i(v);
}
c4363bXv2.n(f);
} else {
ColorStateList colorStateList = this.m;
if (colorStateList != null) {
ViewCompat.so_(v, colorStateList);
}
}
int i4 = this.h == 5 ? 4 : 0;
if (v.getVisibility() != i4) {
v.setVisibility(i4);
}
e();
if (ViewCompat.n(v) == 0) {
ViewCompat.g(v, 1);
}
c(v);
}
if (this.f == null) {
this.f = OSb.xm_(coordinatorLayout, this.t);
}
int e = this.i.e(v);
coordinatorLayout.c(v, i);
this.j = coordinatorLayout.getWidth();
this.c = v.getWidth();
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
this.g = marginLayoutParams != null ? this.i.LD_(marginLayoutParams) : 0;
int i5 = this.h;
if (i5 == 1 || i5 == 2) {
i3 = e - this.i.e(v);
} else if (i5 != 3) {
if (i5 == 5) {
i3 = this.i.b();
} else {
StringBuilder sb = new StringBuilder("Unexpected value: ");
sb.append(this.h);
throw new IllegalStateException(sb.toString());
}
}
ViewCompat.e((View) v, i3);
if (this.d == null && (i2 = this.n) != -1 && (findViewById = coordinatorLayout.findViewById(i2)) != null) {
this.d = new WeakReference<>(findViewById);
}
Iterator<WBB> it = this.e.iterator();
while (it.hasNext()) {
if (it.next() instanceof WBB) {
}
}
return true;
}
private void c(View view) {
int i = 2 % 2;
int i2 = D + 19;
B = i2 % 128;
if (i2 % 2 == 0) {
if (ViewCompat.e(view) == null) {
int i3 = B + 107;
D = i3 % 128;
int i4 = i3 % 2;
String string = view.getResources().getString(k);
if (string.startsWith(",*,)")) {
Object[] objArr = new Object[1];
z(string.substring(4), objArr);
string = ((String) objArr[0]).intern();
int i5 = D + 7;
B = i5 % 128;
int i6 = i5 % 2;
}
ViewCompat.d(view, string);
return;
}
return;
}
ViewCompat.e(view);
Object obj = null;
obj.hashCode();
throw null;
}
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Sts
public final boolean MY_(CoordinatorLayout coordinatorLayout, V v, MotionEvent motionEvent) {
VelocityTracker velocityTracker;
if (!v.isShown()) {
return false;
}
int actionMasked = motionEvent.getActionMasked();
if (this.h == 1 && actionMasked == 0) {
return true;
}
if (c()) {
this.f.xo_(motionEvent);
}
if (actionMasked == 0 && (velocityTracker = this.v) != null) {
velocityTracker.recycle();
this.v = null;
}
if (this.v == null) {
this.v = VelocityTracker.obtain();
}
this.v.addMovement(motionEvent);
if (c() && actionMasked == 2 && !this.r && c() && Math.abs(this.q - motionEvent.getX()) > this.f.d) {
this.f.a(v, motionEvent.getPointerId(motionEvent.getActionIndex()));
}
return !this.r;
}
public final void d(int i) {
V v;
if (this.h == i) {
return;
}
this.h = i;
if (i == 3 || i == 5) {
this.s = i;
}
WeakReference<V> weakReference = this.l;
if (weakReference == null || (v = weakReference.get()) == null) {
return;
}
int i2 = this.h == 5 ? 4 : 0;
if (v.getVisibility() != i2) {
v.setVisibility(i2);
}
for (WBB wbb : this.e) {
}
e();
}
public final void b(View view, int i, boolean z) {
if (this.i.a(view, i, z)) {
d(2);
this.x.e(i);
} else {
d(i);
}
}
/* loaded from: classes2.dex */
public class RVV {
public int a;
public final SideSheetBehavior b;
public boolean c;
private final Runnable e = new Runnable(this) { // from class: o.HxM
private SideSheetBehavior.RVV b;
@Override // java.lang.Runnable
public final void run() {
SideSheetBehavior.RVV rvv = this.b;
rvv.c = false;
if (rvv.b.f != null && rvv.b.f.c()) {
rvv.e(rvv.a);
} else if (rvv.b.h == 2) {
rvv.b.d(rvv.a);
}
}
{
this.b = this;
}
};
RVV(SideSheetBehavior sideSheetBehavior) {
this.b = sideSheetBehavior;
}
public final void e(int i) {
if (this.b.l == null || this.b.l.get() == null) {
return;
}
this.a = i;
if (this.c) {
return;
}
ViewCompat.e(this.b.l.get(), this.e);
this.c = true;
}
}
/* loaded from: classes2.dex */
protected static class Sts extends XgG {
public static final Parcelable.Creator<Sts> CREATOR = new Parcelable.ClassLoaderCreator<Sts>() { // from class: com.google.android.material.sidesheet.SideSheetBehavior.Sts.2
@Override // android.os.Parcelable.Creator
public final /* synthetic */ Object createFromParcel(Parcel parcel) {
return new Sts(parcel, (ClassLoader) null);
}
@Override // android.os.Parcelable.ClassLoaderCreator
public final /* synthetic */ Sts createFromParcel(Parcel parcel, ClassLoader classLoader) {
return new Sts(parcel, classLoader);
}
@Override // android.os.Parcelable.Creator
public final /* bridge */ /* synthetic */ Object[] newArray(int i) {
return new Sts[i];
}
};
final int c;
public Sts(Parcel parcel, ClassLoader classLoader) {
super(parcel, classLoader);
this.c = parcel.readInt();
}
public Sts(Parcelable parcelable, SideSheetBehavior<?> sideSheetBehavior) {
super(parcelable);
this.c = sideSheetBehavior.h;
}
@Override // o.XgG, android.os.Parcelable
public final void writeToParcel(Parcel parcel, int i) {
super.writeToParcel(parcel, i);
parcel.writeInt(this.c);
}
}
private void e() {
V v;
WeakReference<V> weakReference = this.l;
if (weakReference == null || (v = weakReference.get()) == null) {
return;
}
ViewCompat.b(v, 262144);
ViewCompat.b(v, PKIFailureInfo.badCertTemplate);
final int i = 5;
if (this.h != 5) {
ViewCompat.a(v, AccessibilityNodeInfoCompat.AccessibilityActionCompat.h, null, new AccessibilityViewCommand(this, i) { // from class: o.RgD
private SideSheetBehavior c;
private int e;
@Override // androidx.core.view.accessibility.AccessibilityViewCommand
public final boolean d(View view) {
final SideSheetBehavior sideSheetBehavior = this.c;
final int i2 = this.e;
if (i2 != 1 && i2 != 2) {
Reference reference = sideSheetBehavior.l;
if (reference == null || reference.get() == null) {
sideSheetBehavior.d(i2);
} else {
View view2 = (View) sideSheetBehavior.l.get();
Runnable runnable = new Runnable(sideSheetBehavior, i2) { // from class: o.rhT
private int c;
private SideSheetBehavior d;
@Override // java.lang.Runnable
public final void run() {
SideSheetBehavior sideSheetBehavior2 = this.d;
int i3 = this.c;
View view3 = (View) sideSheetBehavior2.l.get();
if (view3 != null) {
sideSheetBehavior2.b(view3, i3, false);
}
}
{
this.d = sideSheetBehavior;
this.c = i2;
}
};
ViewParent parent = view2.getParent();
if (parent != null && parent.isLayoutRequested() && ViewCompat.H(view2)) {
view2.post(runnable);
} else {
runnable.run();
}
}
return true;
}
StringBuilder sb = new StringBuilder("STATE_");
sb.append(i2 == 1 ? "DRAGGING" : "SETTLING");
sb.append(" should not be set externally.");
throw new IllegalArgumentException(sb.toString());
}
{
this.c = this;
this.e = i;
}
});
}
final int i2 = 3;
if (this.h != 3) {
ViewCompat.a(v, AccessibilityNodeInfoCompat.AccessibilityActionCompat.f6387o, null, new AccessibilityViewCommand(this, i2) { // from class: o.RgD
private SideSheetBehavior c;
private int e;
@Override // androidx.core.view.accessibility.AccessibilityViewCommand
public final boolean d(View view) {
final SideSheetBehavior sideSheetBehavior = this.c;
final int i22 = this.e;
if (i22 != 1 && i22 != 2) {
Reference reference = sideSheetBehavior.l;
if (reference == null || reference.get() == null) {
sideSheetBehavior.d(i22);
} else {
View view2 = (View) sideSheetBehavior.l.get();
Runnable runnable = new Runnable(sideSheetBehavior, i22) { // from class: o.rhT
private int c;
private SideSheetBehavior d;
@Override // java.lang.Runnable
public final void run() {
SideSheetBehavior sideSheetBehavior2 = this.d;
int i3 = this.c;
View view3 = (View) sideSheetBehavior2.l.get();
if (view3 != null) {
sideSheetBehavior2.b(view3, i3, false);
}
}
{
this.d = sideSheetBehavior;
this.c = i22;
}
};
ViewParent parent = view2.getParent();
if (parent != null && parent.isLayoutRequested() && ViewCompat.H(view2)) {
view2.post(runnable);
} else {
runnable.run();
}
}
return true;
}
StringBuilder sb = new StringBuilder("STATE_");
sb.append(i22 == 1 ? "DRAGGING" : "SETTLING");
sb.append(" should not be set externally.");
throw new IllegalArgumentException(sb.toString());
}
{
this.c = this;
this.e = i2;
}
});
}
}
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Sts
public final boolean LJ_(CoordinatorLayout coordinatorLayout, V v, MotionEvent motionEvent) {
OSb oSb;
VelocityTracker velocityTracker;
if (!((v.isShown() || ViewCompat.e(v) != null) && this.a)) {
this.r = true;
return false;
}
int actionMasked = motionEvent.getActionMasked();
if (actionMasked == 0 && (velocityTracker = this.v) != null) {
velocityTracker.recycle();
this.v = null;
}
if (this.v == null) {
this.v = VelocityTracker.obtain();
}
this.v.addMovement(motionEvent);
if (actionMasked == 0) {
this.q = (int) motionEvent.getX();
} else if ((actionMasked == 1 || actionMasked == 3) && this.r) {
this.r = false;
return false;
}
return (this.r || (oSb = this.f) == null || !oSb.xp_(motionEvent)) ? false : true;
}
static void a() {
C = (byte) 6;
}
private boolean c() {
return this.f != null && (this.a || this.h == 1);
}
}