导航菜单

页面标题

页面副标题

万能钥匙 v1.1.23 - CrhConnectStateView.java 源代码

正在查看: 万能钥匙 v1.1.23 应用的 CrhConnectStateView.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.wifitutu.ui.view;

import ah0.l;
import android.app.Activity;
import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.databinding.g;
import cb.j;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.wifitutu.link.foundation.kernel.e;
import com.wifitutu.link.foundation.kernel.g;
import com.wifitutu.widget.view.TextSwitcher;
import com.wifitutu.wifi.widget.api.generate.PageLink;
import com.wifitutu_common.ui.l0;
import java.util.List;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.d0;
import kotlin.jvm.internal.n;
import kotlin.jvm.internal.p;
import lg0.d4;
import lg0.e0;
import lg0.m1;
import lg0.z4;
import oq.b4;
import os.C2647f2;
import os.C2712m5;
import os.C2736q0;
import os.C3384h1;
import os.InterfaceC2681i5;
import uj0.a;

@Metadata(d1 = {"\u0000\\\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\n\n\u0002\u0018\u0002\n\u0002\b\u0003\u0018\u00002\u00020\u0001B'\b\u0007\u0012\u0006\u0010\u0003\u001a\u00020\u0002\u0012\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u0004\u0012\b\b\u0002\u0010\u0007\u001a\u00020\u0006¢\u0006\u0004\b\b\u0010\tJ\u000f\u0010\u000b\u001a\u00020\nH\u0002¢\u0006\u0004\b\u000b\u0010\fJ\u000f\u0010\r\u001a\u00020\nH\u0002¢\u0006\u0004\b\r\u0010\fJ\u0017\u0010\u0010\u001a\u00020\n2\u0006\u0010\u000f\u001a\u00020\u000eH\u0002¢\u0006\u0004\b\u0010\u0010\u0011J\u000f\u0010\u0012\u001a\u00020\nH\u0002¢\u0006\u0004\b\u0012\u0010\fJ\u000f\u0010\u0014\u001a\u00020\u0013H\u0002¢\u0006\u0004\b\u0014\u0010\u0015J\u0017\u0010\u0017\u001a\u00020\n2\u0006\u0010\u0016\u001a\u00020\u0006H\u0016¢\u0006\u0004\b\u0017\u0010\u0018J\r\u0010\u0019\u001a\u00020\n¢\u0006\u0004\b\u0019\u0010\fJ\u000f\u0010\u001a\u001a\u00020\nH\u0014¢\u0006\u0004\b\u001a\u0010\fR\u0014\u0010\u001c\u001a\u00020\u001b8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u001c\u0010\u001dR\u0014\u0010\u001f\u001a\u00020\u001e8\u0002X\u0082D¢\u0006\u0006\n\u0004\b\u001f\u0010 R\u0016\u0010!\u001a\u00020\u00138\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b!\u0010\"R*\u0010$\u001a\n\u0012\u0004\u0012\u00020\n\u0018\u00010#8\u0006@\u0006X\u0086\u000e¢\u0006\u0012\n\u0004\b$\u0010%\u001a\u0004\b&\u0010'\"\u0004\b(\u0010)R$\u0010+\u001a\u0004\u0018\u00010*8\u0006@\u0006X\u0086\u000e¢\u0006\u0012\n\u0004\b+\u0010,\u001a\u0004\b-\u0010.\"\u0004\b/\u00100R\"\u00101\u001a\u00020\u00138\u0006@\u0006X\u0086\u000e¢\u0006\u0012\n\u0004\b1\u0010\"\u001a\u0004\b2\u0010\u0015\"\u0004\b3\u00104R\u0018\u00106\u001a\u0004\u0018\u0001058\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b6\u00107¨\u00068"}, d2 = {"Lcom/wifitutu/ui/view/CrhConnectStateView;", "Landroid/widget/FrameLayout;", "Landroid/content/Context;", "context", "Landroid/util/AttributeSet;", "attrs", "", "defStyleAttr", "<init>", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", "Llg0/e0;", "initView", "()V", "loadTrainInfo", "Lru/d;", "info", "renderTrainInfo", "(Lru/d;)V", "generateDeviceView", "", "checkPoorNetwork", "()Z", "visibility", "setVisibility", "(I)V", "updateValue", "onDetachedFromWindow", "Loq/b4;", "binding", "Loq/b4;", "", "crhLogoUrl", "Ljava/lang/String;", "initialized", "Z", "Lkotlin/Function0;", "onLayoutChangeListener", "Lah0/a;", "getOnLayoutChangeListener", "()Lah0/a;", "setOnLayoutChangeListener", "(Lah0/a;)V", "Lcom/wifitutu_common/ui/l0;", "wifiInfo", "Lcom/wifitutu_common/ui/l0;", "getWifiInfo", "()Lcom/wifitutu_common/ui/l0;", "setWifiInfo", "(Lcom/wifitutu_common/ui/l0;)V", "networkAvailable", "getNetworkAvailable", "setNetworkAvailable", "(Z)V", "Lcom/wifitutu/link/foundation/kernel/e;", "busCRHTrainInfoProx", "Lcom/wifitutu/link/foundation/kernel/e;", "tutu_app_prd"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class CrhConnectStateView extends FrameLayout {
    public static ChangeQuickRedirect changeQuickRedirect;
    private final b4 binding;
    private e busCRHTrainInfoProx;
    private final String crhLogoUrl;
    private boolean initialized;
    private boolean networkAvailable;
    private ah0.a<e0> onLayoutChangeListener;
    private l0 wifiInfo;

    @Metadata(d1 = {"\u0000\u000e\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0003\u001a\u00020\u00022\b\u0010\u0001\u001a\u0004\u0018\u00010\u0000H\n¢\u0006\u0004\b\u0003\u0010\u0004"}, d2 = {"Los/i5;", "widget", "Llg0/e0;", "a", "(Los/i5;)V"}, k = 3, mv = {1, 8, 0})
    public static final class a extends p implements l<InterfaceC2681i5, e0> {
        public static ChangeQuickRedirect changeQuickRedirect;
        public final m1 t;

        public a(m1 m1Var) {
            super(1);
            this.t = m1Var;
        }

        public final void a(InterfaceC2681i5 interfaceC2681i5) {
            if (PatchProxy.proxy(new Object[]{interfaceC2681i5}, this, changeQuickRedirect, false, 28887, new Class[]{InterfaceC2681i5.class}, Void.TYPE).isSupported || interfaceC2681i5 == null) {
                return;
            }
            interfaceC2681i5.addToParent(CrhConnectStateView.this.binding.B, this.t);
        }

        @Override
        public e0 invoke(InterfaceC2681i5 interfaceC2681i5) {
            PatchProxyResult proxy = PatchProxy.proxy(new Object[]{interfaceC2681i5}, this, changeQuickRedirect, false, 28888, new Class[]{Object.class}, Object.class);
            if (proxy.isSupported) {
                return proxy.result;
            }
            a(interfaceC2681i5);
            return e0.a;
        }
    }

    @Metadata(d1 = {"\u0000\u0018\n\u0002\u0010!\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0006\u001a\u00020\u00052\u000e\u0010\u0002\u001a\n\u0012\u0004\u0012\u00020\u0001\u0018\u00010\u00002\u0014\u0010\u0004\u001a\u0010\u0012\f\u0012\n\u0012\u0004\u0012\u00020\u0001\u0018\u00010\u00000\u0003H\n¢\u0006\u0004\b\u0006\u0010\u0007"}, d2 = {"", "Lru/c;", "data", "Lqs/z4;", "<anonymous parameter 1>", "Llg0/e0;", "a", "(Ljava/util/List;Lqs/z4;)V"}, k = 3, mv = {1, 8, 0})
    public static final class b extends p implements ah0.p<List<ru.c>, z4<List<ru.c>>, e0> {
        public static ChangeQuickRedirect changeQuickRedirect;
        public final d0 s;
        public final CrhConnectStateView t;

        @Metadata(d1 = {"\u0000\b\n\u0002\u0018\u0002\n\u0002\b\u0003\u0010\u0003\u001a\u00020\u0000H\n¢\u0006\u0004\b\u0001\u0010\u0002"}, d2 = {"Llg0/e0;", "run", "()V", "<anonymous>"}, k = 3, mv = {1, 8, 0})
        public static final class a implements Runnable {
            public static ChangeQuickRedirect changeQuickRedirect;
            public final CrhConnectStateView a;

            public a(CrhConnectStateView crhConnectStateView) {
                this.a = crhConnectStateView;
            }

            @Override
            public final void run() {
                ah0.a<e0> onLayoutChangeListener;
                if (PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 28891, new Class[0], Void.TYPE).isSupported || (onLayoutChangeListener = this.a.getOnLayoutChangeListener()) == null) {
                    return;
                }
                onLayoutChangeListener.invoke();
            }
        }

        public b(d0 d0Var, CrhConnectStateView crhConnectStateView) {
            super(2);
            this.s = d0Var;
            this.t = crhConnectStateView;
        }

        public final void a(List<ru.c> list, z4<List<ru.c>> z4Var) {
            if (PatchProxy.proxy(new Object[]{list, z4Var}, this, changeQuickRedirect, false, 28889, new Class[]{List.class, z4.class}, Void.TYPE).isSupported) {
                return;
            }
            int size = list != null ? list.size() : 0;
            d0 d0Var = this.s;
            if (d0Var.a != size) {
                d0Var.a = size;
                CrhConnectStateView crhConnectStateView = this.t;
                crhConnectStateView.postDelayed(new a(crhConnectStateView), 500L);
            }
        }

        @Override
        public e0 invoke(List<ru.c> list, z4<List<ru.c>> z4Var) {
            PatchProxyResult proxy = PatchProxy.proxy(new Object[]{list, z4Var}, this, changeQuickRedirect, false, 28890, new Class[]{Object.class, Object.class}, Object.class);
            if (proxy.isSupported) {
                return proxy.result;
            }
            a(list, z4Var);
            return e0.a;
        }
    }

    @Metadata(d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0005\u001a\u00020\u00042\b\u0010\u0001\u001a\u0004\u0018\u00010\u00002\u000e\u0010\u0003\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00000\u0002H\n¢\u0006\u0004\b\u0005\u0010\u0006"}, d2 = {"Lru/d;", "data", "Lqs/z4;", "<anonymous parameter 1>", "Llg0/e0;", "a", "(Lru/d;Lqs/z4;)V"}, k = 3, mv = {1, 8, 0})
    public static final class c extends p implements ah0.p<ru.d, z4<ru.d>, e0> {
        public static ChangeQuickRedirect changeQuickRedirect;

        public c() {
            super(2);
        }

        public final void a(ru.d dVar, z4<ru.d> z4Var) {
            if (PatchProxy.proxy(new Object[]{dVar, z4Var}, this, changeQuickRedirect, false, 28892, new Class[]{ru.d.class, z4.class}, Void.TYPE).isSupported || dVar == null) {
                return;
            }
            CrhConnectStateView.access$renderTrainInfo(CrhConnectStateView.this, dVar);
        }

        @Override
        public e0 invoke(ru.d dVar, z4<ru.d> z4Var) {
            PatchProxyResult proxy = PatchProxy.proxy(new Object[]{dVar, z4Var}, this, changeQuickRedirect, false, 28893, new Class[]{Object.class, Object.class}, Object.class);
            if (proxy.isSupported) {
                return proxy.result;
            }
            a(dVar, z4Var);
            return e0.a;
        }
    }

    @Metadata(d1 = {"\u0000\b\n\u0002\u0018\u0002\n\u0002\b\u0003\u0010\u0003\u001a\u00020\u0000H\n¢\u0006\u0004\b\u0001\u0010\u0002"}, d2 = {"Llg0/e0;", "run", "()V", "<anonymous>"}, k = 3, mv = {1, 8, 0})
    public static final class d implements Runnable {
        public static ChangeQuickRedirect changeQuickRedirect;

        @Metadata(d1 = {"\u0000\b\n\u0002\u0018\u0002\n\u0002\b\u0003\u0010\u0003\u001a\u00020\u0000H\n¢\u0006\u0004\b\u0001\u0010\u0002"}, d2 = {"Llg0/e0;", "invoke", "()V", "<anonymous>"}, k = 3, mv = {1, 8, 0})
        public static final class a extends p implements ah0.a<e0> {
            public static ChangeQuickRedirect changeQuickRedirect;
            public final CrhConnectStateView s;

            public a(CrhConnectStateView crhConnectStateView) {
                super(0);
                this.s = crhConnectStateView;
            }

            @Override
            public e0 invoke() {
                PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 28896, new Class[0], Object.class);
                if (proxy.isSupported) {
                    return proxy.result;
                }
                invoke2();
                return e0.a;
            }

            public final void invoke2() {
                if (PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 28895, new Class[0], Void.TYPE).isSupported) {
                    return;
                }
                this.s.binding.C.setVisibility(0);
                this.s.binding.D.setVisibility(0);
                this.s.binding.C.setTemplateTextView(this.s.binding.G);
                TextSwitcher textSwitcher = this.s.binding.C;
                a.a aVar = uj0.a.b;
                textSwitcher.setInterval-LRDsOJo(uj0.c.p(4, uj0.d.e));
                this.s.binding.C.setTexts(mg0.l.B0(this.s.getContext().getResources().getStringArray(2130903044)));
            }
        }

        public d() {
        }

        @Override
        public final void run() {
            if (PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 28894, new Class[0], Void.TYPE).isSupported) {
                return;
            }
            if (CrhConnectStateView.access$checkPoorNetwork(CrhConnectStateView.this)) {
                CrhConnectStateView.this.binding.J.setVisibility(8);
                d4.J(CrhConnectStateView.this.binding.C.getVisibility() == 8, new a(CrhConnectStateView.this));
            } else {
                CrhConnectStateView.this.binding.J.setVisibility(0);
                CrhConnectStateView.this.binding.D.setVisibility(8);
                CrhConnectStateView.this.binding.C.setVisibility(8);
            }
        }
    }

    public CrhConnectStateView(Context context) {
        this(context, null, 0, 6, null);
    }

    public CrhConnectStateView(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, 0, 4, null);
    }

    public CrhConnectStateView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        this.crhLogoUrl = "https://filex.51y5.net/maoyu01-0lk5-gtimg.gif";
        this.binding = g.h(LayoutInflater.from(context), 2131558764, this, true);
    }

    public CrhConnectStateView(Context context, AttributeSet attributeSet, int i, int i2, DefaultConstructorMarker defaultConstructorMarker) {
        this(context, (i2 & 2) != 0 ? null : attributeSet, (i2 & 4) != 0 ? 0 : i);
    }

    public static final boolean access$checkPoorNetwork(CrhConnectStateView crhConnectStateView) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{crhConnectStateView}, (Object) null, changeQuickRedirect, true, 28886, new Class[]{CrhConnectStateView.class}, Boolean.TYPE);
        return proxy.isSupported ? ((Boolean) proxy.result).booleanValue() : crhConnectStateView.checkPoorNetwork();
    }

    public static final void access$renderTrainInfo(CrhConnectStateView crhConnectStateView, ru.d dVar) {
        if (PatchProxy.proxy(new Object[]{crhConnectStateView, dVar}, (Object) null, changeQuickRedirect, true, 28885, new Class[]{CrhConnectStateView.class, ru.d.class}, Void.TYPE).isSupported) {
            return;
        }
        crhConnectStateView.renderTrainInfo(dVar);
    }

    private final boolean checkPoorNetwork() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 28883, new Class[0], Boolean.TYPE);
        if (proxy.isSupported) {
            return ((Boolean) proxy.result).booleanValue();
        }
        ru.c tc = C3384h1.b(C2647f2.d()).tc();
        ru.e b2 = tc != null ? tc.b() : null;
        if (b2 != ru.e.CRH_TRIALING && b2 != ru.e.CRH_PURCHASED) {
            return false;
        }
        l0 l0Var = this.wifiInfo;
        return (l0Var != null && l0Var.k0() && this.networkAvailable && yq.b.e()) || !this.networkAvailable;
    }

    private final void generateDeviceView() {
        if (PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 28881, new Class[0], Void.TYPE).isSupported) {
            return;
        }
        String value = PageLink.PAGE_ID.WIFI_CRH_DEVICE_LIST_AUTH_STATE.getValue();
        Context context = getContext();
        n.g(context, "null cannot be cast to non-null type android.app.Activity");
        m1 m1Var = new m1(value, (Activity) context);
        C2712m5.b(C2647f2.d()).O(m1Var, new a(m1Var));
        g.a.b(C3384h1.b(C2647f2.d()).ua(), null, new b(new d0(), this), 1, null);
    }

    private final void initView() {
        if (PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 28878, new Class[0], Void.TYPE).isSupported) {
            return;
        }
        TextView textView = this.binding.K;
        String title = com.wifitutu.link.wifi.config.api.generate.wifi.c.a(C2736q0.a(C2647f2.d())).getTitle();
        if (title == null || title.length() == 0) {
            title = getContext().getString(2131888288);
        }
        textView.setText(title);
        TextView textView2 = this.binding.J;
        String slogan = com.wifitutu.link.wifi.config.api.generate.wifi.c.a(C2736q0.a(C2647f2.d())).getSlogan();
        if (slogan == null || slogan.length() == 0) {
            slogan = getContext().getString(2131888287);
        }
        textView2.setText(slogan);
        String imgUrl = com.wifitutu.link.wifi.config.api.generate.wifi.c.a(C2736q0.a(C2647f2.d())).getImgUrl();
        if (imgUrl == null || imgUrl.length() == 0) {
            imgUrl = this.crhLogoUrl;
        }
        va.c.u(getContext()).x(imgUrl).k(2131231504).i(j.a).I0(this.binding.H);
        generateDeviceView();
    }

    private final void loadTrainInfo() {
        if (PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 28879, new Class[0], Void.TYPE).isSupported) {
            return;
        }
        ru.d H3 = C3384h1.b(C2647f2.d()).H3();
        if (H3 != null) {
            renderTrainInfo(H3);
        }
        this.busCRHTrainInfoProx = g.a.b(C3384h1.b(C2647f2.d()).y5(), null, new c(), 1, null);
    }

    private final void renderTrainInfo(ru.d info) {
        String terminalStation;
        if (PatchProxy.proxy(new Object[]{info}, this, changeQuickRedirect, false, 28880, new Class[]{ru.d.class}, Void.TYPE).isSupported) {
            return;
        }
        String trainNum = info.getTrainNum();
        if (trainNum != null) {
            this.binding.L.setText(trainNum);
        }
        String departureStation = info.getDepartureStation();
        if (departureStation == null || departureStation.length() == 0 || (terminalStation = info.getTerminalStation()) == null || terminalStation.length() == 0) {
            return;
        }
        TextView textView = this.binding.I;
        textView.setText(textView.getContext().getString(2131888280, info.getDepartureStation(), info.getTerminalStation()));
        textView.setEllipsize(TextUtils.TruncateAt.MARQUEE);
        textView.setSingleLine(true);
        textView.setSelected(true);
        textView.setFocusable(true);
        textView.setMarqueeRepeatLimit(-1);
        textView.setFocusableInTouchMode(true);
    }

    public final boolean getNetworkAvailable() {
        return this.networkAvailable;
    }

    public final ah0.a<e0> getOnLayoutChangeListener() {
        return this.onLayoutChangeListener;
    }

    public final l0 getWifiInfo() {
        return this.wifiInfo;
    }

    @Override
    public void onDetachedFromWindow() {
        if (PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 28884, new Class[0], Void.TYPE).isSupported) {
            return;
        }
        super.onDetachedFromWindow();
        e eVar = this.busCRHTrainInfoProx;
        if (eVar != null) {
            e.a.a(eVar, null, 1, null);
        }
    }

    public final void setNetworkAvailable(boolean z) {
        this.networkAvailable = z;
    }

    public final void setOnLayoutChangeListener(ah0.a<e0> aVar) {
        this.onLayoutChangeListener = aVar;
    }

    @Override
    public void setVisibility(int visibility) {
        ah0.a<e0> aVar;
        if (PatchProxy.proxy(new Object[]{new Integer(visibility)}, this, changeQuickRedirect, false, 28877, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
            return;
        }
        if (getVisibility() != visibility && (aVar = this.onLayoutChangeListener) != null) {
            aVar.invoke();
        }
        super.setVisibility(visibility);
        if (getVisibility() != 0 || this.initialized) {
            return;
        }
        this.initialized = true;
        initView();
        loadTrainInfo();
    }

    public final void setWifiInfo(l0 l0Var) {
        this.wifiInfo = l0Var;
    }

    public final void updateValue() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 28882, new Class[0], Void.TYPE).isSupported && getVisibility() == 0) {
            postDelayed(new d(), checkPoorNetwork() ? 2000L : 0L);
        }
    }
}