小红书.apk(点击下载) / i.java


package rk2;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.os.Build;
import android.view.View;
import com.xingin.widgets.XYTabLayout;
import dw2.r;
import java.lang.reflect.Field;
import sk2.c0;
import yj2.j;

/* compiled from: FloatViewUtils */
public abstract class i {

    /* compiled from: FloatViewUtils */
    public static class a implements View.OnAttachStateChangeListener {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ Runnable f126338a;

        public a(Runnable runnable) {
            this.f126338a = runnable;
        }

        public void onViewAttachedToWindow(View view) {
        }

        public void onViewDetachedFromWindow(View view) {
            view.removeCallbacks(this.f126338a);
        }
    }

    /* compiled from: FloatViewUtils */
    public static class b implements View.OnAttachStateChangeListener {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ boolean[] f126339a;

        /* renamed from: b  reason: collision with root package name */
        public final /* synthetic */ Runnable f126340b;

        public b(boolean[] zArr, Runnable runnable) {
            this.f126339a = zArr;
            this.f126340b = runnable;
        }

        public void onViewAttachedToWindow(View view) {
            boolean[] zArr = this.f126339a;
            if (!zArr[0]) {
                zArr[0] = true;
                view.post(this.f126340b);
            }
        }

        public void onViewDetachedFromWindow(View view) {
            view.removeCallbacks(this.f126340b);
        }
    }

    @SuppressLint({"ObsoleteSdkInt"})
    @TargetApi(17)
    public static boolean e(Activity activity) {
        if (activity.isFinishing()) {
            return false;
        }
        if (Build.VERSION.SDK_INT < 17 || !activity.isDestroyed()) {
            return true;
        }
        return false;
    }

    @SuppressLint({"ObsoleteSdkInt"})
    @TargetApi(17)
    public static boolean f(Context context) {
        if (context == null) {
            return false;
        }
        while ((context instanceof ContextWrapper) && !(context instanceof Activity)) {
            context = ((ContextWrapper) context).getBaseContext();
        }
        if (!(context instanceof Activity)) {
            return false;
        }
        return e((Activity) context);
    }

    public static View g(XYTabLayout.f fVar) {
        try {
            Field declaredField = fVar.getClass().getDeclaredField("mView");
            declaredField.setAccessible(true);
            return (View) declaredField.get(fVar);
        } catch (NoSuchFieldException e14) {
            j.d(e14);
            return null;
        } catch (IllegalAccessException e15) {
            j.d(e15);
            return null;
        }
    }

    public static /* synthetic */ View i(Object obj) throws Exception {
        if (obj instanceof XYTabLayout.f) {
            return g((XYTabLayout.f) obj);
        }
        return (View) obj;
    }

    public static /* synthetic */ void j(c0 c0Var, Object obj, View view) throws Exception {
        g gVar = new g(c0Var, view);
        if (view == null) {
            View b14 = obj instanceof XYTabLayout.f ? ((XYTabLayout.f) obj).b() : null;
            StringBuilder sb3 = new StringBuilder();
            sb3.append("tab: mView反射失败 customView: ");
            sb3.append(b14 != null ? b14.toString() : com.igexin.push.core.b.f25383k);
            j.a(sb3.toString());
            return;
        }
        int i10 = Build.VERSION.SDK_INT;
        if ((i10 < 19 || !view.isAttachedToWindow()) && (i10 >= 19 || view.getWindowToken() == null)) {
            view.addOnAttachStateChangeListener(new b(new boolean[1], gVar));
            return;
        }
        view.addOnAttachStateChangeListener(new a(gVar));
        view.post(gVar);
    }

    @SuppressLint({"CheckResult"})
    @TargetApi(19)
    public static void l(Object obj, c0 c0Var) {
        r.K0(obj).x1(cx2.a.c()).M0(f.f126333a).W0(gw2.a.a()).s1(new e(c0Var, obj));
    }

    public static void m(Object obj, Object obj2, c0 c0Var) {
        l(obj, new h(obj2, c0Var));
    }
}