派享便利 v1.0.3版本的 MD5 值为:1fc1776275e6607636a3a1f946b1f976

以下内容为反编译后的 g.java 源代码,内容仅作参考


package io.dcloud.common.core.ui;

import android.content.Context;
import android.graphics.Rect;
import android.os.Build;
import android.text.TextUtils;
import android.util.DisplayMetrics;
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 android.view.ViewTreeObserver;
import android.webkit.WebView;
import android.widget.AbsoluteLayout;
import android.widget.FrameLayout;
import com.alibaba.android.bindingx.core.internal.BindingXConstants;
import com.taobao.weex.common.Constants;
import com.taobao.weex.performance.WXInstanceApm;
import com.taobao.weex.ui.view.gesture.WXGesture;
import io.dcloud.common.DHInterface.IFrameView;
import io.dcloud.common.DHInterface.IMgr;
import io.dcloud.common.DHInterface.INativeView;
import io.dcloud.common.adapter.util.DragBean;
import io.dcloud.common.constant.AbsoluteConst;
import io.dcloud.common.util.BaseInfo;
import io.dcloud.common.util.Deprecated_JSUtil;
import io.dcloud.common.util.JSONUtil;
import io.dcloud.common.util.JSUtil;
import io.dcloud.common.util.PdrUtil;
import io.dcloud.common.util.StringUtil;
import io.dcloud.nineoldandroids.animation.Animator;
import io.dcloud.nineoldandroids.animation.ValueAnimator;
import io.dcloud.nineoldandroids.view.ViewHelper;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.regex.Pattern;
import org.json.JSONObject;
public class g {
    private static boolean e0 = false;
    private String A;
    private IFrameView G;
    private String H;
    private String I;
    private int J;
    private boolean K;
    private float L;
    private int M;
    private int R;
    private DisplayMetrics S;
    private float U;
    private float V;
    private float W;
    private float X;
    private float Y;
    private float Z;
    boolean b0;
    private Pattern d0;
    private VelocityTracker f;
    private int h;
    private float i;
    private float j;
    private int k;
    private io.dcloud.common.core.ui.b p;
    private io.dcloud.common.core.ui.b q;
    private View s;
    private String v;
    private String w;
    private String y;
    private String z;
    private boolean a = false;
    private boolean b = false;
    private boolean c = false;
    private boolean d = false;
    private boolean e = false;
    private boolean g = true;
    private int l = 0;
    private int m = 0;
    private int n = 0;
    private int o = 0;
    private View r = null;
    private boolean t = false;
    private int u = Integer.MAX_VALUE;
    private int x = Integer.MAX_VALUE;
    private boolean B = false;
    private boolean C = true;
    private boolean D = true;
    private boolean E = true;
    private int F = -1;
    private boolean N = false;
    private boolean O = false;
    private boolean P = false;
    private int Q = Integer.MAX_VALUE;
    private float T = 20.0f;
    boolean a0 = true;
    private String c0 = "^([1-9]|[1-9]\\d|100)$";

    public class a implements ViewTreeObserver.OnGlobalLayoutListener {
        a() {
        }

        @Override
        public void onGlobalLayout() {
            int i;
            if (Build.VERSION.SDK_INT >= 16) {
                g.this.s.getViewTreeObserver().removeOnGlobalLayoutListener(this);
            }
            g gVar = g.this;
            boolean z = true;
            if (gVar.d(gVar.I)) {
                i = g.this.o;
            } else {
                g gVar2 = g.this;
                int b = gVar2.b(gVar2.s) / 2;
                Rect rect = new Rect();
                g.this.s.getGlobalVisibleRect(rect);
                if (rect.right - rect.left >= b) {
                    i = g.this.o;
                } else {
                    z = false;
                    i = g.this.n;
                }
            }
            g gVar3 = g.this;
            int a = gVar3.a(gVar3.s);
            g gVar4 = g.this;
            ValueAnimator a2 = gVar4.a(gVar4.s, a, i, z);
            if (a2 != null) {
                a2.start();
            }
        }
    }

    public class b implements ViewTreeObserver.OnGlobalLayoutListener {
        b() {
        }

        @Override
        public void onGlobalLayout() {
            int i;
            boolean z;
            int i2;
            boolean z2;
            boolean z3;
            ValueAnimator a;
            if (Build.VERSION.SDK_INT >= 16) {
                g.this.r.getViewTreeObserver().removeOnGlobalLayoutListener(this);
            }
            g gVar = g.this;
            boolean z4 = true;
            if (gVar.d(gVar.I)) {
                i = g.this.m;
            } else {
                if (g.this.s != null) {
                    g gVar2 = g.this;
                    int b = gVar2.b(gVar2.s) / 2;
                    Rect rect = new Rect();
                    g.this.s.getGlobalVisibleRect(rect);
                    Rect rect2 = new Rect();
                    g.this.r.getGlobalVisibleRect(rect2);
                    int i3 = rect.left;
                    if (i3 != 0) {
                        if (rect.right == g.this.M) {
                            int i4 = rect.right - rect2.right;
                            if ("right".equals(g.this.I)) {
                                if (i4 <= b) {
                                    i = g.this.m;
                                } else {
                                    i = g.this.l;
                                    z = false;
                                }
                            } else if ("left".equals(g.this.I)) {
                                if (i4 >= b) {
                                    i = g.this.m;
                                } else {
                                    i = g.this.l;
                                    z = false;
                                }
                            }
                        }
                        i = 0;
                        z = false;
                    } else {
                        int i5 = rect2.left - i3;
                        if (!"right".equals(g.this.I)) {
                            if ("left".equals(g.this.I)) {
                                if (i5 <= b) {
                                    i = g.this.m;
                                } else {
                                    i = g.this.l;
                                    z = false;
                                }
                            }
                            i = 0;
                            z = false;
                        } else if (i5 >= b) {
                            i = g.this.m;
                        } else {
                            i = g.this.l;
                            z = false;
                        }
                    }
                } else {
                    Rect rect3 = new Rect();
                    g.this.r.getGlobalVisibleRect(rect3);
                    int i6 = rect3.right - rect3.left;
                    int width = g.this.r.getWidth() / 2;
                    if (!"right".equals(g.this.I) || g.this.l >= 0) {
                        if (!"left".equals(g.this.I) || g.this.m < 0) {
                            if (i6 <= width) {
                                i = g.this.m;
                            } else {
                                i = g.this.l;
                                z = false;
                            }
                        } else if (i6 >= width) {
                            i = g.this.m;
                        } else {
                            i = g.this.l;
                            z = false;
                        }
                    } else if (i6 >= width) {
                        i = g.this.m;
                    } else {
                        i = g.this.l;
                        z = false;
                    }
                }
                if (g.this.s != null) {
                    Rect rect4 = new Rect();
                    g.this.s.getGlobalVisibleRect(rect4);
                    if (rect4.left != 0) {
                    }
                    if ("bounce".equalsIgnoreCase(g.this.A)) {
                        int i7 = g.this.l;
                        g.this.A = null;
                        i2 = i7;
                        z3 = false;
                        z2 = false;
                    } else {
                        i2 = i;
                        z2 = z4;
                        z3 = z;
                    }
                    g gVar3 = g.this;
                    int a2 = gVar3.a(gVar3.r);
                    g gVar4 = g.this;
                    a = gVar4.a(gVar4.r, a2, i2, z3, z2);
                    if (a != null) {
                        a.start();
                        return;
                    }
                    return;
                }
                z4 = false;
                if ("bounce".equalsIgnoreCase(g.this.A)) {
                }
                g gVar32 = g.this;
                int a22 = gVar32.a(gVar32.r);
                g gVar42 = g.this;
                a = gVar42.a(gVar42.r, a22, i2, z3, z2);
                if (a != null) {
                }
            }
            z = true;
            if (g.this.s != null) {
            }
            z4 = false;
            if ("bounce".equalsIgnoreCase(g.this.A)) {
            }
            g gVar322 = g.this;
            int a222 = gVar322.a(gVar322.r);
            g gVar422 = g.this;
            a = gVar422.a(gVar422.r, a222, i2, z3, z2);
            if (a != null) {
            }
        }
    }

    public class c implements ViewTreeObserver.OnGlobalLayoutListener {
        c() {
        }

        @Override
        public void onGlobalLayout() {
            int i;
            int i2;
            int i3;
            int i4;
            int i5;
            ValueAnimator a;
            if (Build.VERSION.SDK_INT >= 16) {
                g.this.r.getViewTreeObserver().removeOnGlobalLayoutListener(this);
            }
            g gVar = g.this;
            boolean z = true;
            int i6 = 0;
            if (gVar.d(gVar.I)) {
                int i7 = g.this.m;
                int i8 = g.this.o;
                if ("bounce".equalsIgnoreCase(g.this.A)) {
                    i4 = g.this.l;
                    i5 = g.this.n;
                    g.this.A = null;
                    z = false;
                    i6 = i4;
                    i3 = i5;
                    g gVar2 = g.this;
                    int a2 = gVar2.a(gVar2.r);
                    g gVar3 = g.this;
                    a = gVar3.a(gVar3.r, a2, i6, z);
                    if (a != null) {
                        a.start();
                    }
                    g gVar4 = g.this;
                    int a3 = gVar4.a(gVar4.s);
                    if (g.this.s == null) {
                        g gVar5 = g.this;
                        ValueAnimator a4 = gVar5.a(gVar5.s, a3, i3, z);
                        if (a4 != null) {
                            a4.start();
                            return;
                        }
                        return;
                    }
                    return;
                }
                i6 = i7;
                i3 = i8;
                g gVar22 = g.this;
                int a22 = gVar22.a(gVar22.r);
                g gVar32 = g.this;
                a = gVar32.a(gVar32.r, a22, i6, z);
                if (a != null) {
                }
                g gVar42 = g.this;
                int a32 = gVar42.a(gVar42.s);
                if (g.this.s == null) {
                }
            } else if ("bounce".equalsIgnoreCase(g.this.A)) {
                i4 = g.this.l;
                i5 = g.this.n;
                g.this.A = null;
                z = false;
                i6 = i4;
                i3 = i5;
                g gVar222 = g.this;
                int a222 = gVar222.a(gVar222.r);
                g gVar322 = g.this;
                a = gVar322.a(gVar322.r, a222, i6, z);
                if (a != null) {
                }
                g gVar422 = g.this;
                int a322 = gVar422.a(gVar422.s);
                if (g.this.s == null) {
                }
            } else {
                int i9 = g.this.M;
                g gVar6 = g.this;
                int a5 = gVar6.a(gVar6.s);
                g gVar7 = g.this;
                int b = gVar7.b(gVar7.s) + a5;
                g gVar8 = g.this;
                gVar8.a(gVar8.r);
                g.this.r.getWidth();
                if (g.this.r.getWidth() >= g.this.M) {
                    if (a5 <= 0 && b > 0) {
                        int i10 = b - 0;
                        if (i10 > 0) {
                            g gVar9 = g.this;
                            if (i10 < gVar9.b(gVar9.s)) {
                                g gVar10 = g.this;
                                if (i10 >= gVar10.b(gVar10.s) / 2) {
                                    i6 = g.this.m;
                                    i3 = g.this.o;
                                } else {
                                    i = g.this.l;
                                    i2 = g.this.n;
                                    z = false;
                                    i6 = i;
                                    i3 = i2;
                                }
                            }
                        }
                        g gVar11 = g.this;
                        if (i10 == gVar11.b(gVar11.s)) {
                            g.this.b(true);
                            g gVar12 = g.this;
                            gVar12.a(gVar12.r, g.this.m);
                            g gVar13 = g.this;
                            gVar13.a(gVar13.s, g.this.o);
                            boolean unused = g.e0 = false;
                            return;
                        }
                        g.this.b(false);
                        g gVar14 = g.this;
                        gVar14.a(gVar14.r, g.this.l);
                        g gVar15 = g.this;
                        gVar15.a(gVar15.s, g.this.n);
                        boolean unused2 = g.e0 = false;
                        return;
                    } else if (a5 >= i9 || i9 > b) {
                        g.this.b(false);
                        g gVar16 = g.this;
                        gVar16.a(gVar16.r, g.this.l);
                        g gVar17 = g.this;
                        gVar17.a(gVar17.s, g.this.n);
                        boolean unused3 = g.e0 = false;
                        return;
                    } else {
                        int i11 = i9 - a5;
                        if (i11 > 0) {
                            g gVar18 = g.this;
                            if (i11 < gVar18.b(gVar18.s)) {
                                g gVar19 = g.this;
                                if (i11 >= gVar19.b(gVar19.s) / 2) {
                                    i6 = g.this.m;
                                    i3 = g.this.o;
                                } else {
                                    i = g.this.l;
                                    i2 = g.this.n;
                                    z = false;
                                    i6 = i;
                                    i3 = i2;
                                }
                            }
                        }
                        g gVar20 = g.this;
                        if (i11 == gVar20.b(gVar20.s)) {
                            g.this.b(true);
                            g gVar21 = g.this;
                            gVar21.a(gVar21.r, g.this.m);
                            g gVar23 = g.this;
                            gVar23.a(gVar23.s, g.this.o);
                            boolean unused4 = g.e0 = false;
                            return;
                        }
                        g.this.b(false);
                        g gVar24 = g.this;
                        gVar24.a(gVar24.r, g.this.l);
                        g gVar25 = g.this;
                        gVar25.a(gVar25.s, g.this.n);
                        boolean unused5 = g.e0 = false;
                        return;
                    }
                }
                Rect rect = new Rect();
                g.this.r.getGlobalVisibleRect(rect);
                int i12 = rect.right - rect.left;
                int width = g.this.r.getWidth() / 2;
                if (rect.left == 0) {
                    if (i12 <= width) {
                        i6 = g.this.m;
                        i3 = g.this.o;
                    } else {
                        i = g.this.l;
                        i2 = g.this.n;
                        z = false;
                        i6 = i;
                        i3 = i2;
                    }
                } else if (g.this.M != rect.right) {
                    i3 = 0;
                    z = false;
                } else if (i12 <= width) {
                    i6 = g.this.m;
                    i3 = g.this.o;
                } else {
                    i = g.this.l;
                    i2 = g.this.n;
                    z = false;
                    i6 = i;
                    i3 = i2;
                }
                g gVar2222 = g.this;
                int a2222 = gVar2222.a(gVar2222.r);
                g gVar3222 = g.this;
                a = gVar3222.a(gVar3222.r, a2222, i6, z);
                if (a != null) {
                }
                g gVar4222 = g.this;
                int a3222 = gVar4222.a(gVar4222.s);
                if (g.this.s == null) {
                }
            }
        }
    }

    public class d implements Animator.AnimatorListener {
        final boolean a;
        final boolean b;
        final View c;
        final int d;

        d(boolean z, boolean z2, View view, int i) {
            this.a = z;
            this.b = z2;
            this.c = view;
            this.d = i;
        }

        @Override
        public void onAnimationCancel(Animator animator) {
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            io.dcloud.common.core.ui.b bVar;
            String str;
            if (g.this.N) {
                g.this.N = false;
                g gVar = g.this;
                boolean z = this.a;
                gVar.a("end", z, this.b, z ? "100" : WXInstanceApm.VALUE_ERROR_CODE_DEFAULT);
            }
            if (this.a) {
                if (this.c == g.this.r && g.this.p != null) {
                    g gVar2 = g.this;
                    int a = gVar2.a(gVar2.r);
                    if (a <= (-g.this.r.getWidth()) || a >= g.this.M) {
                        g.this.p.popFromViewStack();
                    }
                }
            } else if (this.c == g.this.s) {
                g gVar3 = g.this;
                int a2 = gVar3.a(gVar3.s);
                if (a2 <= (-g.this.M) || a2 >= g.this.M) {
                    if (Integer.MAX_VALUE != g.this.Q && g.this.Q != a2) {
                        g gVar4 = g.this;
                        gVar4.b(gVar4.s, g.this.Q);
                    }
                    g.this.Q = Integer.MAX_VALUE;
                }
                if (!(this.c instanceof INativeView) && g.this.q != null) {
                    g gVar5 = g.this;
                    int a3 = gVar5.a(gVar5.s);
                    g gVar6 = g.this;
                    if (a3 <= (-gVar6.b(gVar6.s)) || a3 >= g.this.M) {
                        g.this.q.popFromViewStack();
                    }
                }
            }
            g.this.a(this.c, this.d);
            View view = this.c;
            if (view != null) {
                if (!this.b) {
                    if (view == g.this.r) {
                        bVar = g.this.p;
                        str = this.a ? g.this.v : g.this.w;
                    } else if (this.c == g.this.s) {
                        bVar = g.this.q;
                        str = this.a ? g.this.y : g.this.z;
                    }
                    if (!"hide".equalsIgnoreCase(str) || AbsoluteConst.EVENTS_CLOSE.equalsIgnoreCase(str)) {
                        View view2 = this.c;
                        if (view2 instanceof INativeView) {
                            String viewId = ((INativeView) view2).getViewId();
                            String viewUUId = ((INativeView) this.c).getViewUUId();
                            if (str.equalsIgnoreCase(AbsoluteConst.EVENTS_CLOSE)) {
                                str = "view_close";
                            }
                            g.this.p.obtainWindowMgr().processEvent(IMgr.MgrType.FeatureMgr, 1, new Object[]{g.this.p.obtainWebView(), "nativeobj", str, JSONUtil.createJSONArray("['" + viewId + "','" + viewUUId + "']")});
                        } else if (bVar != null) {
                            bVar.obtainWindowMgr().processEvent(IMgr.MgrType.FeatureMgr, 1, new Object[]{bVar.obtainWebView(), AbsoluteConst.F_UI, "execMethod", JSONUtil.createJSONArray("[\"NWindow\",\"" + str + "\",[\"" + bVar.obtainWebView().getWebviewUUID() + "\",[null,null,null]]]")});
                        }
                    }
                }
                bVar = null;
                str = null;
                if (!"hide".equalsIgnoreCase(str) || AbsoluteConst.EVENTS_CLOSE.equalsIgnoreCase(str)) {
                }
            }
            if (g.this.R <= 1) {
                boolean unused = g.e0 = false;
                g.this.s = null;
            }
            if (g.this.R >= 1) {
                g.h(g.this);
            }
        }

        @Override
        public void onAnimationRepeat(Animator animator) {
        }

        @Override
        public void onAnimationStart(Animator animator) {
            g.g(g.this);
        }
    }

    public class e implements ValueAnimator.AnimatorUpdateListener {
        final View a;

        e(View view) {
            this.a = view;
        }

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            ViewGroup.LayoutParams layoutParams = this.a.getLayoutParams();
            View view = this.a;
            if (view instanceof INativeView) {
                g.this.b(view, ((Integer) valueAnimator.getAnimatedValue()).intValue());
                this.a.requestLayout();
                this.a.invalidate();
            } else if (layoutParams instanceof FrameLayout.LayoutParams) {
                ViewHelper.setX(view, ((Float) valueAnimator.getAnimatedValue()).floatValue());
            } else if (layoutParams instanceof AbsoluteLayout.LayoutParams) {
                try {
                    ViewHelper.setX(this.a, ((Integer) valueAnimator.getAnimatedValue()).intValue());
                } catch (Exception unused) {
                    ViewHelper.setX(this.a, ((Float) valueAnimator.getAnimatedValue()).floatValue());
                }
                this.a.requestLayout();
            }
        }
    }

    public class f implements ViewTreeObserver.OnGlobalLayoutListener {
        f() {
        }

        @Override
        public void onGlobalLayout() {
            int i;
            int b;
            int b2;
            int a;
            ValueAnimator a2;
            if (Build.VERSION.SDK_INT >= 16) {
                g.this.r.getViewTreeObserver().removeOnGlobalLayoutListener(this);
            }
            g gVar = g.this;
            boolean z = true;
            if (gVar.d(gVar.I)) {
                if ("right".equals(g.this.I)) {
                    b = g.this.M;
                } else if ("left".equals(g.this.I)) {
                    g gVar2 = g.this;
                    b2 = gVar2.b(gVar2.s);
                    b = -b2;
                } else {
                    b = 0;
                    i = 0;
                    g gVar3 = g.this;
                    a = gVar3.a(gVar3.r);
                    if (a != 0) {
                        g gVar4 = g.this;
                        ValueAnimator a3 = gVar4.a(gVar4.r, a, i, z, true);
                        if (a3 != null) {
                            a3.start();
                        }
                    }
                    g gVar5 = g.this;
                    int a4 = gVar5.a(gVar5.s);
                    g gVar6 = g.this;
                    a2 = gVar6.a(gVar6.s, a4, b, z, true);
                    if (a2 != null) {
                        a2.start();
                        return;
                    }
                    return;
                }
            } else {
                View view = (View) g.this.r.getParent();
                int[] iArr = new int[2];
                int[] iArr2 = new int[2];
                int[] iArr3 = new int[2];
                view.getLocationOnScreen(iArr);
                g.this.r.getLocationOnScreen(iArr2);
                g.this.s.getLocationOnScreen(iArr3);
                int width = iArr[0] + view.getWidth();
                int i2 = iArr2[0];
                g.this.r.getWidth();
                int i3 = iArr3[0];
                g gVar7 = g.this;
                int b3 = i3 + gVar7.b(gVar7.s);
                if (iArr3[0] <= iArr[0] && iArr[0] < b3) {
                    int i4 = b3 - iArr[0];
                    if (i4 > 0) {
                        g gVar8 = g.this;
                        if (i4 < gVar8.b(gVar8.s)) {
                            g gVar9 = g.this;
                            if (i4 <= gVar9.b(gVar9.s) / 2) {
                                g gVar10 = g.this;
                                b2 = gVar10.b(gVar10.s);
                                b = -b2;
                            } else {
                                g gVar11 = g.this;
                                i = gVar11.b(gVar11.s);
                                b = 0;
                                z = false;
                            }
                        }
                    }
                    g gVar12 = g.this;
                    if (i4 == gVar12.b(gVar12.s)) {
                        g.this.a(false, true);
                        g gVar13 = g.this;
                        View view2 = gVar13.r;
                        g gVar14 = g.this;
                        gVar13.a(view2, gVar14.b(gVar14.s));
                        g gVar15 = g.this;
                        gVar15.a(gVar15.s, 0);
                        boolean unused = g.e0 = false;
                        return;
                    }
                    g.this.a(true, true);
                    g gVar16 = g.this;
                    gVar16.a(gVar16.r, 0);
                    g gVar17 = g.this;
                    View view3 = gVar17.s;
                    g gVar18 = g.this;
                    gVar17.a(view3, -gVar18.b(gVar18.s));
                    boolean unused2 = g.e0 = false;
                    return;
                } else if (iArr3[0] >= width || width > b3) {
                    g.this.a(true, true);
                    g gVar19 = g.this;
                    gVar19.a(gVar19.r, 0);
                    g gVar20 = g.this;
                    gVar20.a(gVar20.s, g.this.M);
                    boolean unused3 = g.e0 = false;
                    return;
                } else {
                    int i5 = width - iArr3[0];
                    if (i5 > 0) {
                        g gVar21 = g.this;
                        if (i5 < gVar21.b(gVar21.s)) {
                            g gVar22 = g.this;
                            if (i5 <= gVar22.b(gVar22.s) / 2) {
                                b = g.this.M;
                            } else {
                                g gVar23 = g.this;
                                int i6 = g.this.M;
                                g gVar24 = g.this;
                                i = -gVar23.b(gVar23.s);
                                b = i6 - gVar24.b(gVar24.s);
                                z = false;
                            }
                        }
                    }
                    g gVar25 = g.this;
                    if (i5 == gVar25.b(gVar25.s)) {
                        g.this.a(false, true);
                        g gVar26 = g.this;
                        View view4 = gVar26.r;
                        g gVar27 = g.this;
                        gVar26.a(view4, -gVar27.b(gVar27.s));
                        g gVar28 = g.this;
                        View view5 = gVar28.s;
                        int i7 = g.this.M;
                        g gVar29 = g.this;
                        gVar28.a(view5, i7 - gVar29.b(gVar29.s));
                        boolean unused4 = g.e0 = false;
                        return;
                    }
                    g.this.a(true, true);
                    g gVar30 = g.this;
                    gVar30.a(gVar30.r, 0);
                    g gVar31 = g.this;
                    gVar31.a(gVar31.s, g.this.M);
                    boolean unused5 = g.e0 = false;
                    return;
                }
                g gVar32 = g.this;
                a = gVar32.a(gVar32.r);
                if (a != 0) {
                }
                g gVar52 = g.this;
                int a42 = gVar52.a(gVar52.s);
                g gVar62 = g.this;
                a2 = gVar62.a(gVar62.s, a42, b, z, true);
                if (a2 != null) {
                }
            }
            i = 0;
            g gVar322 = g.this;
            a = gVar322.a(gVar322.r);
            if (a != 0) {
            }
            g gVar522 = g.this;
            int a422 = gVar522.a(gVar522.s);
            g gVar622 = g.this;
            a2 = gVar622.a(gVar622.s, a422, b, z, true);
            if (a2 != null) {
            }
        }
    }

    public g(IFrameView iFrameView, Context context) {
        this.R = 0;
        e0 = false;
        this.R = 0;
        if (iFrameView instanceof io.dcloud.common.core.ui.b) {
            this.p = (io.dcloud.common.core.ui.b) iFrameView;
            if (this.S == null) {
                DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
                this.S = displayMetrics;
                this.M = displayMetrics.widthPixels;
            }
        }
        this.h = ViewConfiguration.get(context).getScaledTouchSlop();
        this.d0 = Pattern.compile(this.c0);
    }

    static int g(g gVar) {
        int i = gVar.R;
        gVar.R = i + 1;
        return i;
    }

    static int h(g gVar) {
        int i = gVar.R;
        gVar.R = i - 1;
        return i;
    }

    private boolean d(MotionEvent motionEvent) {
        int i;
        float rawX = motionEvent.getRawX();
        int action = motionEvent.getAction();
        if (action != 1) {
            if (action == 2) {
                this.i = rawX;
                float a2 = a((int) (rawX - this.i));
                float a3 = a(this.r) + a2;
                float a4 = a2 + a(this.s);
                if ("right".equals(this.I)) {
                    int i2 = this.m;
                    if (a3 < i2) {
                        i2 = this.l;
                    }
                    a3 = i2;
                    i = this.o;
                    if (a4 < i) {
                        i = this.n;
                    }
                    a4 = i;
                    b(this.r, (int) a3);
                    b(this.s, (int) a4);
                } else {
                    if ("left".equals(this.I)) {
                        int i3 = this.l;
                        if (a3 < i3) {
                            i3 = this.m;
                        }
                        a3 = i3;
                        i = this.n;
                        if (a4 < i) {
                            i = this.o;
                        }
                        a4 = i;
                    }
                    b(this.r, (int) a3);
                    b(this.s, (int) a4);
                }
            }
            return true;
        }
        this.g = false;
        if (this.E) {
            a();
        }
        return false;
    }

    private boolean f(MotionEvent motionEvent) {
        int i;
        float rawX = motionEvent.getRawX();
        int action = motionEvent.getAction();
        if (action != 1) {
            if (action == 2) {
                float f2 = rawX - this.i;
                this.i = rawX;
                float a2 = a(this.s) + f2;
                if ("right".equals(this.I)) {
                    i = this.o;
                    if (a2 <= i) {
                        i = this.n;
                    }
                    a2 = i;
                    b(this.s, (int) a2);
                } else {
                    if ("left".equals(this.I)) {
                        i = this.n;
                        if (a2 <= i) {
                            i = this.o;
                        }
                        a2 = i;
                    }
                    b(this.s, (int) a2);
                }
            }
            return true;
        }
        this.g = false;
        if (this.E) {
            c();
        }
        return false;
    }

    private boolean g(MotionEvent motionEvent) {
        int i;
        float rawX = motionEvent.getRawX();
        int action = motionEvent.getAction();
        if (action != 1) {
            if (action == 2) {
                this.i = rawX;
                float a2 = a(this.r) + a(rawX - this.i);
                if ("right".equals(this.I)) {
                    i = this.m;
                    if (a2 <= i) {
                        i = this.l;
                    }
                    a2 = i;
                    b(this.r, (int) a2);
                } else {
                    if ("left".equals(this.I)) {
                        i = this.l;
                        if (a2 <= i) {
                            i = this.m;
                        }
                        a2 = i;
                    }
                    b(this.r, (int) a2);
                }
            }
            return true;
        }
        this.g = false;
        if (this.E) {
            d();
        }
        return false;
    }

    private boolean h() {
        this.l = a(this.r);
        if ("right".equals(this.I)) {
            int i = this.u;
            if (Integer.MAX_VALUE != i) {
                this.m = i;
                return this.l != i;
            }
            this.m = this.M;
            View view = this.s;
            if (view != null) {
                if ("bounce".equalsIgnoreCase(this.A)) {
                    this.m = this.l + (b(this.r) / 2);
                    return true;
                } else if (b(this.s) < this.M) {
                    int a2 = a(this.r);
                    int a3 = a(this.s);
                    int a4 = a(this.s) + b(this.s);
                    if (a3 == 0 && a4 == a2) {
                        return false;
                    }
                    boolean z = this.D;
                    if (!z && a3 == 0) {
                        this.m = b(this.s);
                        return true;
                    } else if (z && a4 == 0) {
                        this.m = b(this.s);
                        return true;
                    } else if (this.M == a4) {
                        this.m = 0;
                        return true;
                    } else {
                        return true;
                    }
                } else {
                    return true;
                }
            } else if (view != null || this.l >= 0) {
                return true;
            } else {
                this.m = 0;
                return true;
            }
        } else if ("left".equals(this.I)) {
            int i2 = this.u;
            if (Integer.MAX_VALUE != i2) {
                this.m = i2;
                return this.l != i2;
            }
            this.m = -b(this.r);
            View view2 = this.s;
            if (view2 != null) {
                if ("bounce".equalsIgnoreCase(this.A)) {
                    this.m = this.l - (b(this.r) / 2);
                    return true;
                } else if (b(this.s) < this.M) {
                    int a5 = a(this.r) + b(this.r);
                    int a6 = a(this.s);
                    int a7 = a(this.s) + b(this.s);
                    int i3 = this.M;
                    if (i3 == a7 && a6 == a5) {
                        return false;
                    }
                    boolean z2 = this.D;
                    if (!z2 && i3 == a7) {
                        this.m = -b(this.s);
                        return true;
                    } else if (z2 && i3 == a6) {
                        this.m = -b(this.s);
                        return true;
                    } else if (a6 == 0) {
                        this.m = 0;
                        return true;
                    } else {
                        return true;
                    }
                } else {
                    return true;
                }
            } else if (view2 != null || this.l <= 0) {
                return true;
            } else {
                this.m = 0;
                return true;
            }
        } else {
            return true;
        }
    }

    private void i() {
        float f2 = this.l;
        this.U = f2;
        float f3 = this.m;
        this.V = f3;
        this.X = f2;
        this.W = f2;
        float abs = Math.abs(f3 - f2);
        this.Y = abs;
        this.Z = (abs * this.T) / 100.0f;
        this.a0 = true;
        this.b0 = false;
    }

    private boolean j() {
        return "right".equals(this.I) ? a(this.s) != 0 : ("left".equals(this.I) && a(this.s) + b(this.s) == this.M) ? false : true;
    }

    private void k() {
        float a2 = a(this.r);
        this.X = a2;
        if (this.a0) {
            float f2 = this.U;
            if (a2 == f2) {
                this.b0 = true;
                this.a0 = false;
                this.W = f2;
                a(WXGesture.MOVE, false, WXInstanceApm.VALUE_ERROR_CODE_DEFAULT);
                return;
            }
        }
        if (Math.abs(a2 - this.W) >= this.Z) {
            this.a0 = true;
            this.b0 = true;
            a(WXGesture.MOVE, false, "" + ((int) ((Math.abs(this.X - this.U) / this.Y) * 100.0f)));
            this.W = this.X;
        } else if (this.b0) {
            float f3 = this.X;
            float f4 = this.V;
            if (f3 == f4) {
                this.b0 = false;
                this.a0 = true;
                this.W = f4;
                a(WXGesture.MOVE, false, "100");
            }
        }
    }

    public HashMap<String, DragBean> e() {
        io.dcloud.common.core.ui.b bVar = this.p;
        if (bVar == null || bVar.obtainFrameOptions() == null) {
            return null;
        }
        return this.p.obtainFrameOptions().dragData;
    }

    public void c(boolean z) {
        this.a = z;
    }

    public boolean c(MotionEvent motionEvent) {
        View view;
        View view2;
        if (this.g) {
            if (motionEvent.getPointerCount() > 1) {
                return true;
            }
            if (BaseInfo.sDoingAnimation) {
                if (this.P) {
                    return false;
                }
                this.P = true;
                motionEvent.setAction(3);
            }
            if (!this.a || this.g) {
                if (this.f == null) {
                    this.f = VelocityTracker.obtain();
                }
                if (this.F == -1 || e0) {
                    return false;
                }
                if (2 == motionEvent.getAction()) {
                    k();
                    if ("left".equals(this.I)) {
                        if (motionEvent.getRawX() < this.i) {
                            this.f.addMovement(motionEvent);
                        }
                    } else if ("right".equals(this.I) && motionEvent.getRawX() > this.i) {
                        this.f.addMovement(motionEvent);
                    }
                }
                if (1 == motionEvent.getAction() || 3 == motionEvent.getAction()) {
                    this.f.addMovement(motionEvent);
                }
                if (this.O) {
                    return e(motionEvent);
                }
                boolean z = this.B;
                if (z && this.C && this.D) {
                    if ((!a(this.p) && !a(this.q)) || ((view2 = this.s) != null && (view2 instanceof INativeView))) {
                        return d(motionEvent);
                    }
                } else if (z && !this.C && this.D) {
                    if ((!a(this.p) && !a(this.q)) || ((view = this.s) != null && (view instanceof INativeView))) {
                        return f(motionEvent);
                    }
                } else if (z && !this.D && this.C) {
                    if (!a(this.p) && !a(this.q)) {
                        return g(motionEvent);
                    }
                } else if (!z && this.C && !a(this.p)) {
                    return g(motionEvent);
                }
                return true;
            }
            return true;
        }
        return false;
    }

    private boolean e(String str) {
        String string;
        JSONObject jSONObject;
        JSONObject jSONObject2;
        boolean z;
        this.r = this.p.obtainMainView();
        this.u = Integer.MAX_VALUE;
        this.v = null;
        this.w = null;
        HashMap<String, DragBean> e2 = e();
        if (e2 == null || !e2.containsKey(str)) {
            return false;
        }
        DragBean dragBean = e2.get(str);
        if (dragBean != null) {
            this.H = dragBean.dragCbId;
            this.G = dragBean.dragCallBackWebView;
            JSONObject jSONObject3 = dragBean.dragCurrentViewOp;
            try {
                JSONUtil.getString(jSONObject3, "direction");
                if (jSONObject3.has("moveMode")) {
                    String string2 = JSONUtil.getString(jSONObject3, "moveMode");
                    this.A = string2;
                    if (!"followFinger".equalsIgnoreCase(string2) && !"follow".equalsIgnoreCase(this.A) && !"bounce".equalsIgnoreCase(this.A)) {
                        z = false;
                        this.C = z;
                    }
                    z = true;
                    this.C = z;
                }
                this.T = 20.0f;
                if (jSONObject3.has("callbackStep")) {
                    try {
                        if (this.d0.matcher(jSONObject3.getString("callbackStep")).find()) {
                            this.T = Integer.valueOf(string).intValue();
                        }
                    } catch (Exception e3) {
                        e3.printStackTrace();
                    }
                }
                if (jSONObject3.has("over") && (jSONObject2 = JSONUtil.getJSONObject(jSONObject3, "over")) != null) {
                    if (jSONObject2.has("left")) {
                        this.u = PdrUtil.parseInt(JSONUtil.getString(jSONObject2, "left"), this.M, Integer.MAX_VALUE);
                    }
                    if (jSONObject2.has("action")) {
                        this.v = JSONUtil.getString(jSONObject2, "action");
                    }
                }
                if (jSONObject3.has(BindingXConstants.STATE_CANCEL) && (jSONObject = JSONUtil.getJSONObject(jSONObject3, BindingXConstants.STATE_CANCEL)) != null) {
                    if (jSONObject.has("left")) {
                        PdrUtil.parseInt(JSONUtil.getString(jSONObject, "left"), this.M, Integer.MAX_VALUE);
                    }
                    if (jSONObject.has("action")) {
                        this.w = JSONUtil.getString(jSONObject, "action");
                    }
                }
            } catch (Exception e4) {
                e4.printStackTrace();
                return false;
            }
        }
        return true;
    }

    public void b(MotionEvent motionEvent) {
        DisplayMetrics displayMetrics = this.S;
        if (displayMetrics != null) {
            this.M = displayMetrics.widthPixels;
        }
        this.L = motionEvent.getRawX();
        this.i = motionEvent.getRawX();
        this.j = motionEvent.getRawY();
        this.g = false;
        this.B = false;
        this.t = false;
        this.P = false;
        this.F = -1;
        this.p.obtainWebView().loadUrl("javascript:window.__needNotifyNative__=true;");
        this.p.obtainWebView().setWebviewProperty("needTouchEvent", AbsoluteConst.FALSE);
        this.K = false;
        this.J = this.p.obtainWebView().obtainWindowView().getScrollY();
        if (this.f == null) {
            this.f = VelocityTracker.obtain();
        }
        this.f.addMovement(motionEvent);
    }

    public boolean a(MotionEvent motionEvent) {
        View view;
        View view2;
        if (this.a) {
            return true;
        }
        if (e() != null && !BaseInfo.sDoingAnimation && !e0) {
            int actionMasked = motionEvent.getActionMasked();
            float rawX = motionEvent.getRawX();
            float rawY = motionEvent.getRawY();
            if (actionMasked != 0 || motionEvent.getEdgeFlags() == 0) {
                if (actionMasked == 0) {
                    b(motionEvent);
                } else if (actionMasked == 1) {
                    this.t = false;
                    this.F = -1;
                } else if (actionMasked == 2) {
                    if (this.J != this.p.obtainWebView().obtainWindowView().getScrollY()) {
                        this.K = true;
                    }
                    if (this.K) {
                        return false;
                    }
                    float f2 = rawX - this.i;
                    if (Math.abs(f2) >= Math.abs(rawY - this.j)) {
                        if (((float) (this.h * 3)) <= Math.abs(motionEvent.getRawX() - this.L) && AbsoluteConst.FALSE.equals(this.p.obtainWebView().getWebviewProperty("needTouchEvent"))) {
                            int i = (f2 > 0.0f ? 1 : (f2 == 0.0f ? 0 : -1));
                            String str = "right";
                            if (i >= 0) {
                                if (!this.t && e("right")) {
                                    this.I = "right";
                                    this.g = true;
                                    this.t = true;
                                }
                            } else {
                                if (!this.t && e("left")) {
                                    this.I = "left";
                                    this.g = true;
                                    this.t = true;
                                }
                                str = "left";
                            }
                            if (-1 == this.F) {
                                this.i = rawX;
                                View a2 = a(str);
                                if (a2 != null) {
                                    HashMap<String, DragBean> e2 = e();
                                    String c2 = c(str);
                                    if (e2 != null && e2.containsKey(c2)) {
                                        a(e2.get(c2).dragBindViewOp);
                                    }
                                    this.I = str;
                                    this.g = true;
                                    this.s = a2;
                                    this.O = true;
                                    this.F = 1;
                                } else {
                                    b(this.I);
                                }
                            }
                        }
                    }
                }
                if (this.g) {
                    if (this.O) {
                        this.g = j();
                    } else {
                        boolean z = this.B;
                        if (z && this.C && this.D) {
                            if ((!a(this.p) && !a(this.q)) || ((view2 = this.s) != null && (view2 instanceof INativeView))) {
                                this.g = g();
                            }
                        } else if (z && !this.C && this.D) {
                            if ((!a(this.p) && !a(this.q)) || ((view = this.s) != null && (view instanceof INativeView))) {
                                this.g = f();
                            }
                        } else if (!z && this.C) {
                            if (!a(this.p)) {
                                h();
                            }
                        } else if (z && !this.D && this.C) {
                            if (!a(this.p) && !a(this.q)) {
                                this.g = h();
                            }
                        } else {
                            this.g = false;
                        }
                    }
                }
                if (this.g) {
                    if (!a(this.p)) {
                        this.b = this.p.obtainWebView().obtainWindowView().isVerticalScrollBarEnabled();
                        this.c = this.p.obtainWebView().obtainWindowView().isHorizontalScrollBarEnabled();
                        this.p.obtainWebView().obtainWindowView().setVerticalScrollBarEnabled(false);
                        this.p.obtainWebView().obtainWindowView().setHorizontalScrollBarEnabled(false);
                    }
                    View view3 = this.s;
                    if (view3 != null && (view3 instanceof com.dcloud.android.widget.AbsoluteLayout)) {
                        ((com.dcloud.android.widget.AbsoluteLayout) view3).getDrag().c(true);
                        if (!a(this.q)) {
                            this.d = this.q.obtainWebView().obtainWindowView().isVerticalScrollBarEnabled();
                            this.e = this.q.obtainWebView().obtainWindowView().isHorizontalScrollBarEnabled();
                            this.q.obtainWebView().obtainWindowView().setVerticalScrollBarEnabled(false);
                            this.q.obtainWebView().obtainWindowView().setHorizontalScrollBarEnabled(false);
                        }
                    }
                    a("start", false, WXInstanceApm.VALUE_ERROR_CODE_DEFAULT);
                    i();
                }
                return this.g;
            }
            return false;
        }
        this.g = false;
        return false;
    }

    private int b(String str) {
        View view;
        DragBean dragBean;
        int i = this.F;
        if (i != -1) {
            return i;
        }
        this.q = null;
        this.s = null;
        HashMap<String, DragBean> e2 = e();
        if (e2 != null && e2.containsKey(str) && (dragBean = e2.get(str)) != null) {
            a(dragBean.dragBindViewOp);
            IFrameView iFrameView = dragBean.dragBindWebView;
            if (iFrameView != null && (iFrameView instanceof io.dcloud.common.core.ui.b)) {
                this.B = true;
                io.dcloud.common.core.ui.b bVar = (io.dcloud.common.core.ui.b) iFrameView;
                this.q = bVar;
                this.s = bVar.obtainMainView();
            } else {
                View view2 = dragBean.nativeView;
                this.s = view2;
                if (view2 != null) {
                    this.B = true;
                }
            }
        }
        if (a(this.q) && ((view = this.s) == null || !(view instanceof INativeView))) {
            this.F = 0;
        } else if (this.s.getVisibility() != 0) {
            this.q = null;
            this.s = null;
            return 0;
        } else {
            if (this.s.getParent() == null && (this.r.getParent() instanceof FrameLayout) && !(this.s instanceof INativeView)) {
                this.q.pushToViewStack();
            }
            if (!a(this.r, this.s) && !(this.s instanceof INativeView)) {
                this.q = null;
                this.s = null;
                return 0;
            } else if (!(this.s instanceof INativeView) && this.D && this.r.getParent() != this.s.getParent()) {
                this.F = 0;
                return 0;
            } else {
                View view3 = this.s;
                if (view3 instanceof INativeView) {
                    view3.bringToFront();
                }
                int a2 = a(this.s);
                int a3 = a(this.r);
                if (a3 == 0) {
                    int width = this.r.getWidth();
                    int i2 = this.M;
                    if (width == i2 && (a2 >= i2 || a2 <= (-b(this.s)))) {
                        this.Q = a2;
                        boolean z = this.C;
                        if (z && this.D) {
                            if ("right".equals(str)) {
                                this.k = a3 - b(this.s);
                            } else if ("left".equals(str)) {
                                this.k = a3 + this.r.getWidth();
                            }
                            b(this.s, this.k);
                        } else if (!z && this.D) {
                            if ("right".equals(str)) {
                                this.k = -b(this.s);
                            } else if ("left".equals(str)) {
                                this.k = this.r.getWidth();
                            }
                            b(this.s, this.k);
                        }
                    }
                }
                this.F = 1;
            }
        }
        return this.F;
    }

    private boolean f() {
        this.n = a(this.s);
        if ("right".equals(this.I)) {
            int i = this.x;
            if (Integer.MAX_VALUE != i) {
                this.o = i;
                return this.n != i;
            }
            this.o = b(this.s);
            int i2 = this.n;
            if (i2 == 0 || i2 == this.M) {
                return false;
            }
            if ("bounce".equalsIgnoreCase(this.A)) {
                this.o = this.n + (b(this.r) / 2);
                return true;
            } else if (this.n < 0) {
                this.o = 0;
                return true;
            } else {
                return true;
            }
        } else if ("left".equals(this.I)) {
            int i3 = this.x;
            if (Integer.MAX_VALUE != i3) {
                this.o = i3;
                return this.n != i3;
            }
            int b2 = b(this.s);
            this.o = -b2;
            if ("bounce".equalsIgnoreCase(this.A)) {
                this.o = this.n - (b(this.r) / 2);
                return true;
            }
            int i4 = this.M;
            if (b2 < i4) {
                int a2 = a(this.s) + b(this.s);
                if (a2 == this.M || a2 == 0) {
                    return false;
                }
                Rect rect = new Rect();
                this.s.getGlobalVisibleRect(rect);
                int i5 = this.M;
                if (i5 == rect.left) {
                    this.o = i5 - b2;
                    return true;
                } else if (rect.right == 0) {
                    this.o = 0;
                    return true;
                } else {
                    return true;
                }
            } else if (b2 != i4 || this.n <= 0) {
                return true;
            } else {
                this.o = 0;
                return true;
            }
        } else {
            return true;
        }
    }

    private boolean g() {
        return h() && f();
    }

    private void d() {
        this.N = true;
        e0 = true;
        this.r.requestLayout();
        this.r.getViewTreeObserver().addOnGlobalLayoutListener(new b());
    }

    public boolean d(String str) {
        VelocityTracker velocityTracker = this.f;
        if (velocityTracker != null) {
            velocityTracker.computeCurrentVelocity(1000, 1000.0f);
            float xVelocity = velocityTracker.getXVelocity();
            this.f.clear();
            this.f.recycle();
            this.f = null;
            return Math.abs(xVelocity) >= 200.0f;
        }
        return false;
    }

    private boolean e(MotionEvent motionEvent) {
        float f2;
        float f3;
        int i;
        int i2;
        View view;
        int width;
        int i3;
        int action = motionEvent.getAction();
        float rawX = motionEvent.getRawX();
        float rawY = motionEvent.getRawY();
        if (action != 0) {
            if (action != 1) {
                if (action == 2) {
                    float f4 = rawX - this.i;
                    this.i = rawX;
                    ViewGroup.LayoutParams layoutParams = this.r.getLayoutParams();
                    boolean z = layoutParams instanceof FrameLayout.LayoutParams;
                    if (z) {
                        f2 = ViewHelper.getX(this.r);
                    } else {
                        f2 = layoutParams instanceof AbsoluteLayout.LayoutParams ? ((AbsoluteLayout.LayoutParams) layoutParams).x : 0.0f;
                    }
                    View view2 = this.s;
                    if (view2 != null) {
                        ViewGroup.LayoutParams layoutParams2 = view2.getLayoutParams();
                        View view3 = this.s;
                        if (view3 instanceof INativeView) {
                            i = a(view3);
                        } else {
                            if (layoutParams2 instanceof FrameLayout.LayoutParams) {
                                f3 = ViewHelper.getX(view3);
                            } else if (layoutParams2 instanceof AbsoluteLayout.LayoutParams) {
                                i = ((AbsoluteLayout.LayoutParams) layoutParams2).x;
                            } else {
                                f3 = 0.0f;
                            }
                            i2 = (0.0f > f2 ? 1 : (0.0f == f2 ? 0 : -1));
                            if (i2 != 0) {
                                if ("right".equals(this.I)) {
                                    if (f2 + f4 < 0.0f) {
                                        width = (int) (this.r.getWidth() + f2);
                                        i3 = this.M;
                                    }
                                    f4 = -f2;
                                } else if ("left".equals(this.I)) {
                                    if (f2 + f4 > 0.0f) {
                                        width = (int) (this.r.getWidth() + f2);
                                        i3 = this.M;
                                    }
                                    f4 = -f2;
                                }
                            }
                            if (!"right".equals(this.I)) {
                                float f5 = this.M;
                                if (f3 + f4 >= f5) {
                                    f4 = f5 - f3;
                                } else {
                                    int b2 = (int) (f3 + b(this.s));
                                    int i4 = this.M;
                                    if (b2 + f4 <= i4) {
                                        f4 = i4 - b2;
                                    }
                                }
                            } else if ("left".equals(this.I)) {
                                int b3 = (int) (b(this.s) + f3);
                                if (b3 + f4 <= 0.0f) {
                                    f4 = -b3;
                                } else if (f3 + f4 >= 0.0f) {
                                    f4 = -f3;
                                }
                            }
                            if (i2 != 0) {
                                if (z) {
                                    View view4 = this.r;
                                    ViewHelper.setX(view4, ViewHelper.getX(view4) + f4);
                                } else if (layoutParams instanceof AbsoluteLayout.LayoutParams) {
                                    ((AbsoluteLayout.LayoutParams) layoutParams).x += (int) f4;
                                    this.r.requestLayout();
                                }
                            }
                            view = this.s;
                            if (!(view instanceof INativeView)) {
                                b(view, (int) (f2 + f4));
                                this.s.requestLayout();
                                this.s.invalidate();
                            } else if (layoutParams2 instanceof FrameLayout.LayoutParams) {
                                ViewHelper.setX(view, ViewHelper.getX(view) + f4);
                            } else if (layoutParams2 instanceof AbsoluteLayout.LayoutParams) {
                                ((AbsoluteLayout.LayoutParams) layoutParams2).x += (int) f4;
                                view.requestLayout();
                            }
                        }
                        f3 = i;
                        i2 = (0.0f > f2 ? 1 : (0.0f == f2 ? 0 : -1));
                        if (i2 != 0) {
                        }
                        if (!"right".equals(this.I)) {
                        }
                        if (i2 != 0) {
                        }
                        view = this.s;
                        if (!(view instanceof INativeView)) {
                        }
                    }
                }
            }
            this.O = false;
            this.g = false;
            if (this.E) {
                b();
            }
            return false;
        }
        this.i = rawX;
        this.j = rawY;
        return true;
    }

    private void c() {
        this.N = true;
        e0 = true;
        View view = this.s;
        if (view != null) {
            view.requestLayout();
            this.s.getViewTreeObserver().addOnGlobalLayoutListener(new a());
        }
    }

    private String c(String str) {
        if ("left".equals(str)) {
            return "right";
        }
        if ("right".equals(str)) {
            return "left";
        }
        return null;
    }

    public void b(boolean z) {
        if (this.N) {
            this.N = false;
            a("end", z, z ? "100" : WXInstanceApm.VALUE_ERROR_CODE_DEFAULT);
        }
    }

    private void b() {
        this.N = true;
        e0 = true;
        if (this.s != null) {
            this.r.requestLayout();
            this.r.getViewTreeObserver().addOnGlobalLayoutListener(new f());
        }
    }

    public int b(View view) {
        if (view != null) {
            if (view instanceof INativeView) {
                return ((INativeView) view).getStyleWidth();
            }
            return view.getWidth();
        }
        return 0;
    }

    public void b(View view, int i) {
        if (view != null) {
            if (view instanceof INativeView) {
                ((INativeView) view).setStyleLeft(i);
            } else if (view.getLayoutParams() instanceof AbsoluteLayout.LayoutParams) {
                AbsoluteLayout.LayoutParams layoutParams = (AbsoluteLayout.LayoutParams) view.getLayoutParams();
                layoutParams.height = view.getHeight();
                layoutParams.width = view.getWidth();
                ViewHelper.setX(view, i);
                view.requestLayout();
            } else if (view.getLayoutParams() instanceof FrameLayout.LayoutParams) {
                ViewHelper.setX(view, i);
            }
        }
    }

    private void a(JSONObject jSONObject) {
        JSONObject jSONObject2;
        JSONObject jSONObject3;
        if (jSONObject != null) {
            this.x = Integer.MAX_VALUE;
            this.y = null;
            this.z = null;
            this.D = "follow".equalsIgnoreCase(JSONUtil.getString(jSONObject, "moveMode"));
            if (jSONObject.has("over") && (jSONObject3 = JSONUtil.getJSONObject(jSONObject, "over")) != null) {
                if (jSONObject3.has("left")) {
                    this.x = PdrUtil.parseInt(JSONUtil.getString(jSONObject3, "left"), this.M, Integer.MAX_VALUE);
                }
                if (jSONObject3.has("action")) {
                    this.y = JSONUtil.getString(jSONObject3, "action");
                }
            }
            if (!jSONObject.has(BindingXConstants.STATE_CANCEL) || (jSONObject2 = JSONUtil.getJSONObject(jSONObject, BindingXConstants.STATE_CANCEL)) == null) {
                return;
            }
            if (jSONObject2.has("left")) {
                PdrUtil.parseInt(JSONUtil.getString(jSONObject2, "left"), this.M, Integer.MAX_VALUE);
            }
            if (jSONObject2.has("action")) {
                this.z = JSONUtil.getString(jSONObject2, "action");
            }
        }
    }

    private boolean a(View view, View view2) {
        if (view != null && view2 != null) {
            ViewParent parent = view2.getParent();
            for (ViewParent parent2 = view.getParent(); parent2 != null && parent2 != view2; parent2 = parent2.getParent()) {
                while (parent != null) {
                    if (parent == view) {
                        return false;
                    }
                    if (parent2 == parent) {
                        return true;
                    }
                    parent = parent.getParent();
                }
                parent = view2.getParent();
            }
            return false;
        }
        return false;
    }

    private void a() {
        this.N = true;
        e0 = true;
        this.r.requestLayout();
        this.r.getViewTreeObserver().addOnGlobalLayoutListener(new c());
    }

    public void a(boolean z, boolean z2) {
        if (this.N) {
            this.N = false;
            a("end", z, z2, z ? "100" : WXInstanceApm.VALUE_ERROR_CODE_DEFAULT);
        }
    }

    public void a(View view, int i) {
        io.dcloud.common.core.ui.b bVar;
        io.dcloud.common.core.ui.b bVar2;
        if (view != null) {
            if (view == this.r && (bVar2 = this.p) != null) {
                bVar2.obtainFrameOptions().left = i;
                this.p.obtainFrameOptions().checkValueIsPercentage("left", i, this.M, true, true);
            } else if (view != this.s || (bVar = this.q) == null) {
            } else {
                bVar.obtainFrameOptions().left = i;
                this.q.obtainFrameOptions().checkValueIsPercentage("left", i, this.M, true, true);
            }
        }
    }

    public ValueAnimator a(View view, int i, int i2, boolean z) {
        return a(view, i, i2, z, false);
    }

    public ValueAnimator a(View view, int i, int i2, boolean z, boolean z2) {
        ValueAnimator valueAnimator = null;
        if (view == null) {
            return null;
        }
        ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
        if (view instanceof INativeView) {
            valueAnimator = ValueAnimator.ofInt(i, i2);
        } else if (layoutParams instanceof AbsoluteLayout.LayoutParams) {
            valueAnimator = ValueAnimator.ofInt(i, i2);
        } else if (layoutParams instanceof FrameLayout.LayoutParams) {
            valueAnimator = ValueAnimator.ofFloat(i, i2);
        }
        valueAnimator.setDuration(Math.min(Math.max(new BigDecimal(450).multiply(new BigDecimal(Math.abs(i2 - i)).divide(new BigDecimal(this.M), 4, 4)).longValue(), 200L), 250L));
        valueAnimator.addListener(new d(z, z2, view, i2));
        valueAnimator.addUpdateListener(new e(view));
        return valueAnimator;
    }

    private void a(String str, boolean z, String str2) {
        a(str, z, false, str2);
    }

    public void a(String str, boolean z, boolean z2, String str2) {
        String str3;
        io.dcloud.common.core.ui.b bVar;
        String str4;
        String format;
        if ("end".equals(str)) {
            if (!a(this.p)) {
                this.p.obtainWebView().obtainWindowView().setVerticalScrollBarEnabled(this.b);
                this.p.obtainWebView().obtainWindowView().setHorizontalScrollBarEnabled(this.c);
            }
            View view = this.s;
            if (view != null && (view instanceof com.dcloud.android.widget.AbsoluteLayout)) {
                ((com.dcloud.android.widget.AbsoluteLayout) view).getDrag().c(false);
                if (!a(this.q)) {
                    this.q.obtainWebView().obtainWindowView().setVerticalScrollBarEnabled(this.d);
                    WebView obtainWebview = this.q.obtainWebView().obtainWebview();
                    if (obtainWebview != null) {
                        obtainWebview.setHorizontalScrollbarOverlay(this.e);
                    }
                }
            }
        }
        if (this.G == null || TextUtils.isEmpty(this.H) || TextUtils.isEmpty(str)) {
            return;
        }
        View view2 = this.s;
        String str5 = null;
        if (view2 != null) {
            if (view2 instanceof INativeView) {
                str3 = ((INativeView) view2).getViewId();
            } else {
                io.dcloud.common.core.ui.b bVar2 = this.q;
                if (bVar2 != null && bVar2.obtainWebView() != null) {
                    str3 = this.q.obtainWebView().obtainFrameId();
                }
            }
            bVar = this.p;
            if (bVar != null && bVar.obtainWebView() != null) {
                str5 = this.p.obtainWebView().obtainFrameId();
            }
            str4 = (z ? !z2 : z2) ? str5 : str3;
            if (a(this.q) && this.q.isWebviewCovered()) {
                if (!a(this.p) && !this.p.isWebviewCovered()) {
                    str4 = str5;
                }
            } else if (!a(this.p) && this.p.isWebviewCovered() && !a(this.q) && !this.q.isWebviewCovered()) {
                str4 = str3;
            }
            if (TextUtils.isEmpty(str4)) {
                str4 = Constants.Name.UNDEFINED;
            }
            String str6 = "";
            if (TextUtils.isEmpty(str5)) {
                str5 = "";
            }
            if (TextUtils.isEmpty(str3)) {
                str3 = "";
            }
            if (!"left".equals(this.I)) {
                str6 = Constants.Name.RTL;
            } else if ("right".equals(this.I)) {
                str6 = "ltr";
            }
            if (this.G.obtainWebView() == null) {
                if ("end".equals(str)) {
                    format = StringUtil.format("{\"type\":\"%s\",\"result\":%b,\"id\":\"%s\",\"targetId\":\"%s\",\"otherId\":\"%s\",\"direction\":\"%s\",\"progress\":\"%s\"}", str, Boolean.valueOf(z), str4, str5, str3, str6, str2);
                } else {
                    format = StringUtil.format("{\"type\":\"%s\",\"id\":\"%s\",\"targetId\":\"%s\",\"otherId\":\"%s\",\"direction\":\"%s\",\"progress\":\"%s\"}", str, str4, str5, str3, str6, str2);
                }
                Deprecated_JSUtil.execCallback(this.G.obtainWebView(), this.H, format, JSUtil.OK, true, true);
                return;
            }
            return;
        }
        str3 = null;
        bVar = this.p;
        if (bVar != null) {
            str5 = this.p.obtainWebView().obtainFrameId();
        }
        if (z) {
        }
        if (a(this.q)) {
        }
        if (!a(this.p)) {
            str4 = str3;
        }
        if (TextUtils.isEmpty(str4)) {
        }
        String str62 = "";
        if (TextUtils.isEmpty(str5)) {
        }
        if (TextUtils.isEmpty(str3)) {
        }
        if (!"left".equals(this.I)) {
        }
        if (this.G.obtainWebView() == null) {
        }
    }

    public View a(String str) {
        DragBean dragBean;
        IFrameView iFrameView;
        View obtainMainView;
        String c2 = c(str);
        HashMap<String, DragBean> hashMap = this.p.obtainFrameOptions().dragData;
        if (hashMap == null || !hashMap.containsKey(c2) || (dragBean = hashMap.get(c2)) == null || (iFrameView = dragBean.dragBindWebView) == null || !"follow".equalsIgnoreCase(JSONUtil.getString(dragBean.dragBindViewOp, "moveMode")) || (obtainMainView = iFrameView.obtainMainView()) == null || obtainMainView.getVisibility() != 0 || obtainMainView.getWidth() >= this.M) {
            return null;
        }
        int a2 = a(obtainMainView);
        int width = obtainMainView.getWidth() + a2;
        if ((a2 < 0 || a2 >= this.M) && (width <= 0 || width > this.M)) {
            return null;
        }
        return obtainMainView;
    }

    private float a(float f2) {
        if (!"bounce".equalsIgnoreCase(this.A) || 0.0f == f2) {
            return f2;
        }
        boolean z = f2 < 0.0f;
        float floatValue = new BigDecimal(f2).multiply(new BigDecimal(Math.abs(this.m - a(this.r))).divide(new BigDecimal(this.m - this.l), 4, 4)).floatValue();
        if (z) {
            floatValue = -floatValue;
        }
        return z ? Math.min(floatValue, -2.0f) : Math.max(floatValue, 2.0f);
    }

    public int a(View view) {
        if (view != null) {
            if (view instanceof INativeView) {
                return ((INativeView) view).getStyleLeft();
            }
            if (view.getLayoutParams() instanceof AbsoluteLayout.LayoutParams) {
                return (int) ViewHelper.getX(view);
            }
            if (view.getLayoutParams() instanceof FrameLayout.LayoutParams) {
                return (int) ViewHelper.getX(view);
            }
            return 0;
        }
        return 0;
    }

    private boolean a(io.dcloud.common.core.ui.b bVar) {
        if (bVar != null) {
            if (bVar == null || bVar.obtainWebView() != null) {
                if (bVar == null || bVar.obtainMainView() != null) {
                    return bVar != null && bVar.obtainWebView() == null && bVar.obtainMainView() == null;
                }
                return true;
            }
            return true;
        }
        return true;
    }
}