package ඓ.㿎.K.ῲ.ᓣ;

import android.content.Context;
import android.database.DataSetObserver;
import android.graphics.PointF;
import android.os.Build;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.AbsListView;
import android.widget.ScrollView;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import java.util.Collections;
import java.util.concurrent.LinkedBlockingQueue;
import ඓ.㿎.K.ῲ.Ԕ.AbstractC1390;
import ῲ.ᨨ.ᨨ.AbstractC1735;
import ῲ.ᨨ.ᨨ.AbstractC1741;
import ῲ.ᨨ.ᨨ.AbstractC1746;
import ῲ.ゎ.K.AbstractC2199;
import ῲ.ゎ.K.C2198;

/* renamed from: ඓ.㿎.K.ῲ.ᓣ.ῲ  reason: contains not printable characters */
/* compiled from: RefreshContentWrapper */
public class C1414 implements AbstractC1390 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public MotionEvent f5344;

    /* renamed from: ῲ  reason: contains not printable characters */
    public View f5345;

    /* renamed from: K  reason: contains not printable characters */
    public View f5346;

    /* renamed from: ඓ.㿎.K.ῲ.ᓣ.ῲ$K  reason: contains not printable characters */
    /* compiled from: RefreshContentWrapper */
    public class RunnableC1416 implements Runnable {

        /* renamed from: ʬ  reason: contains not printable characters */
        public C1415 f5349 = this.f5353;

        /* renamed from: ඓ  reason: contains not printable characters */
        public final /* synthetic */ ViewPager f5350;

        /* renamed from: ῲ  reason: contains not printable characters */
        public int f5351 = 0;

        /* renamed from: 㸾  reason: contains not printable characters */
        public final /* synthetic */ C1415 f5353;

        public RunnableC1416(C1415 r2, ViewPager viewPager) {
            this.f5353 = r2;
            this.f5350 = viewPager;
        }

        public void run() {
            this.f5351++;
            AbstractC2199 adapter = this.f5350.getAdapter();
            if (adapter != null) {
                if (!(adapter instanceof C1415)) {
                    C1415 r1 = this.f5349;
                    if (r1 == null) {
                        this.f5349 = new C1415(adapter);
                    } else {
                        r1.f7657 = adapter;
                    }
                    C1415 r0 = this.f5349;
                    ViewPager viewPager = this.f5350;
                    r0.f5348 = viewPager;
                    viewPager.f1766 = r0;
                } else if (adapter == this.f5353) {
                    this.f5350.postDelayed(this, 500);
                }
            } else if (this.f5351 < 10) {
                this.f5350.postDelayed(this, 500);
            }
        }
    }

    public C1414(View view) {
        this.f5346 = view;
        m3628(view);
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public static boolean m3623(View view, MotionEvent motionEvent) {
        int i = Build.VERSION.SDK_INT;
        if (view.canScrollVertically(-1)) {
            return true;
        }
        if ((view instanceof ViewGroup) && motionEvent != null) {
            ViewGroup viewGroup = (ViewGroup) view;
            int childCount = viewGroup.getChildCount();
            PointF pointF = new PointF();
            for (int i2 = 0; i2 < childCount; i2++) {
                View childAt = viewGroup.getChildAt(i2);
                if (m3625(viewGroup, childAt, motionEvent.getX(), motionEvent.getY(), pointF)) {
                    MotionEvent obtain = MotionEvent.obtain(motionEvent);
                    obtain.offsetLocation(pointF.x, pointF.y);
                    return m3623(childAt, obtain);
                }
            }
        }
        return false;
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m3628(View view) {
        this.f5345 = m3626(view, true);
        View view2 = this.f5345;
        if ((view2 instanceof AbstractC1741) && !(view2 instanceof AbstractC1746)) {
            this.f5345 = m3626(view2, false);
        }
        View view3 = this.f5345;
        if (view3 instanceof ViewPager) {
            m3629((ViewPager) view3, (C1415) null);
        }
    }

    public C1414(Context context) {
        this.f5346 = new View(context);
        m3628(this.f5346);
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m3629(ViewPager viewPager, C1415 r3) {
        viewPager.post(new RunnableC1416(r3, viewPager));
    }

    /* renamed from: K  reason: contains not printable characters */
    public final View m3626(View view, boolean z) {
        LinkedBlockingQueue linkedBlockingQueue = new LinkedBlockingQueue(Collections.singletonList(view));
        View view2 = null;
        while (!linkedBlockingQueue.isEmpty() && view2 == null) {
            View view3 = (View) linkedBlockingQueue.poll();
            if (view3 != null) {
                if ((z || view3 != view) && ((view3 instanceof AbsListView) || (view3 instanceof ScrollView) || (view3 instanceof AbstractC1735) || (view3 instanceof AbstractC1746) || (view3 instanceof AbstractC1741) || (view3 instanceof WebView) || (view3 instanceof ViewPager))) {
                    view2 = view3;
                } else if (view3 instanceof ViewGroup) {
                    ViewGroup viewGroup = (ViewGroup) view3;
                    for (int i = 0; i < viewGroup.getChildCount(); i++) {
                        linkedBlockingQueue.add(viewGroup.getChildAt(i));
                    }
                }
            }
        }
        return view2;
    }

    /* renamed from: K  reason: contains not printable characters */
    public static boolean m3625(ViewGroup viewGroup, View view, float f, float f2, PointF pointF) {
        float[] fArr = {f, f2};
        fArr[0] = fArr[0] + ((float) (viewGroup.getScrollX() - view.getLeft()));
        fArr[1] = fArr[1] + ((float) (viewGroup.getScrollY() - view.getTop()));
        float f3 = fArr[0];
        float f4 = fArr[1];
        boolean z = f3 >= -0.0f && f4 >= -0.0f && f3 < ((float) view.getWidth()) + 0.0f && f4 < ((float) view.getHeight()) + 0.0f;
        if (z && pointF != null) {
            pointF.set(fArr[0] - f, fArr[1] - f2);
        }
        return z;
    }

    /* renamed from: ඓ.㿎.K.ῲ.ᓣ.ῲ$ῲ  reason: contains not printable characters */
    /* compiled from: RefreshContentWrapper */
    public class C1415 extends C2198 {

        /* renamed from: 㸾  reason: contains not printable characters */
        public ViewPager f5348;

        public C1415(AbstractC2199 k) {
            super(k);
        }

        @Override // ῲ.ゎ.K.AbstractC2199
        /* renamed from: ῲ  reason: contains not printable characters */
        public void m3631(ViewGroup viewGroup, int i, Object obj) {
            this.f7657.m5812(viewGroup, i, obj);
            if (obj instanceof View) {
                C1414.this.f5345 = (View) obj;
            } else if (obj instanceof Fragment) {
                C1414.this.f5345 = ((Fragment) obj).getView();
            }
            C1414 r2 = C1414.this;
            View view = r2.f5345;
            if (view != null) {
                r2.f5345 = r2.m3626(view, true);
                C1414 r22 = C1414.this;
                View view2 = r22.f5345;
                if ((view2 instanceof AbstractC1741) && !(view2 instanceof AbstractC1746)) {
                    r22.f5345 = r22.m3626(view2, false);
                }
            }
        }

        @Override // ῲ.ゎ.K.AbstractC2199, ῲ.ゎ.K.C2198
        /* renamed from: ῲ  reason: contains not printable characters */
        public void m3630(DataSetObserver dataSetObserver) {
            super.m5788(dataSetObserver);
            if (dataSetObserver == null) {
                C1414.this.m3629(this.f5348, this);
            }
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public static boolean m3624(View view, MotionEvent motionEvent) {
        int i = Build.VERSION.SDK_INT;
        if (view.canScrollVertically(1)) {
            return true;
        }
        if ((view instanceof ViewGroup) && motionEvent != null) {
            ViewGroup viewGroup = (ViewGroup) view;
            int childCount = viewGroup.getChildCount();
            PointF pointF = new PointF();
            for (int i2 = 0; i2 < childCount; i2++) {
                View childAt = viewGroup.getChildAt(i2);
                if (m3625(viewGroup, childAt, motionEvent.getX(), motionEvent.getY(), pointF)) {
                    MotionEvent obtain = MotionEvent.obtain(motionEvent);
                    obtain.offsetLocation(pointF.x, pointF.y);
                    return m3624(childAt, obtain);
                }
            }
        }
        return false;
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m3627(MotionEvent motionEvent) {
        this.f5344 = MotionEvent.obtain(motionEvent);
        this.f5344.offsetLocation((float) (-this.f5346.getLeft()), (float) (-this.f5346.getTop()));
    }
}
