导航菜单

页面标题

页面副标题

星辰VPN v1.2.3 - TicketAddActivity.java 源代码

正在查看: 星辰VPN v1.2.3 应用的 TicketAddActivity.java JAVA 源代码文件

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


package com.moetor.ui.mine;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.graphics.Typeface;
import android.view.View;
import androidx.appcompat.widget.AppCompatEditText;
import com.github.kr328.clash.core.Clash;
import com.lihang.ShadowLayout;
import com.moetor.R$color;
import com.moetor.R$id;
import com.moetor.R$layout;
import com.moetor.app.AppManager;
import com.moetor.app.ExtKt;
import com.moetor.base.BaseActivity;
import com.moetor.mvp.contract.TicketAddContract;
import com.moetor.mvp.presenter.TicketAddPresenter;
import com.moetor.mvp.request.TicketAddRequest;
import com.moetor.utils.CertUtils;
import com.moetor.view.MyImageButton;
import com.moetor.view.MyTextView;
import com.moetor.view.TipsDialog;
import java.io.ByteArrayInputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.cert.Certificate;
import java.security.cert.CertificateEncodingException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.ArraysKt;
import kotlin.collections.IntIterator;
import kotlin.jvm.functions.Function1;
import kotlin.text.StringsKt;
import kotlinx.serialization.json.internal.AbstractJsonLexerKt;

@Metadata(d1 = {"\u0000:\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0000\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u00012\u00020\u0003B\u0005¢\u0006\u0002\u0010\u0004J\b\u0010\u0005\u001a\u00020\u0002H\u0014J \u0010\u0006\u001a\u00020\u00072\u0006\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\rH\u0002J\b\u0010\u000e\u001a\u00020\u000fH\u0014J\b\u0010\u0010\u001a\u00020\u0007H\u0014J\b\u0010\u0011\u001a\u00020\u0007H\u0014J\u0010\u0010\u0012\u001a\u00020\u00072\u0006\u0010\u0013\u001a\u00020\tH\u0016J\u0010\u0010\u0014\u001a\u00020\u00072\u0006\u0010\u0015\u001a\u00020\u0016H\u0016¨\u0006\u0017"}, d2 = {"Lcom/moetor/ui/mine/TicketAddActivity;", "Lcom/moetor/base/BaseActivity;", "Lcom/moetor/mvp/presenter/TicketAddPresenter;", "Lcom/moetor/mvp/contract/TicketAddContract$View;", "()V", "createPresenter", "focusItem", "", "focus", "", "tv", "Lcom/moetor/view/MyTextView;", "sl", "Lcom/lihang/ShadowLayout;", "initLayoutId", "", "initStatusBar", "initView", "onTicketAdd", "success", "onTicketAddError", "e", "Lcom/moetor/net/ApiException$RespException;", "app_maomaoRelease"}, k = 1, mv = {1, 6, 0}, xi = 48)
public final class TicketAddActivity extends BaseActivity<TicketAddPresenter> implements TicketAddContract.View {
    public Map<Integer, View> _$_findViewCache = new LinkedHashMap();

    private final void focusItem(boolean focus, MyTextView tv, ShadowLayout sl) {
        if (focus) {
            tv.setTypeface(Typeface.DEFAULT_BOLD);
            sl.setStrokeColor(ExtKt.getAsColor(R$color.blue_677));
        } else {
            tv.setTypeface(Typeface.DEFAULT);
            sl.setStrokeColor(ExtKt.getAsColor(R$color.white_dde));
        }
    }

    public static final void m58initView$lambda0(TicketAddActivity this$0, View view) {
        kotlin.jvm.internal.b.i(this$0, "this$0");
        this$0.onBackPressed();
    }

    public static final void m59initView$lambda1(TicketAddActivity this$0, View view, boolean z) {
        kotlin.jvm.internal.b.i(this$0, "this$0");
        MyTextView tv_sub = (MyTextView) this$0._$_findCachedViewById(R$id.tv_sub);
        kotlin.jvm.internal.b.h(tv_sub, "tv_sub");
        ShadowLayout sl_sub = (ShadowLayout) this$0._$_findCachedViewById(R$id.sl_sub);
        kotlin.jvm.internal.b.h(sl_sub, "sl_sub");
        this$0.focusItem(z, tv_sub, sl_sub);
    }

    public static final void m60initView$lambda2(TicketAddActivity this$0, View view, boolean z) {
        kotlin.jvm.internal.b.i(this$0, "this$0");
        MyTextView tv_content = (MyTextView) this$0._$_findCachedViewById(R$id.tv_content);
        kotlin.jvm.internal.b.h(tv_content, "tv_content");
        ShadowLayout sl_content = (ShadowLayout) this$0._$_findCachedViewById(R$id.sl_content);
        kotlin.jvm.internal.b.h(sl_content, "sl_content");
        this$0.focusItem(z, tv_content, sl_content);
    }

    public static final void m61initView$lambda6(TicketAddActivity this$0, View view) {
        kotlin.jvm.internal.b.i(this$0, "this$0");
        int i = R$id.et_sub;
        String obj = StringsKt.trim((CharSequence) this$0._$_findCachedViewById(i).getEditableText().toString()).toString();
        int i2 = R$id.et_content;
        String obj2 = StringsKt.trim((CharSequence) this$0._$_findCachedViewById(i2).getEditableText().toString()).toString();
        if (obj.length() == 0) {
            AppCompatEditText _$_findCachedViewById = this$0._$_findCachedViewById(i);
            _$_findCachedViewById.setError("请输入工单主题");
            _$_findCachedViewById.requestFocus();
            ExtKt.textFocusEnd(_$_findCachedViewById);
            return;
        }
        if (obj2.length() == 0) {
            AppCompatEditText _$_findCachedViewById2 = this$0._$_findCachedViewById(i2);
            _$_findCachedViewById2.setError("请描述您遇到的问题");
            _$_findCachedViewById2.requestFocus();
            ExtKt.textFocusEnd(_$_findCachedViewById2);
            return;
        }
        TicketAddPresenter mPresenter = this$0.getMPresenter();
        if (mPresenter != null) {
            TicketAddRequest ticketAddRequest = new TicketAddRequest();
            ticketAddRequest.setSubject(obj);
            ticketAddRequest.setMessage(obj2);
            mPresenter.ticketAdd(ticketAddRequest);
        }
    }

    @Override
    public void _$_clearFindViewByIdCache() {
        this._$_findViewCache.clear();
    }

    @Override
    public View _$_findCachedViewById(int i) {
        Map<Integer, View> map = this._$_findViewCache;
        View view = map.get(Integer.valueOf(i));
        if (view != null) {
            return view;
        }
        View findViewById = findViewById(i);
        if (findViewById == null) {
            return null;
        }
        map.put(Integer.valueOf(i), findViewById);
        return findViewById;
    }

    @Override
    public int initLayoutId() {
        return R$layout.activity_ticket_add;
    }

    @Override
    public void initStatusBar() {
        super.initStatusBar();
        com.gyf.immersionbar.g.A(this, new View[]{_$_findCachedViewById(R$id.status_bar_view)});
    }

    @Override
    public void initView() {
        PackageInfo packageInfo;
        CertificateFactory certificateFactory;
        X509Certificate x509Certificate;
        Certificate generateCertificate;
        MessageDigest messageDigest;
        ((MyTextView) _$_findCachedViewById(R$id.tv_title)).setText("新建工单");
        final int i = 0;
        ((MyImageButton) _$_findCachedViewById(R$id.ib_back)).setOnClickListener(new View.OnClickListener(this) {
            public final TicketAddActivity e;

            {
                this.e = this;
            }

            @Override
            public final void onClick(View view) {
                switch (i) {
                    case 0:
                        TicketAddActivity.m58initView$lambda0(this.e, view);
                        break;
                    default:
                        TicketAddActivity.m61initView$lambda6(this.e, view);
                        break;
                }
            }
        });
        ((MyImageButton) _$_findCachedViewById(R$id.ib_right)).setVisibility(8);
        int i2 = 2;
        _$_findCachedViewById(R$id.et_sub).setOnFocusChangeListener(new com.moetor.ui.login.c(this, i2));
        _$_findCachedViewById(R$id.et_content).setOnFocusChangeListener(new com.moetor.ui.login.b(this, i2));
        final int i5 = 1;
        ((ShadowLayout) _$_findCachedViewById(R$id.sl_commit)).setOnClickListener(new View.OnClickListener(this) {
            public final TicketAddActivity e;

            {
                this.e = this;
            }

            @Override
            public final void onClick(View view) {
                switch (i5) {
                    case 0:
                        TicketAddActivity.m58initView$lambda0(this.e, view);
                        break;
                    default:
                        TicketAddActivity.m61initView$lambda6(this.e, view);
                        break;
                }
            }
        });
        String nativeCertSHA1 = Clash.INSTANCE.nativeCertSHA1();
        CertUtils certUtils = CertUtils.INSTANCE;
        String str = null;
        try {
            packageInfo = getPackageManager().getPackageInfo(getPackageName(), 64);
        } catch (PackageManager.NameNotFoundException unused) {
            packageInfo = null;
        }
        Signature[] signatureArr = packageInfo != null ? packageInfo.signatures : null;
        String str2 = "";
        if (signatureArr != null) {
            ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(signatureArr[0].toByteArray());
            try {
                certificateFactory = CertificateFactory.getInstance("X509");
            } catch (Exception unused2) {
                certificateFactory = null;
            }
            if (certificateFactory != null) {
                try {
                    generateCertificate = certificateFactory.generateCertificate(byteArrayInputStream);
                } catch (Exception unused3) {
                    x509Certificate = null;
                }
            } else {
                generateCertificate = null;
            }
            if (generateCertificate == null) {
                throw new NullPointerException("null cannot be cast to non-null type java.security.cert.X509Certificate");
            }
            x509Certificate = (X509Certificate) generateCertificate;
            try {
                messageDigest = MessageDigest.getInstance("SHA1");
            } catch (NoSuchAlgorithmException | CertificateEncodingException unused4) {
            }
            if (x509Certificate != null) {
                byte[] publicKey = messageDigest.digest(x509Certificate.getEncoded());
                kotlin.jvm.internal.b.h(publicKey, "publicKey");
                StringBuilder sb = new StringBuilder(publicKey.length * 2);
                Iterator<Integer> it = ArraysKt.getIndices(publicKey).iterator();
                while (it.hasNext()) {
                    int nextInt = ((IntIterator) it).nextInt();
                    String h = Integer.toHexString(publicKey[nextInt]);
                    int length = h.length();
                    if (length == 1) {
                        h = '0' + h;
                    }
                    if (length > 2) {
                        kotlin.jvm.internal.b.h(h, "h");
                        h = h.substring(length - 2, length);
                        kotlin.jvm.internal.b.h(h, "this as java.lang.String…ing(startIndex, endIndex)");
                    }
                    kotlin.jvm.internal.b.h(h, "h");
                    Locale locale = Locale.getDefault();
                    kotlin.jvm.internal.b.h(locale, "getDefault()");
                    String upperCase = h.toUpperCase(locale);
                    kotlin.jvm.internal.b.h(upperCase, "this as java.lang.String).toUpperCase(locale)");
                    sb.append(upperCase);
                    if (nextInt < publicKey.length - 1) {
                        sb.append(AbstractJsonLexerKt.COLON);
                    }
                }
                String sb2 = sb.toString();
                kotlin.jvm.internal.b.h(sb2, "s.toString()");
                str = sb2;
                if (str != null) {
                    str2 = str;
                }
            }
        }
        if (kotlin.jvm.internal.b.d(str2, nativeCertSHA1)) {
            return;
        }
        new TipsDialog(this).show(new Function1<TipsDialog, Unit>() {
            {
                super(1);
            }

            @Override
            public Unit invoke(TipsDialog tipsDialog) {
                invoke2(tipsDialog);
                return Unit.INSTANCE;
            }

            public final void invoke2(TipsDialog show) {
                kotlin.jvm.internal.b.i(show, "$this$show");
                Clash clash = Clash.INSTANCE;
                show.title(clash.nativePiracyTitle());
                show.content(clash.nativePiracyContent());
                final TicketAddActivity ticketAddActivity = TicketAddActivity.this;
                TipsDialog.negative$default(show, "退出", false, new Function1<TipsDialog, Unit>() {
                    {
                        super(1);
                    }

                    @Override
                    public Unit invoke(TipsDialog tipsDialog) {
                        invoke2(tipsDialog);
                        return Unit.INSTANCE;
                    }

                    public final void invoke2(TipsDialog it2) {
                        kotlin.jvm.internal.b.i(it2, "it");
                        AppManager.INSTANCE.exit(TicketAddActivity.this);
                    }
                }, 2, null);
                final TicketAddActivity ticketAddActivity2 = TicketAddActivity.this;
                TipsDialog.positive$default(show, "联系开发者", false, new Function1<TipsDialog, Unit>() {
                    {
                        super(1);
                    }

                    @Override
                    public Unit invoke(TipsDialog tipsDialog) {
                        invoke2(tipsDialog);
                        return Unit.INSTANCE;
                    }

                    public final void invoke2(TipsDialog it2) {
                        kotlin.jvm.internal.b.i(it2, "it");
                        ExtKt.openBrowserUrl(TicketAddActivity.this, Clash.INSTANCE.nativePiracyLink());
                    }
                }, 2, null);
            }
        });
    }

    @Override
    public void onTicketAdd(boolean success) {
        if (!success) {
            ExtKt.toastError("工单提交失败,请重试");
        } else {
            ExtKt.toastSuccess("提交成功");
            onBackPressed();
        }
    }

    @Override
    public void onTicketAddError(com.moetor.net.ApiException.RespException r4) {
        throw new UnsupportedOperationException("Method not decompiled: com.moetor.ui.mine.TicketAddActivity.onTicketAddError(com.moetor.net.ApiException$RespException):void");
    }

    @Override
    public TicketAddPresenter createPresenter() {
        return new TicketAddPresenter(this);
    }
}