package com.daimajia.swipe; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Rect; import android.util.AttributeSet; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; import android.view.ViewParent; import android.widget.AdapterView; import android.widget.FrameLayout; import androidx.core.view.GravityCompat; import androidx.core.view.ViewCompat; import androidx.customview.widget.ViewDragHelper; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; /* loaded from: classes.dex */ public class SwipeLayout extends FrameLayout { private static final DragEdge A = DragEdge.Right; private int a; private DragEdge b; private ViewDragHelper c; private int d; private LinkedHashMap e; private ShowMode f; private float[] g; private List h; private List i; private Map> j; private Map k; private DoubleClickListener l; private boolean m; private boolean[] n; private boolean o; private ViewDragHelper.Callback p; private int q; private List r; private boolean s; private float t; private float u; View.OnClickListener v; View.OnLongClickListener x; private Rect y; private GestureDetector z; /* renamed from: com.daimajia.swipe.SwipeLayout$4, reason: invalid class name */ static /* synthetic */ class AnonymousClass4 { static final /* synthetic */ int[] a = new int[DragEdge.values().length]; static { try { a[DragEdge.Top.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { a[DragEdge.Bottom.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { a[DragEdge.Left.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } try { a[DragEdge.Right.ordinal()] = 4; } catch (NoSuchFieldError unused4) { } } } public interface DoubleClickListener { void a(SwipeLayout swipeLayout, boolean z); } public enum DragEdge { Left, Top, Right, Bottom } public interface OnLayout { void a(SwipeLayout swipeLayout); } public interface OnRevealListener { void a(View view, DragEdge dragEdge, float f, int i); } public enum ShowMode { LayDown, PullOut } public enum Status { Middle, Open, Close } public interface SwipeDenier { boolean a(MotionEvent motionEvent); } class SwipeDetector extends GestureDetector.SimpleOnGestureListener { SwipeDetector() { } @Override // android.view.GestureDetector.SimpleOnGestureListener, android.view.GestureDetector.OnDoubleTapListener public boolean onDoubleTap(MotionEvent motionEvent) { if (SwipeLayout.this.l != null) { View currentBottomView = SwipeLayout.this.getCurrentBottomView(); View surfaceView = SwipeLayout.this.getSurfaceView(); if (currentBottomView == null || motionEvent.getX() <= currentBottomView.getLeft() || motionEvent.getX() >= currentBottomView.getRight() || motionEvent.getY() <= currentBottomView.getTop() || motionEvent.getY() >= currentBottomView.getBottom()) { currentBottomView = surfaceView; } SwipeLayout.this.l.a(SwipeLayout.this, currentBottomView == surfaceView); } return true; } @Override // android.view.GestureDetector.SimpleOnGestureListener, android.view.GestureDetector.OnGestureListener public boolean onSingleTapUp(MotionEvent motionEvent) { if (SwipeLayout.this.o && SwipeLayout.this.b(motionEvent)) { SwipeLayout.this.a(); } return super.onSingleTapUp(motionEvent); } } public interface SwipeListener { void a(SwipeLayout swipeLayout); void a(SwipeLayout swipeLayout, float f, float f2); void a(SwipeLayout swipeLayout, int i, int i2); void b(SwipeLayout swipeLayout); void c(SwipeLayout swipeLayout); void d(SwipeLayout swipeLayout); } public SwipeLayout(Context context) { this(context, null); } private AdapterView getAdapterView() { ViewParent parent = getParent(); if (parent instanceof AdapterView) { return (AdapterView) parent; } return null; } private float getCurrentOffset() { DragEdge dragEdge = this.b; if (dragEdge == null) { return 0.0f; } return this.g[dragEdge.ordinal()]; } private boolean j() { return getAdapterView() != null; } /* JADX INFO: Access modifiers changed from: private */ public void k() { AdapterView adapterView; int positionForView; if (getOpenStatus() != Status.Close) { return; } ViewParent parent = getParent(); if (!(parent instanceof AdapterView) || (positionForView = (adapterView = (AdapterView) parent).getPositionForView(this)) == -1) { return; } adapterView.performItemClick(adapterView.getChildAt(positionForView - adapterView.getFirstVisiblePosition()), positionForView, adapterView.getAdapter().getItemId(positionForView)); } /* JADX INFO: Access modifiers changed from: private */ /* JADX WARN: Code restructure failed: missing block: B:7:0x0012, code lost: r0 = (android.widget.AdapterView) r0; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ public boolean l() { /* r12 = this; com.daimajia.swipe.SwipeLayout$Status r0 = r12.getOpenStatus() com.daimajia.swipe.SwipeLayout$Status r1 = com.daimajia.swipe.SwipeLayout.Status.Close r2 = 0 if (r0 == r1) goto La return r2 La: android.view.ViewParent r0 = r12.getParent() boolean r1 = r0 instanceof android.widget.AdapterView if (r1 == 0) goto L74 android.widget.AdapterView r0 = (android.widget.AdapterView) r0 int r6 = r0.getPositionForView(r12) r1 = -1 if (r6 != r1) goto L1c return r2 L1c: long r7 = r0.getItemIdAtPosition(r6) java.lang.Class r1 = android.widget.AbsListView.class java.lang.String r3 = "performLongPress" r4 = 3 java.lang.Class[] r5 = new java.lang.Class[r4] // Catch: java.lang.Exception -> L57 java.lang.Class r9 = android.view.View.class r5[r2] = r9 // Catch: java.lang.Exception -> L57 java.lang.Class r9 = java.lang.Integer.TYPE // Catch: java.lang.Exception -> L57 r10 = 1 r5[r10] = r9 // Catch: java.lang.Exception -> L57 java.lang.Class r9 = java.lang.Long.TYPE // Catch: java.lang.Exception -> L57 r11 = 2 r5[r11] = r9 // Catch: java.lang.Exception -> L57 java.lang.reflect.Method r1 = r1.getDeclaredMethod(r3, r5) // Catch: java.lang.Exception -> L57 r1.setAccessible(r10) // Catch: java.lang.Exception -> L57 java.lang.Object[] r3 = new java.lang.Object[r4] // Catch: java.lang.Exception -> L57 r3[r2] = r12 // Catch: java.lang.Exception -> L57 java.lang.Integer r4 = java.lang.Integer.valueOf(r6) // Catch: java.lang.Exception -> L57 r3[r10] = r4 // Catch: java.lang.Exception -> L57 java.lang.Long r4 = java.lang.Long.valueOf(r7) // Catch: java.lang.Exception -> L57 r3[r11] = r4 // Catch: java.lang.Exception -> L57 java.lang.Object r1 = r1.invoke(r0, r3) // Catch: java.lang.Exception -> L57 java.lang.Boolean r1 = (java.lang.Boolean) r1 // Catch: java.lang.Exception -> L57 boolean r0 = r1.booleanValue() // Catch: java.lang.Exception -> L57 goto L73 L57: r1 = move-exception r1.printStackTrace() android.widget.AdapterView$OnItemLongClickListener r1 = r0.getOnItemLongClickListener() if (r1 == 0) goto L6c android.widget.AdapterView$OnItemLongClickListener r3 = r0.getOnItemLongClickListener() r4 = r0 r5 = r12 boolean r1 = r3.onItemLongClick(r4, r5, r6, r7) goto L6d L6c: r1 = 0 L6d: if (r1 == 0) goto L72 r0.performHapticFeedback(r2) L72: r0 = r1 L73: return r0 L74: return r2 */ throw new UnsupportedOperationException("Method not decompiled: com.daimajia.swipe.SwipeLayout.l():boolean"); } private void m() { Status openStatus = getOpenStatus(); List bottomViews = getBottomViews(); if (openStatus != Status.Close) { View currentBottomView = getCurrentBottomView(); if (currentBottomView == null || currentBottomView.getVisibility() == 0) { return; } currentBottomView.setVisibility(0); return; } for (View view : bottomViews) { if (view != null && view.getVisibility() != 4) { view.setVisibility(4); } } } private void n() { View currentBottomView = getCurrentBottomView(); if (currentBottomView != null) { DragEdge dragEdge = this.b; if (dragEdge == DragEdge.Left || dragEdge == DragEdge.Right) { this.d = currentBottomView.getMeasuredWidth() - a(getCurrentOffset()); } else { this.d = currentBottomView.getMeasuredHeight() - a(getCurrentOffset()); } } ShowMode showMode = this.f; if (showMode == ShowMode.PullOut) { h(); } else if (showMode == ShowMode.LayDown) { g(); } m(); } private void setCurrentDragEdge(DragEdge dragEdge) { if (this.b != dragEdge) { this.b = dragEdge; n(); } } @Override // android.view.ViewGroup public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) { int i2; try { i2 = ((Integer) layoutParams.getClass().getField("gravity").get(layoutParams)).intValue(); } catch (Exception e) { e.printStackTrace(); i2 = 0; } if (i2 <= 0) { Iterator> it = this.e.entrySet().iterator(); while (true) { if (!it.hasNext()) { break; } Map.Entry next = it.next(); if (next.getValue() == null) { this.e.put(next.getKey(), view); break; } } } else { int a = GravityCompat.a(i2, ViewCompat.k(this)); if ((a & 3) == 3) { this.e.put(DragEdge.Left, view); } if ((a & 5) == 5) { this.e.put(DragEdge.Right, view); } if ((a & 48) == 48) { this.e.put(DragEdge.Top, view); } if ((a & 80) == 80) { this.e.put(DragEdge.Bottom, view); } } if (view == null || view.getParent() == this) { return; } super.addView(view, i, layoutParams); } @Override // android.view.View public void computeScroll() { super.computeScroll(); if (this.c.a(true)) { ViewCompat.A(this); } } public List getBottomViews() { ArrayList arrayList = new ArrayList(); for (DragEdge dragEdge : DragEdge.values()) { arrayList.add(this.e.get(dragEdge)); } return arrayList; } public View getCurrentBottomView() { List bottomViews = getBottomViews(); if (this.b.ordinal() < bottomViews.size()) { return bottomViews.get(this.b.ordinal()); } return null; } public int getDragDistance() { return this.d; } public DragEdge getDragEdge() { return this.b; } public Map getDragEdgeMap() { return this.e; } @Deprecated public List getDragEdges() { return new ArrayList(this.e.keySet()); } public Status getOpenStatus() { View surfaceView = getSurfaceView(); if (surfaceView == null) { return Status.Close; } int left = surfaceView.getLeft(); int top = surfaceView.getTop(); return (left == getPaddingLeft() && top == getPaddingTop()) ? Status.Close : (left == getPaddingLeft() - this.d || left == getPaddingLeft() + this.d || top == getPaddingTop() - this.d || top == getPaddingTop() + this.d) ? Status.Open : Status.Middle; } public ShowMode getShowMode() { return this.f; } public View getSurfaceView() { if (getChildCount() == 0) { return null; } return getChildAt(getChildCount() - 1); } public void i() { b(true, true); } @Override // android.view.ViewGroup, android.view.View protected void onAttachedToWindow() { super.onAttachedToWindow(); if (j()) { if (this.v == null) { setOnClickListener(new View.OnClickListener() { // from class: com.daimajia.swipe.SwipeLayout.2 @Override // android.view.View.OnClickListener public void onClick(View view) { SwipeLayout.this.k(); } }); } if (this.x == null) { setOnLongClickListener(new View.OnLongClickListener() { // from class: com.daimajia.swipe.SwipeLayout.3 @Override // android.view.View.OnLongClickListener public boolean onLongClick(View view) { SwipeLayout.this.l(); return true; } }); } } } @Override // android.view.ViewGroup public boolean onInterceptTouchEvent(MotionEvent motionEvent) { ViewParent parent; if (!e()) { return false; } if (this.o && getOpenStatus() == Status.Open && b(motionEvent)) { return true; } for (SwipeDenier swipeDenier : this.i) { if (swipeDenier != null && swipeDenier.a(motionEvent)) { return false; } } int action = motionEvent.getAction(); if (action != 0) { if (action != 1) { if (action == 2) { boolean z = this.s; a(motionEvent); if (this.s && (parent = getParent()) != null) { parent.requestDisallowInterceptTouchEvent(true); } if (!z && this.s) { return false; } } else if (action != 3) { this.c.a(motionEvent); } } this.s = false; this.c.a(motionEvent); } else { this.c.a(motionEvent); this.s = false; this.t = motionEvent.getRawX(); this.u = motionEvent.getRawY(); if (getOpenStatus() == Status.Middle) { this.s = true; } } return this.s; } @Override // android.widget.FrameLayout, android.view.ViewGroup, android.view.View protected void onLayout(boolean z, int i, int i2, int i3, int i4) { n(); if (this.r != null) { for (int i5 = 0; i5 < this.r.size(); i5++) { this.r.get(i5).a(this); } } } /* JADX WARN: Removed duplicated region for block: B:16:0x0058 */ @Override // android.view.View /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ public boolean onTouchEvent(android.view.MotionEvent r5) { /* r4 = this; boolean r0 = r4.e() if (r0 != 0) goto Lb boolean r5 = super.onTouchEvent(r5) return r5 Lb: int r0 = r5.getActionMasked() android.view.GestureDetector r1 = r4.z r1.onTouchEvent(r5) r1 = 0 r2 = 1 if (r0 == 0) goto L2e if (r0 == r2) goto L26 r3 = 2 if (r0 == r3) goto L3f r3 = 3 if (r0 == r3) goto L26 androidx.customview.widget.ViewDragHelper r3 = r4.c r3.a(r5) goto L52 L26: r4.s = r1 androidx.customview.widget.ViewDragHelper r3 = r4.c r3.a(r5) goto L52 L2e: androidx.customview.widget.ViewDragHelper r3 = r4.c r3.a(r5) float r3 = r5.getRawX() r4.t = r3 float r3 = r5.getRawY() r4.u = r3 L3f: r4.a(r5) boolean r3 = r4.s if (r3 == 0) goto L52 android.view.ViewParent r3 = r4.getParent() r3.requestDisallowInterceptTouchEvent(r2) androidx.customview.widget.ViewDragHelper r3 = r4.c r3.a(r5) L52: boolean r5 = super.onTouchEvent(r5) if (r5 != 0) goto L5e boolean r5 = r4.s if (r5 != 0) goto L5e if (r0 != 0) goto L5f L5e: r1 = 1 L5f: return r1 */ throw new UnsupportedOperationException("Method not decompiled: com.daimajia.swipe.SwipeLayout.onTouchEvent(android.view.MotionEvent):boolean"); } /* JADX INFO: Access modifiers changed from: protected */ @Override // android.view.ViewGroup public void onViewRemoved(View view) { for (Map.Entry entry : new HashMap(this.e).entrySet()) { if (entry.getValue() == view) { this.e.remove(entry.getKey()); } } } public void setBottomSwipeEnabled(boolean z) { this.n[DragEdge.Bottom.ordinal()] = z; } public void setClickToClose(boolean z) { this.o = z; } public void setDragDistance(int i) { if (i < 0) { i = 0; } this.d = a(i); requestLayout(); } @Deprecated public void setDragEdge(DragEdge dragEdge) { if (getChildCount() >= 2) { this.e.put(dragEdge, getChildAt(getChildCount() - 2)); } setCurrentDragEdge(dragEdge); } @Deprecated public void setDragEdges(List list) { int min = Math.min(list.size(), getChildCount() - 1); for (int i = 0; i < min; i++) { this.e.put(list.get(i), getChildAt(i)); } if (list.size() == 0 || list.contains(A)) { setCurrentDragEdge(A); } else { setCurrentDragEdge(list.get(0)); } } public void setLeftSwipeEnabled(boolean z) { this.n[DragEdge.Left.ordinal()] = z; } @Override // android.view.View public void setOnClickListener(View.OnClickListener onClickListener) { super.setOnClickListener(onClickListener); this.v = onClickListener; } public void setOnDoubleClickListener(DoubleClickListener doubleClickListener) { this.l = doubleClickListener; } @Override // android.view.View public void setOnLongClickListener(View.OnLongClickListener onLongClickListener) { super.setOnLongClickListener(onLongClickListener); this.x = onLongClickListener; } public void setRightSwipeEnabled(boolean z) { this.n[DragEdge.Right.ordinal()] = z; } public void setShowMode(ShowMode showMode) { this.f = showMode; requestLayout(); } public void setSwipeEnabled(boolean z) { this.m = z; } public void setTopSwipeEnabled(boolean z) { this.n[DragEdge.Top.ordinal()] = z; } public SwipeLayout(Context context, AttributeSet attributeSet) { this(context, attributeSet, 0); } protected boolean b(View view, Rect rect, DragEdge dragEdge, int i, int i2, int i3, int i4) { if (this.k.get(view).booleanValue()) { return false; } int i5 = rect.left; int i6 = rect.right; int i7 = rect.top; int i8 = rect.bottom; if (getShowMode() == ShowMode.LayDown) { if (dragEdge == DragEdge.Right && i3 <= i5) { return true; } if (dragEdge == DragEdge.Left && i >= i6) { return true; } if (dragEdge == DragEdge.Top && i2 >= i8) { return true; } if (dragEdge == DragEdge.Bottom && i4 <= i7) { return true; } } else if (getShowMode() == ShowMode.PullOut) { if (dragEdge == DragEdge.Right && i6 <= getWidth()) { return true; } if (dragEdge == DragEdge.Left && i5 >= getPaddingLeft()) { return true; } if (dragEdge == DragEdge.Top && i7 >= getPaddingTop()) { return true; } if (dragEdge == DragEdge.Bottom && i8 <= getHeight()) { return true; } } return false; } public boolean c() { View view = this.e.get(DragEdge.Left); return view != null && view.getParent() == this && view != getSurfaceView() && this.n[DragEdge.Left.ordinal()]; } public boolean d() { View view = this.e.get(DragEdge.Right); return view != null && view.getParent() == this && view != getSurfaceView() && this.n[DragEdge.Right.ordinal()]; } public boolean e() { return this.m; } public boolean f() { View view = this.e.get(DragEdge.Top); return view != null && view.getParent() == this && view != getSurfaceView() && this.n[DragEdge.Top.ordinal()]; } void g() { Rect a = a(false); View surfaceView = getSurfaceView(); if (surfaceView != null) { surfaceView.layout(a.left, a.top, a.right, a.bottom); bringChildToFront(surfaceView); } Rect a2 = a(ShowMode.LayDown, a); View currentBottomView = getCurrentBottomView(); if (currentBottomView != null) { currentBottomView.layout(a2.left, a2.top, a2.right, a2.bottom); } } void h() { Rect a = a(false); View surfaceView = getSurfaceView(); if (surfaceView != null) { surfaceView.layout(a.left, a.top, a.right, a.bottom); bringChildToFront(surfaceView); } Rect a2 = a(ShowMode.PullOut, a); View currentBottomView = getCurrentBottomView(); if (currentBottomView != null) { currentBottomView.layout(a2.left, a2.top, a2.right, a2.bottom); } } public SwipeLayout(Context context, AttributeSet attributeSet, int i) { super(context, attributeSet, i); this.b = A; this.d = 0; this.e = new LinkedHashMap<>(); this.g = new float[4]; this.h = new ArrayList(); this.i = new ArrayList(); this.j = new HashMap(); this.k = new HashMap(); this.m = true; this.n = new boolean[]{true, true, true, true}; this.o = false; this.p = new ViewDragHelper.Callback() { // from class: com.daimajia.swipe.SwipeLayout.1 boolean a = true; @Override // androidx.customview.widget.ViewDragHelper.Callback public int a(View view, int i2, int i3) { if (view == SwipeLayout.this.getSurfaceView()) { int i4 = AnonymousClass4.a[SwipeLayout.this.b.ordinal()]; if (i4 == 1 || i4 == 2) { return SwipeLayout.this.getPaddingLeft(); } if (i4 != 3) { if (i4 == 4) { if (i2 > SwipeLayout.this.getPaddingLeft()) { return SwipeLayout.this.getPaddingLeft(); } if (i2 < SwipeLayout.this.getPaddingLeft() - SwipeLayout.this.d) { return SwipeLayout.this.getPaddingLeft() - SwipeLayout.this.d; } } } else { if (i2 < SwipeLayout.this.getPaddingLeft()) { return SwipeLayout.this.getPaddingLeft(); } if (i2 > SwipeLayout.this.getPaddingLeft() + SwipeLayout.this.d) { return SwipeLayout.this.getPaddingLeft() + SwipeLayout.this.d; } } } else if (SwipeLayout.this.getCurrentBottomView() == view) { int i5 = AnonymousClass4.a[SwipeLayout.this.b.ordinal()]; if (i5 == 1 || i5 == 2) { return SwipeLayout.this.getPaddingLeft(); } if (i5 != 3) { if (i5 == 4 && SwipeLayout.this.f == ShowMode.PullOut && i2 < SwipeLayout.this.getMeasuredWidth() - SwipeLayout.this.d) { return SwipeLayout.this.getMeasuredWidth() - SwipeLayout.this.d; } } else if (SwipeLayout.this.f == ShowMode.PullOut && i2 > SwipeLayout.this.getPaddingLeft()) { return SwipeLayout.this.getPaddingLeft(); } } return i2; } @Override // androidx.customview.widget.ViewDragHelper.Callback public int b(View view, int i2, int i3) { if (view == SwipeLayout.this.getSurfaceView()) { int i4 = AnonymousClass4.a[SwipeLayout.this.b.ordinal()]; if (i4 != 1) { if (i4 != 2) { if (i4 == 3 || i4 == 4) { return SwipeLayout.this.getPaddingTop(); } } else { if (i2 < SwipeLayout.this.getPaddingTop() - SwipeLayout.this.d) { return SwipeLayout.this.getPaddingTop() - SwipeLayout.this.d; } if (i2 > SwipeLayout.this.getPaddingTop()) { return SwipeLayout.this.getPaddingTop(); } } } else { if (i2 < SwipeLayout.this.getPaddingTop()) { return SwipeLayout.this.getPaddingTop(); } if (i2 > SwipeLayout.this.getPaddingTop() + SwipeLayout.this.d) { return SwipeLayout.this.getPaddingTop() + SwipeLayout.this.d; } } } else { View surfaceView = SwipeLayout.this.getSurfaceView(); int top = surfaceView == null ? 0 : surfaceView.getTop(); int i5 = AnonymousClass4.a[SwipeLayout.this.b.ordinal()]; if (i5 != 1) { if (i5 != 2) { if (i5 == 3 || i5 == 4) { return SwipeLayout.this.getPaddingTop(); } } else if (SwipeLayout.this.f != ShowMode.PullOut) { int i6 = top + i3; if (i6 >= SwipeLayout.this.getPaddingTop()) { return SwipeLayout.this.getPaddingTop(); } if (i6 <= SwipeLayout.this.getPaddingTop() - SwipeLayout.this.d) { return SwipeLayout.this.getPaddingTop() - SwipeLayout.this.d; } } else if (i2 < SwipeLayout.this.getMeasuredHeight() - SwipeLayout.this.d) { return SwipeLayout.this.getMeasuredHeight() - SwipeLayout.this.d; } } else if (SwipeLayout.this.f != ShowMode.PullOut) { int i7 = top + i3; if (i7 < SwipeLayout.this.getPaddingTop()) { return SwipeLayout.this.getPaddingTop(); } if (i7 > SwipeLayout.this.getPaddingTop() + SwipeLayout.this.d) { return SwipeLayout.this.getPaddingTop() + SwipeLayout.this.d; } } else if (i2 > SwipeLayout.this.getPaddingTop()) { return SwipeLayout.this.getPaddingTop(); } } return i2; } @Override // androidx.customview.widget.ViewDragHelper.Callback public int a(View view) { return SwipeLayout.this.d; } @Override // androidx.customview.widget.ViewDragHelper.Callback public void a(View view, float f, float f2) { super.a(view, f, f2); Iterator it = SwipeLayout.this.h.iterator(); while (it.hasNext()) { ((SwipeListener) it.next()).a(SwipeLayout.this, f, f2); } SwipeLayout.this.a(f, f2, this.a); SwipeLayout.this.invalidate(); } @Override // androidx.customview.widget.ViewDragHelper.Callback public void a(View view, int i2, int i3, int i4, int i5) { View surfaceView = SwipeLayout.this.getSurfaceView(); if (surfaceView == null) { return; } View currentBottomView = SwipeLayout.this.getCurrentBottomView(); int left = surfaceView.getLeft(); int right = surfaceView.getRight(); int top = surfaceView.getTop(); int bottom = surfaceView.getBottom(); if (view == surfaceView) { if (SwipeLayout.this.f == ShowMode.PullOut && currentBottomView != null) { if (SwipeLayout.this.b != DragEdge.Left && SwipeLayout.this.b != DragEdge.Right) { currentBottomView.offsetTopAndBottom(i5); } else { currentBottomView.offsetLeftAndRight(i4); } } } else if (SwipeLayout.this.getBottomViews().contains(view)) { if (SwipeLayout.this.f == ShowMode.PullOut) { surfaceView.offsetLeftAndRight(i4); surfaceView.offsetTopAndBottom(i5); } else { SwipeLayout swipeLayout = SwipeLayout.this; Rect a = swipeLayout.a(swipeLayout.b); if (currentBottomView != null) { currentBottomView.layout(a.left, a.top, a.right, a.bottom); } int left2 = surfaceView.getLeft() + i4; int top2 = surfaceView.getTop() + i5; if (SwipeLayout.this.b != DragEdge.Left || left2 >= SwipeLayout.this.getPaddingLeft()) { if (SwipeLayout.this.b != DragEdge.Right || left2 <= SwipeLayout.this.getPaddingLeft()) { if (SwipeLayout.this.b != DragEdge.Top || top2 >= SwipeLayout.this.getPaddingTop()) { if (SwipeLayout.this.b == DragEdge.Bottom && top2 > SwipeLayout.this.getPaddingTop()) { top2 = SwipeLayout.this.getPaddingTop(); } } else { top2 = SwipeLayout.this.getPaddingTop(); } } else { left2 = SwipeLayout.this.getPaddingLeft(); } } else { left2 = SwipeLayout.this.getPaddingLeft(); } surfaceView.layout(left2, top2, SwipeLayout.this.getMeasuredWidth() + left2, SwipeLayout.this.getMeasuredHeight() + top2); } } SwipeLayout.this.a(left, top, right, bottom); SwipeLayout.this.b(left, top, i4, i5); SwipeLayout.this.invalidate(); } @Override // androidx.customview.widget.ViewDragHelper.Callback public boolean b(View view, int i2) { boolean z = view == SwipeLayout.this.getSurfaceView() || SwipeLayout.this.getBottomViews().contains(view); if (z) { this.a = SwipeLayout.this.getOpenStatus() == Status.Close; } return z; } @Override // androidx.customview.widget.ViewDragHelper.Callback public int b(View view) { return SwipeLayout.this.d; } }; this.q = 0; this.t = -1.0f; this.u = -1.0f; this.z = new GestureDetector(getContext(), new SwipeDetector()); this.c = ViewDragHelper.a(this, this.p); this.a = ViewConfiguration.get(context).getScaledTouchSlop(); TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.SwipeLayout); int i2 = obtainStyledAttributes.getInt(R$styleable.SwipeLayout_drag_edge, 2); this.g[DragEdge.Left.ordinal()] = obtainStyledAttributes.getDimension(R$styleable.SwipeLayout_leftEdgeSwipeOffset, 0.0f); this.g[DragEdge.Right.ordinal()] = obtainStyledAttributes.getDimension(R$styleable.SwipeLayout_rightEdgeSwipeOffset, 0.0f); this.g[DragEdge.Top.ordinal()] = obtainStyledAttributes.getDimension(R$styleable.SwipeLayout_topEdgeSwipeOffset, 0.0f); this.g[DragEdge.Bottom.ordinal()] = obtainStyledAttributes.getDimension(R$styleable.SwipeLayout_bottomEdgeSwipeOffset, 0.0f); setClickToClose(obtainStyledAttributes.getBoolean(R$styleable.SwipeLayout_clickToClose, this.o)); if ((i2 & 1) == 1) { this.e.put(DragEdge.Left, null); } if ((i2 & 4) == 4) { this.e.put(DragEdge.Top, null); } if ((i2 & 2) == 2) { this.e.put(DragEdge.Right, null); } if ((i2 & 8) == 8) { this.e.put(DragEdge.Bottom, null); } this.f = ShowMode.values()[obtainStyledAttributes.getInt(R$styleable.SwipeLayout_show_mode, ShowMode.PullOut.ordinal())]; obtainStyledAttributes.recycle(); } public void a(SwipeListener swipeListener) { this.h.add(swipeListener); } protected boolean a(View view, Rect rect, DragEdge dragEdge, int i, int i2, int i3, int i4) { int i5 = rect.left; int i6 = rect.right; int i7 = rect.top; int i8 = rect.bottom; if (getShowMode() == ShowMode.LayDown) { int i9 = AnonymousClass4.a[dragEdge.ordinal()]; return i9 != 1 ? i9 != 2 ? i9 != 3 ? i9 == 4 && i3 > i5 && i3 <= i6 : i < i6 && i >= i5 : i4 > i7 && i4 <= i8 : i2 >= i7 && i2 < i8; } if (getShowMode() != ShowMode.PullOut) { return false; } int i10 = AnonymousClass4.a[dragEdge.ordinal()]; return i10 != 1 ? i10 != 2 ? i10 != 3 ? i10 == 4 && i5 <= getWidth() && i6 > getWidth() : i6 >= getPaddingLeft() && i5 < getPaddingLeft() : i7 < getHeight() && i7 >= getPaddingTop() : i7 < getPaddingTop() && i8 >= getPaddingTop(); } @Deprecated public void setDragEdges(DragEdge... dragEdgeArr) { setDragEdges(Arrays.asList(dragEdgeArr)); } protected void b(int i, int i2, int i3, int i4) { DragEdge dragEdge = getDragEdge(); boolean z = false; if (dragEdge != DragEdge.Left ? dragEdge != DragEdge.Right ? dragEdge != DragEdge.Top ? dragEdge != DragEdge.Bottom || i4 <= 0 : i4 >= 0 : i3 <= 0 : i3 >= 0) { z = true; } a(i, i2, z); } protected Rect a(View view) { Rect rect = new Rect(view.getLeft(), view.getTop(), 0, 0); View view2 = view; while (view2.getParent() != null && view2 != getRootView() && (view2 = (View) view2.getParent()) != this) { rect.left += view2.getLeft(); rect.top += view2.getTop(); } rect.right = rect.left + view.getMeasuredWidth(); rect.bottom = rect.top + view.getMeasuredHeight(); return rect; } public boolean b() { View view = this.e.get(DragEdge.Bottom); return view != null && view.getParent() == this && view != getSurfaceView() && this.n[DragEdge.Bottom.ordinal()]; } /* JADX INFO: Access modifiers changed from: private */ public boolean b(MotionEvent motionEvent) { View surfaceView = getSurfaceView(); if (surfaceView == null) { return false; } if (this.y == null) { this.y = new Rect(); } surfaceView.getHitRect(this.y); return this.y.contains((int) motionEvent.getX(), (int) motionEvent.getY()); } protected void a(int i, int i2, boolean z) { m(); Status openStatus = getOpenStatus(); if (this.h.isEmpty()) { return; } this.q++; for (SwipeListener swipeListener : this.h) { if (this.q == 1) { if (z) { swipeListener.a(this); } else { swipeListener.b(this); } } swipeListener.a(this, i - getPaddingLeft(), i2 - getPaddingTop()); } if (openStatus == Status.Close) { Iterator it = this.h.iterator(); while (it.hasNext()) { it.next().d(this); } this.q = 0; } if (openStatus == Status.Open) { View currentBottomView = getCurrentBottomView(); if (currentBottomView != null) { currentBottomView.setEnabled(true); } Iterator it2 = this.h.iterator(); while (it2.hasNext()) { it2.next().c(this); } this.q = 0; } } public void b(boolean z, boolean z2) { View surfaceView = getSurfaceView(); View currentBottomView = getCurrentBottomView(); if (surfaceView == null) { return; } Rect a = a(true); if (z) { this.c.b(surfaceView, a.left, a.top); } else { int left = a.left - surfaceView.getLeft(); int top = a.top - surfaceView.getTop(); surfaceView.layout(a.left, a.top, a.right, a.bottom); ShowMode showMode = getShowMode(); ShowMode showMode2 = ShowMode.PullOut; if (showMode == showMode2) { Rect a2 = a(showMode2, a); if (currentBottomView != null) { currentBottomView.layout(a2.left, a2.top, a2.right, a2.bottom); } } if (z2) { a(a.left, a.top, a.right, a.bottom); b(a.left, a.top, left, top); } else { m(); } } invalidate(); } /* JADX WARN: Removed duplicated region for block: B:22:0x00f9 */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ protected void a(int r16, int r17, int r18, int r19) { /* Method dump skipped, instructions count: 362 To view this dump change 'Code comments level' option to 'DEBUG' */ throw new UnsupportedOperationException("Method not decompiled: com.daimajia.swipe.SwipeLayout.a(int, int, int, int):void"); } public void a(OnLayout onLayout) { if (this.r == null) { this.r = new ArrayList(); } this.r.add(onLayout); } /* JADX WARN: Removed duplicated region for block: B:55:0x00b7 */ /* JADX WARN: Removed duplicated region for block: B:76:0x00ea */ /* JADX WARN: Removed duplicated region for block: B:97:0x011b */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ private void a(android.view.MotionEvent r10) { /* Method dump skipped, instructions count: 328 To view this dump change 'Code comments level' option to 'DEBUG' */ throw new UnsupportedOperationException("Method not decompiled: com.daimajia.swipe.SwipeLayout.a(android.view.MotionEvent):void"); } protected void a(float f, float f2, boolean z) { float b = this.c.b(); View surfaceView = getSurfaceView(); DragEdge dragEdge = this.b; if (dragEdge == null || surfaceView == null) { return; } float f3 = z ? 0.25f : 0.75f; if (dragEdge == DragEdge.Left) { if (f > b) { i(); return; } if (f < (-b)) { a(); return; } else if ((getSurfaceView().getLeft() * 1.0f) / this.d > f3) { i(); return; } else { a(); return; } } if (dragEdge == DragEdge.Right) { if (f > b) { a(); return; } if (f < (-b)) { i(); return; } else if (((-getSurfaceView().getLeft()) * 1.0f) / this.d > f3) { i(); return; } else { a(); return; } } if (dragEdge == DragEdge.Top) { if (f2 > b) { i(); return; } if (f2 < (-b)) { a(); return; } else if ((getSurfaceView().getTop() * 1.0f) / this.d > f3) { i(); return; } else { a(); return; } } if (dragEdge == DragEdge.Bottom) { if (f2 > b) { a(); return; } if (f2 < (-b)) { i(); } else if (((-getSurfaceView().getTop()) * 1.0f) / this.d > f3) { i(); } else { a(); } } } public void a() { a(true, true); } public void a(boolean z, boolean z2) { View surfaceView = getSurfaceView(); if (surfaceView == null) { return; } if (z) { this.c.b(getSurfaceView(), getPaddingLeft(), getPaddingTop()); } else { Rect a = a(false); int left = a.left - surfaceView.getLeft(); int top = a.top - surfaceView.getTop(); surfaceView.layout(a.left, a.top, a.right, a.bottom); if (z2) { a(a.left, a.top, a.right, a.bottom); b(a.left, a.top, left, top); } else { m(); } } invalidate(); } private Rect a(boolean z) { int paddingLeft = getPaddingLeft(); int paddingTop = getPaddingTop(); if (z) { DragEdge dragEdge = this.b; if (dragEdge == DragEdge.Left) { paddingLeft = this.d + getPaddingLeft(); } else if (dragEdge == DragEdge.Right) { paddingLeft = getPaddingLeft() - this.d; } else if (dragEdge == DragEdge.Top) { paddingTop = this.d + getPaddingTop(); } else { paddingTop = getPaddingTop() - this.d; } } return new Rect(paddingLeft, paddingTop, getMeasuredWidth() + paddingLeft, getMeasuredHeight() + paddingTop); } private Rect a(ShowMode showMode, Rect rect) { View currentBottomView = getCurrentBottomView(); int i = rect.left; int i2 = rect.top; int i3 = rect.right; int i4 = rect.bottom; if (showMode == ShowMode.PullOut) { DragEdge dragEdge = this.b; if (dragEdge == DragEdge.Left) { i -= this.d; } else if (dragEdge == DragEdge.Right) { i = i3; } else { i2 = dragEdge == DragEdge.Top ? i2 - this.d : i4; } DragEdge dragEdge2 = this.b; if (dragEdge2 != DragEdge.Left && dragEdge2 != DragEdge.Right) { i4 = (currentBottomView != null ? currentBottomView.getMeasuredHeight() : 0) + i2; i3 = rect.right; } else { int i5 = rect.bottom; i3 = i + (currentBottomView != null ? currentBottomView.getMeasuredWidth() : 0); i4 = i5; } } else if (showMode == ShowMode.LayDown) { DragEdge dragEdge3 = this.b; if (dragEdge3 == DragEdge.Left) { i3 = i + this.d; } else if (dragEdge3 == DragEdge.Right) { i = i3 - this.d; } else if (dragEdge3 == DragEdge.Top) { i4 = i2 + this.d; } else { i2 = i4 - this.d; } } return new Rect(i, i2, i3, i4); } /* JADX INFO: Access modifiers changed from: private */ public Rect a(DragEdge dragEdge) { int i; int measuredHeight; int paddingLeft = getPaddingLeft(); int paddingTop = getPaddingTop(); if (dragEdge == DragEdge.Right) { paddingLeft = getMeasuredWidth() - this.d; } else if (dragEdge == DragEdge.Bottom) { paddingTop = getMeasuredHeight() - this.d; } if (dragEdge != DragEdge.Left && dragEdge != DragEdge.Right) { i = getMeasuredWidth() + paddingLeft; measuredHeight = this.d; } else { i = this.d + paddingLeft; measuredHeight = getMeasuredHeight(); } return new Rect(paddingLeft, paddingTop, i, measuredHeight + paddingTop); } private int a(float f) { return (int) ((f * getContext().getResources().getDisplayMetrics().density) + 0.5f); } }