318 lines
11 KiB
Java
318 lines
11 KiB
Java
package com.google.android.material.behavior;
|
|
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
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 o.OSb;
|
|
import org.bouncycastle.asn1.cmp.PKIFailureInfo;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class SwipeDismissBehavior<V extends View> extends CoordinatorLayout.Sts<V> {
|
|
public IeS d;
|
|
boolean e;
|
|
private boolean i;
|
|
public OSb j;
|
|
private boolean k;
|
|
private float h = BitmapDescriptorFactory.HUE_RED;
|
|
public int g = 2;
|
|
float c = 0.5f;
|
|
public float a = BitmapDescriptorFactory.HUE_RED;
|
|
public float b = 0.5f;
|
|
private final OSb.IeS f = new OSb.IeS(this) { // from class: com.google.android.material.behavior.SwipeDismissBehavior.5
|
|
private int a;
|
|
private int d = -1;
|
|
private SwipeDismissBehavior e;
|
|
|
|
{
|
|
this.e = this;
|
|
}
|
|
|
|
@Override // o.OSb.IeS
|
|
public final boolean c(View view, int i) {
|
|
int i2 = this.d;
|
|
return (i2 == -1 || i2 == i) && this.e.e(view);
|
|
}
|
|
|
|
@Override // o.OSb.IeS
|
|
public final void d(View view, int i) {
|
|
this.d = i;
|
|
this.a = view.getLeft();
|
|
ViewParent parent = view.getParent();
|
|
if (parent != null) {
|
|
this.e.e = true;
|
|
parent.requestDisallowInterceptTouchEvent(true);
|
|
this.e.e = false;
|
|
}
|
|
}
|
|
|
|
@Override // o.OSb.IeS
|
|
public final void b(int i) {
|
|
if (this.e.d != null) {
|
|
this.e.d.b(i);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:42:0x0058, code lost:
|
|
|
|
if (java.lang.Math.abs(r8.getLeft() - r7.a) >= java.lang.Math.round(r8.getWidth() * r7.e.c)) goto L29;
|
|
*/
|
|
@Override // o.OSb.IeS
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public final void c(android.view.View r8, float r9, float r10) {
|
|
/*
|
|
r7 = this;
|
|
r10 = -1
|
|
r7.d = r10
|
|
int r10 = r8.getWidth()
|
|
r0 = 0
|
|
int r1 = (r9 > r0 ? 1 : (r9 == r0 ? 0 : -1))
|
|
r2 = 0
|
|
r3 = 1
|
|
if (r1 == 0) goto L3f
|
|
int r4 = androidx.core.view.ViewCompat.m(r8)
|
|
if (r4 != r3) goto L16
|
|
r4 = r3
|
|
goto L17
|
|
L16:
|
|
r4 = r2
|
|
L17:
|
|
com.google.android.material.behavior.SwipeDismissBehavior r5 = r7.e
|
|
int r5 = r5.g
|
|
r6 = 2
|
|
if (r5 != r6) goto L1f
|
|
goto L5a
|
|
L1f:
|
|
com.google.android.material.behavior.SwipeDismissBehavior r5 = r7.e
|
|
int r5 = r5.g
|
|
if (r5 != 0) goto L2f
|
|
if (r4 == 0) goto L2c
|
|
int r1 = (r9 > r0 ? 1 : (r9 == r0 ? 0 : -1))
|
|
if (r1 >= 0) goto L6e
|
|
goto L5a
|
|
L2c:
|
|
if (r1 <= 0) goto L6e
|
|
goto L5a
|
|
L2f:
|
|
com.google.android.material.behavior.SwipeDismissBehavior r5 = r7.e
|
|
int r5 = r5.g
|
|
if (r5 != r3) goto L6e
|
|
if (r4 == 0) goto L3a
|
|
if (r1 <= 0) goto L6e
|
|
goto L5a
|
|
L3a:
|
|
int r1 = (r9 > r0 ? 1 : (r9 == r0 ? 0 : -1))
|
|
if (r1 >= 0) goto L6e
|
|
goto L5a
|
|
L3f:
|
|
int r1 = r8.getLeft()
|
|
int r4 = r7.a
|
|
int r5 = r8.getWidth()
|
|
float r5 = (float) r5
|
|
com.google.android.material.behavior.SwipeDismissBehavior r6 = r7.e
|
|
float r6 = r6.c
|
|
float r5 = r5 * r6
|
|
int r5 = java.lang.Math.round(r5)
|
|
int r1 = r1 - r4
|
|
int r1 = java.lang.Math.abs(r1)
|
|
if (r1 < r5) goto L6e
|
|
L5a:
|
|
int r9 = (r9 > r0 ? 1 : (r9 == r0 ? 0 : -1))
|
|
if (r9 < 0) goto L68
|
|
int r9 = r8.getLeft()
|
|
int r0 = r7.a
|
|
if (r9 < r0) goto L68
|
|
int r0 = r0 + r10
|
|
goto L6c
|
|
L68:
|
|
int r9 = r7.a
|
|
int r0 = r9 - r10
|
|
L6c:
|
|
r2 = r3
|
|
goto L70
|
|
L6e:
|
|
int r0 = r7.a
|
|
L70:
|
|
com.google.android.material.behavior.SwipeDismissBehavior r9 = r7.e
|
|
o.OSb r9 = r9.j
|
|
int r10 = r8.getTop()
|
|
boolean r9 = r9.c(r0, r10)
|
|
if (r9 == 0) goto L89
|
|
com.google.android.material.behavior.SwipeDismissBehavior$HBt r9 = new com.google.android.material.behavior.SwipeDismissBehavior$HBt
|
|
com.google.android.material.behavior.SwipeDismissBehavior r10 = r7.e
|
|
r9.<init>(r10, r8, r2)
|
|
androidx.core.view.ViewCompat.e(r8, r9)
|
|
return
|
|
L89:
|
|
if (r2 == 0) goto L98
|
|
com.google.android.material.behavior.SwipeDismissBehavior r9 = r7.e
|
|
com.google.android.material.behavior.SwipeDismissBehavior$IeS r9 = r9.d
|
|
if (r9 == 0) goto L98
|
|
com.google.android.material.behavior.SwipeDismissBehavior r9 = r7.e
|
|
com.google.android.material.behavior.SwipeDismissBehavior$IeS r9 = r9.d
|
|
r9.c(r8)
|
|
L98:
|
|
return
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.behavior.SwipeDismissBehavior.AnonymousClass5.c(android.view.View, float, float):void");
|
|
}
|
|
|
|
@Override // o.OSb.IeS
|
|
public final int a(View view) {
|
|
return view.getWidth();
|
|
}
|
|
|
|
@Override // o.OSb.IeS
|
|
public final int b(View view, int i) {
|
|
int width;
|
|
int width2;
|
|
boolean z = ViewCompat.m(view) == 1;
|
|
if (this.e.g == 0) {
|
|
if (z) {
|
|
width = this.a - view.getWidth();
|
|
width2 = this.a;
|
|
}
|
|
width = this.a;
|
|
width2 = view.getWidth() + width;
|
|
} else if (this.e.g == 1) {
|
|
if (!z) {
|
|
width = this.a - view.getWidth();
|
|
width2 = this.a;
|
|
}
|
|
width = this.a;
|
|
width2 = view.getWidth() + width;
|
|
} else {
|
|
width = this.a - view.getWidth();
|
|
width2 = view.getWidth() + this.a;
|
|
}
|
|
return Math.min(Math.max(width, i), width2);
|
|
}
|
|
|
|
@Override // o.OSb.IeS
|
|
public final int e(View view, int i) {
|
|
return view.getTop();
|
|
}
|
|
|
|
@Override // o.OSb.IeS
|
|
public final void c(View view, int i, int i2) {
|
|
float width = view.getWidth() * this.e.a;
|
|
float width2 = view.getWidth() * this.e.b;
|
|
float abs = Math.abs(i - this.a);
|
|
if (abs <= width) {
|
|
view.setAlpha(1.0f);
|
|
} else if (abs >= width2) {
|
|
view.setAlpha(BitmapDescriptorFactory.HUE_RED);
|
|
} else {
|
|
view.setAlpha(Math.min(Math.max(BitmapDescriptorFactory.HUE_RED, 1.0f - ((abs - width) / (width2 - width))), 1.0f));
|
|
}
|
|
}
|
|
};
|
|
|
|
/* loaded from: classes2.dex */
|
|
public interface IeS {
|
|
void b(int i);
|
|
|
|
void c(View view);
|
|
}
|
|
|
|
public boolean e(View view) {
|
|
return true;
|
|
}
|
|
|
|
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Sts
|
|
public final boolean c(CoordinatorLayout coordinatorLayout, V v, int i) {
|
|
boolean c = super.c(coordinatorLayout, v, i);
|
|
if (ViewCompat.n(v) == 0) {
|
|
ViewCompat.g(v, 1);
|
|
ViewCompat.b(v, PKIFailureInfo.badCertTemplate);
|
|
if (e(v)) {
|
|
ViewCompat.a(v, AccessibilityNodeInfoCompat.AccessibilityActionCompat.h, null, new AccessibilityViewCommand(this) { // from class: com.google.android.material.behavior.SwipeDismissBehavior.4
|
|
private SwipeDismissBehavior c;
|
|
|
|
{
|
|
this.c = this;
|
|
}
|
|
|
|
@Override // androidx.core.view.accessibility.AccessibilityViewCommand
|
|
public final boolean d(View view) {
|
|
if (!this.c.e(view)) {
|
|
return false;
|
|
}
|
|
boolean z = ViewCompat.m(view) == 1;
|
|
ViewCompat.e(view, (!(this.c.g == 0 && z) && (this.c.g != 1 || z)) ? view.getWidth() : -view.getWidth());
|
|
view.setAlpha(BitmapDescriptorFactory.HUE_RED);
|
|
if (this.c.d != null) {
|
|
this.c.d.c(view);
|
|
}
|
|
return true;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
return c;
|
|
}
|
|
|
|
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Sts
|
|
public boolean LJ_(CoordinatorLayout coordinatorLayout, V v, MotionEvent motionEvent) {
|
|
boolean z = this.i;
|
|
int actionMasked = motionEvent.getActionMasked();
|
|
if (actionMasked == 0) {
|
|
z = coordinatorLayout.e(v, (int) motionEvent.getX(), (int) motionEvent.getY());
|
|
this.i = z;
|
|
} else if (actionMasked == 1 || actionMasked == 3) {
|
|
this.i = false;
|
|
}
|
|
if (!z) {
|
|
return false;
|
|
}
|
|
if (this.j == null) {
|
|
this.j = OSb.xm_(coordinatorLayout, this.f);
|
|
}
|
|
return !this.e && this.j.xp_(motionEvent);
|
|
}
|
|
|
|
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Sts
|
|
public final boolean MY_(CoordinatorLayout coordinatorLayout, V v, MotionEvent motionEvent) {
|
|
if (this.j == null) {
|
|
return false;
|
|
}
|
|
if (this.e && motionEvent.getActionMasked() == 3) {
|
|
return true;
|
|
}
|
|
this.j.xo_(motionEvent);
|
|
return true;
|
|
}
|
|
|
|
/* loaded from: classes2.dex */
|
|
class HBt implements Runnable {
|
|
private final View a;
|
|
private final boolean c;
|
|
private SwipeDismissBehavior e;
|
|
|
|
HBt(SwipeDismissBehavior swipeDismissBehavior, View view, boolean z) {
|
|
this.e = swipeDismissBehavior;
|
|
this.a = view;
|
|
this.c = z;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
if (this.e.j != null && this.e.j.c()) {
|
|
ViewCompat.e(this.a, this);
|
|
} else {
|
|
if (!this.c || this.e.d == null) {
|
|
return;
|
|
}
|
|
this.e.d.c(this.a);
|
|
}
|
|
}
|
|
}
|
|
}
|