导航菜单

页面标题

页面副标题

Petal Maps v4.7.0.310001 - ProblemSuggestActivity.java 源代码

正在查看: Petal Maps v4.7.0.310001 应用的 ProblemSuggestActivity.java JAVA 源代码文件

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


package com.huawei.phoneservice.feedback.ui;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.Html;
import android.text.InputFilter;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.huawei.navi.navibase.data.enums.Language;
import com.huawei.phoneservice.faq.base.constants.FaqConstants;
import com.huawei.phoneservice.faq.base.network.FaqCallback;
import com.huawei.phoneservice.faq.base.util.AttackCharFilter;
import com.huawei.phoneservice.faq.base.util.FaqCommonUtils;
import com.huawei.phoneservice.faq.base.util.FaqLogger;
import com.huawei.phoneservice.faq.base.util.FaqSdk;
import com.huawei.phoneservice.faq.base.util.FaqStringUtil;
import com.huawei.phoneservice.faq.base.util.FaqToastUtils;
import com.huawei.phoneservice.faq.base.util.ModuleConfigUtils;
import com.huawei.phoneservice.faq.base.util.NoDoubleClickUtil;
import com.huawei.phoneservice.feedback.R$color;
import com.huawei.phoneservice.feedback.R$drawable;
import com.huawei.phoneservice.feedback.R$id;
import com.huawei.phoneservice.feedback.R$layout;
import com.huawei.phoneservice.feedback.R$menu;
import com.huawei.phoneservice.feedback.R$plurals;
import com.huawei.phoneservice.feedback.R$string;
import com.huawei.phoneservice.feedback.adapter.ProblemSuggestPhotoAdapter;
import com.huawei.phoneservice.feedback.adapter.f;
import com.huawei.phoneservice.feedback.entity.FeedbackBean;
import com.huawei.phoneservice.feedback.mvp.base.FeedbackBaseActivity;
import com.huawei.phoneservice.feedback.photolibrary.internal.widget.BadgeHelper;
import com.huawei.phoneservice.feedback.widget.AutoLineLayoutManager;
import com.huawei.phoneservice.feedback.widget.ClickUrlSpan;
import com.huawei.phoneservice.feedback.widget.FeedbackNoticeView;
import com.huawei.phoneservice.feedbackcommon.entity.FeedbackInfo;
import com.huawei.phoneservice.feedbackcommon.entity.ProblemInfo;
import com.huawei.phoneservice.feedbackcommon.entity.QueryIsoLanguageResponse;
import com.huawei.phoneservice.feedbackcommon.entity.QueryNoticeResponse;
import com.huawei.phoneservice.feedbackcommon.network.FeedbackWebConstants;
import com.huawei.phoneservice.feedbackcommon.photolibrary.internal.entity.MediaItem;
import com.huawei.phoneservice.feedbackcommon.utils.AsCache;
import com.huawei.phoneservice.feedbackcommon.utils.CharInputFilter;
import com.huawei.phoneservice.feedbackcommon.utils.EmojiFilter;
import com.huawei.phoneservice.feedbackcommon.utils.FaqRegexMatches;
import com.huawei.phoneservice.feedbackcommon.utils.FeedbackCommonManager;
import com.huawei.phoneservice.feedbackcommon.utils.NetworkUtils;
import com.huawei.phoneservice.feedbackcommon.utils.OnReadListener;
import com.huawei.phoneservice.feedbackcommon.utils.SdkProblemListener;
import com.huawei.phoneservice.feedbackcommon.utils.SdkProblemManager;
import com.huawei.phoneservice.feedbackcommon.utils.UriDeserializer;
import com.huawei.phoneservice.feedbackcommon.utils.UriSerializer;
import com.huawei.phoneservice.feedbackcommon.utils.ZipUtil;
import com.huawei.secure.android.common.intent.SafeBundle;
import com.huawei.secure.android.common.intent.SafeIntent;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;

public class ProblemSuggestActivity extends FeedbackBaseActivity<com.huawei.phoneservice.feedback.mvp.presenter.a> implements View.OnClickListener, com.huawei.phoneservice.feedback.mvp.contract.a, View.OnFocusChangeListener, ProblemSuggestPhotoAdapter.b {
    public AsCache A;
    public FeedbackBean B;
    public TextView I;
    public TextView J;
    public TextView K;
    public LinearLayout L;
    public TextView N;
    public RecyclerView O;
    public com.huawei.phoneservice.feedback.adapter.f P;
    public EditText Q;
    public ProblemSuggestPhotoAdapter R;
    public TextView S;
    public LinearLayout T;
    public EditText U;
    public RelativeLayout V;
    public CheckBox W;
    public TextView a0;
    public Button b0;
    public TextView c0;
    public LinearLayout d0;
    public Button e0;
    public FeedbackNoticeView f0;
    public boolean g0;
    public boolean h0;
    public boolean i0;
    public boolean j0;
    public boolean k0;
    public boolean l0;
    public ScrollView m0;
    public GridView n0;
    public boolean o0;
    public boolean p0;
    public boolean q0;
    public boolean r0;
    public boolean s0;
    public boolean u0;
    public com.huawei.phoneservice.feedback.mvp.presenter.a z;
    public int C = 0;
    public boolean D = false;
    public boolean E = false;
    public boolean F = false;
    public boolean G = true;
    public int H = 0;
    public int t0 = 10;

    public static class a implements View.OnTouchListener {
        public a() {
        }

        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            return false;
        }

        public a(l lVar) {
            this();
        }
    }

    public class a0 implements DialogInterface.OnClickListener {
        public final List a;

        public a0(List list) {
            this.a = list;
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            TextView textView;
            String str;
            List list = this.a;
            if (list == null || i < 0 || i >= list.size()) {
                return;
            }
            com.huawei.phoneservice.feedback.entity.b bVar = (com.huawei.phoneservice.feedback.entity.b) this.a.get(i);
            boolean equals = bVar.a.equals(ProblemSuggestActivity.this.B.getParentId());
            if (dialogInterface != null) {
                dialogInterface.dismiss();
            }
            List<com.huawei.phoneservice.feedback.entity.e> list2 = bVar.d;
            if (list2 != null && list2.size() > 0) {
                ProblemSuggestActivity.this.e0(bVar);
                return;
            }
            if (equals) {
                ProblemSuggestActivity.this.B.setProblemType(null, null);
                textView = ProblemSuggestActivity.this.J;
                str = "";
            } else {
                ProblemSuggestActivity.this.B.setProblemType(bVar.a, null);
                textView = ProblemSuggestActivity.this.J;
                str = bVar.b;
            }
            textView.setText(str);
        }
    }

    public class b implements DialogInterface.OnClickListener {
        public final com.huawei.phoneservice.feedback.entity.b a;

        public b(com.huawei.phoneservice.feedback.entity.b bVar) {
            this.a = bVar;
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            TextView textView;
            String str;
            com.huawei.phoneservice.feedback.entity.e eVar = this.a.d.get(i);
            boolean equals = eVar.a.equals(ProblemSuggestActivity.this.B.getChildId());
            if (dialogInterface != null) {
                dialogInterface.dismiss();
            }
            FeedbackBean feedbackBean = ProblemSuggestActivity.this.B;
            if (equals) {
                feedbackBean.setProblemType(null, null);
                textView = ProblemSuggestActivity.this.J;
                str = "";
            } else {
                feedbackBean.setProblemType(this.a.a, eVar.a);
                textView = ProblemSuggestActivity.this.J;
                str = eVar.b;
            }
            textView.setText(str);
        }
    }

    public class c implements View.OnClickListener {
        public c() {
        }

        @Override
        public void onClick(View view) {
            if (NoDoubleClickUtil.isDoubleClick(view)) {
                return;
            }
            ProblemSuggestActivity.this.w();
            ProblemSuggestActivity.this.I();
        }
    }

    public class d implements View.OnClickListener {
        public d() {
        }

        @Override
        public void onClick(View view) {
            AlertDialog alertDialog = ProblemSuggestActivity.this.d;
            if (alertDialog != null) {
                alertDialog.dismiss();
            }
        }
    }

    public class e implements View.OnClickListener {
        public e() {
        }

        @Override
        public void onClick(View view) {
            if (NoDoubleClickUtil.isDoubleClick(view)) {
                return;
            }
            ProblemSuggestActivity.this.w();
            ProblemSuggestActivity.this.k0 = true;
            FaqLogger.d("ProblemSuggestActivity_", "break submit " + ProblemSuggestActivity.this.B.getLogsSize() + " " + ProblemSuggestActivity.this.B.getShowLog() + " " + ProblemSuggestActivity.this.g0);
            if (!ProblemSuggestActivity.this.B.getShowLog()) {
                ProblemSuggestActivity.this.I();
            } else {
                ProblemSuggestActivity.this.e0.setVisibility(0);
                ProblemSuggestActivity.this.U();
            }
        }
    }

    public class f implements View.OnClickListener {
        public f() {
        }

        @Override
        public void onClick(View view) {
            if (NoDoubleClickUtil.isDoubleClick(view)) {
                return;
            }
            ProblemSuggestActivity.this.G();
        }
    }

    public class g implements View.OnClickListener {
        public g() {
        }

        @Override
        public void onClick(View view) {
            if (NoDoubleClickUtil.isDoubleClick(view)) {
                return;
            }
            ProblemSuggestActivity.this.w();
            ProblemSuggestActivity.this.z.E();
            FaqSdk.getISdk().onClick(ProblemSuggestActivity.this.getClass().getName(), "Quit", ProblemSuggestActivity.this.B);
        }
    }

    public class h implements View.OnClickListener {
        public h() {
        }

        @Override
        public void onClick(View view) {
            if (NoDoubleClickUtil.isDoubleClick(view)) {
                return;
            }
            ProblemSuggestActivity.this.w();
            ProblemSuggestActivity.this.z.C();
            FaqSdk.getISdk().onClick(ProblemSuggestActivity.this.getClass().getName(), "Cancel", ProblemSuggestActivity.this.B);
        }
    }

    public class i implements Runnable {
        public final SdkProblemListener a;
        public final String b;
        public final String c;

        public i(SdkProblemListener sdkProblemListener, String str, String str2) {
            this.a = sdkProblemListener;
            this.b = str;
            this.c = str2;
        }

        @Override
        public void run() {
            SdkProblemListener sdkProblemListener = this.a;
            if (sdkProblemListener != null) {
                sdkProblemListener.onSubmitResult(0, this.b, this.c, ProblemSuggestActivity.this.B.getSrCode(), null);
            }
            if (!FaqStringUtil.isEmpty(SdkProblemManager.getSdk().getSdk("accessToken")) && ProblemSuggestActivity.this.H == 0) {
                ProblemSuggestActivity.this.C0(this.b);
                return;
            }
            Intent intent = new Intent();
            intent.putExtra("parentProblemId", this.c);
            intent.putExtra("problemId", this.b);
            intent.putExtra("srCode", ProblemSuggestActivity.this.B.getSrCode());
            ProblemSuggestActivity.this.setResult(-1, intent);
            if (ProblemSuggestActivity.this.A != null) {
                ProblemSuggestActivity.this.A.remove("feedBackCache");
            }
            ProblemSuggestActivity.this.finish();
        }
    }

    public class k implements f.c {
        public final List a;

        public k(List list) {
            this.a = list;
        }

        @Override
        public void a(int i) {
            if (i < 0) {
                ProblemSuggestActivity.this.B.setProblemType(null, null);
                ProblemSuggestActivity.this.J.setText("");
            } else {
                com.huawei.phoneservice.feedback.entity.b bVar = (com.huawei.phoneservice.feedback.entity.b) this.a.get(i);
                ProblemSuggestActivity.this.B.setProblemType(bVar.a, null);
                ProblemSuggestActivity.this.J.setText(bVar.b);
            }
        }
    }

    public class l implements CompoundButton.OnCheckedChangeListener {
        public l() {
        }

        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
            ProblemSuggestActivity.this.g0 = z;
            if (!z) {
                ProblemSuggestActivity.this.i0 = true;
                ProblemSuggestActivity.this.c0.setVisibility(8);
                ProblemSuggestActivity.this.N.setVisibility(8);
                ProblemSuggestActivity.this.d0.setVisibility(8);
                ProblemSuggestActivity.this.R();
                ProblemSuggestActivity.this.l0 = false;
            }
            ProblemSuggestActivity problemSuggestActivity = ProblemSuggestActivity.this;
            problemSuggestActivity.j0 = (problemSuggestActivity.h0 && !ProblemSuggestActivity.this.i0) || ProblemSuggestActivity.this.l0 || ProblemSuggestActivity.this.k0;
            ProblemSuggestActivity.this.B.setShowLog(z);
        }
    }

    public class m implements Runnable {
        public final com.huawei.phoneservice.feedback.utils.a a;

        public m(com.huawei.phoneservice.feedback.utils.a aVar) {
            this.a = aVar;
        }

        @Override
        public void run() {
            ProblemSuggestActivity.this.d0.setVisibility(8);
            boolean z = true;
            ProblemSuggestActivity.this.b0.setEnabled(true);
            com.huawei.phoneservice.feedback.utils.a aVar = this.a;
            com.huawei.phoneservice.feedback.utils.a aVar2 = com.huawei.phoneservice.feedback.utils.a.ZIP_COMPRESS_SUCCESS;
            if ((aVar != aVar2 || !ProblemSuggestActivity.this.o0) && (this.a != aVar2 || (!ProblemSuggestActivity.this.k0 && !ProblemSuggestActivity.this.l0))) {
                z = false;
            }
            if (this.a != com.huawei.phoneservice.feedback.utils.a.ZIP_COMPRESS_FAILED) {
                if (z) {
                    ProblemSuggestActivity.this.c0();
                    return;
                }
                return;
            }
            ProblemSuggestActivity.this.e0.setVisibility(8);
            if (ProblemSuggestActivity.this.g0) {
                if (ProblemSuggestActivity.this.k0 || ((ProblemSuggestActivity.this.h0 && !ProblemSuggestActivity.this.i0) || ProblemSuggestActivity.this.l0)) {
                    ProblemSuggestActivity.this.b0.setEnabled(false);
                    ProblemSuggestActivity.this.c0.setVisibility(0);
                }
            }
        }
    }

    public class n implements Runnable {
        public n() {
        }

        @Override
        public void run() {
            ProblemSuggestActivity.this.G = true;
            ProblemSuggestActivity.this.z.F();
        }
    }

    public class o implements Runnable {
        public o() {
        }

        @Override
        public void run() {
            ProblemSuggestActivity.this.G = true;
            ProblemSuggestActivity.this.z.F();
        }
    }

    public class p implements View.OnClickListener {
        public p() {
        }

        @Override
        public void onClick(View view) {
            AlertDialog alertDialog;
            if (NoDoubleClickUtil.isDoubleClick(view) || (alertDialog = ProblemSuggestActivity.this.d) == null) {
                return;
            }
            alertDialog.dismiss();
        }
    }

    public class q implements View.OnClickListener {
        public q() {
        }

        @Override
        public void onClick(View view) {
            if (NoDoubleClickUtil.isDoubleClick(view) || ProblemSuggestActivity.this.B == null) {
                return;
            }
            if (ProblemSuggestActivity.this.A != null) {
                ProblemSuggestActivity.this.A.remove("feedBackCache");
            }
            ProblemSuggestActivity.this.K();
        }
    }

    public class r implements View.OnClickListener {
        public r() {
        }

        @Override
        public void onClick(View view) {
            if (NoDoubleClickUtil.isDoubleClick(view)) {
                return;
            }
            ProblemSuggestActivity.this.E();
            ProblemSuggestActivity.this.finish();
        }
    }

    public class s implements View.OnClickListener {
        public s() {
        }

        @Override
        public void onClick(View view) {
            if (NoDoubleClickUtil.isDoubleClick(view)) {
                return;
            }
            if (ProblemSuggestActivity.this.A != null) {
                ProblemSuggestActivity.this.A.remove("feedBackCache");
            }
            ProblemSuggestActivity problemSuggestActivity = ProblemSuggestActivity.this;
            problemSuggestActivity.a(problemSuggestActivity.B);
            ProblemSuggestActivity.this.finish();
        }
    }

    public class t implements View.OnClickListener {
        public t() {
        }

        @Override
        public void onClick(View view) {
            ProblemSuggestActivity.this.W.setChecked(!ProblemSuggestActivity.this.W.isChecked());
        }
    }

    public class u implements View.OnTouchListener {
        public u() {
        }

        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            if (view.getId() == R$id.edit_desc && com.huawei.phoneservice.feedback.photolibrary.internal.utils.b.b(ProblemSuggestActivity.this.Q)) {
                view.getParent().requestDisallowInterceptTouchEvent(true);
                if (motionEvent.getAction() == 1) {
                    view.getParent().requestDisallowInterceptTouchEvent(false);
                }
            }
            return false;
        }
    }

    public class x extends FaqCallback<QueryIsoLanguageResponse> {
        public x(Class cls, Activity activity) {
            super(cls, activity);
        }

        @Override
        public void onResult(@Nullable Throwable th, @Nullable QueryIsoLanguageResponse queryIsoLanguageResponse) {
            if (th == null && queryIsoLanguageResponse != null) {
                String langCode = queryIsoLanguageResponse.getLangCode();
                if (!TextUtils.isEmpty(langCode)) {
                    ProblemSuggestActivity.this.f(langCode);
                    return;
                }
            }
            ProblemSuggestActivity.this.a0.setVisibility(8);
        }
    }

    public class y extends FaqCallback<QueryNoticeResponse> {
        public y(Class cls, Activity activity) {
            super(cls, activity);
        }

        @Override
        public void onResult(@Nullable Throwable th, @Nullable QueryNoticeResponse queryNoticeResponse) {
            TextView textView;
            int i;
            if (th == null && queryNoticeResponse != null) {
                String content = queryNoticeResponse.getContent();
                if (!TextUtils.isEmpty(content)) {
                    ProblemSuggestActivity.this.a0.setText(Html.fromHtml(content));
                    ClickUrlSpan.a(ProblemSuggestActivity.this.a0);
                    textView = ProblemSuggestActivity.this.a0;
                    i = 0;
                    textView.setVisibility(i);
                }
            }
            textView = ProblemSuggestActivity.this.a0;
            i = 8;
            textView.setVisibility(i);
        }
    }

    public class z implements View.OnClickListener {
        public z() {
        }

        @Override
        public void onClick(View view) {
            if (NoDoubleClickUtil.isDoubleClick(view) || !ProblemSuggestActivity.this.z.u() || ProblemSuggestActivity.this.e0.getVisibility() == 0) {
                return;
            }
            ProblemSuggestActivity.this.C = 0;
            ProblemSuggestActivity.this.invalidateOptionsMenu();
            ProblemSuggestActivity.this.startActivity(new Intent((Context) ProblemSuggestActivity.this, (Class<?>) FeedListActivity.class));
            FaqSdk.getISdk().onClick(ProblemSuggestActivity.this.getClass().getName(), "Click", ProblemSuggestActivity.this.B);
        }
    }

    private void D() {
        this.e0.setVisibility(0);
        if (this.G && this.g0) {
            this.k0 = true;
            s0(R$string.feedback_sdk_zipcompressing);
            return;
        }
        if (this.E && this.g0) {
            this.e0.setVisibility(8);
            this.k0 = false;
            c(getResources().getString(R$string.feedback_sdk_zipcompressfailed));
            this.c0.setVisibility(0);
            this.b0.setEnabled(false);
            return;
        }
        if (!NetworkUtils.isNetworkConnected(this)) {
            this.e0.setVisibility(8);
            c(getResources().getString(R$string.feedback_sdk_no_network));
        } else if ((!this.B.haveMedias() && (0 == this.B.getLogsSize() || !this.g0)) || NetworkUtils.isWifiConnected(this)) {
            I();
        } else {
            this.e0.setVisibility(8);
            e(com.huawei.quickcard.utils.NetworkUtils.NETWORK_TYPE_WIFI);
        }
    }

    public void E() {
        Gson create = new GsonBuilder().registerTypeAdapter(Uri.class, new UriSerializer()).create();
        FeedbackBean feedbackBean = this.B;
        if (feedbackBean != null) {
            feedbackBean.setContact("");
        }
        AsCache asCache = this.A;
        if (asCache != null) {
            asCache.put((Context) this, "feedBackCache", create.toJson(this.B));
        }
    }

    public void G() {
        FeedbackBean feedbackBean;
        AlertDialog alertDialog = this.d;
        if (alertDialog != null) {
            alertDialog.dismiss();
        }
        a(this.B);
        String srCode = this.B.getSrCode();
        AsCache asCache = this.A;
        if (asCache != null) {
            asCache.remove(TextUtils.isEmpty(srCode) ? "lastSubmit" : "lastSubmit_srCode");
        }
        if (this.V.getVisibility() == 0) {
            this.W.setChecked(this.B.getShowLog());
        }
        if (TextUtils.isEmpty(this.B.getSrCode())) {
            com.huawei.phoneservice.feedback.adapter.f fVar = this.P;
            if (fVar != null) {
                fVar.e(-1);
            }
            this.J.setText("");
            feedbackBean = new FeedbackBean();
        } else {
            String problemId = this.B.getProblemId();
            String problemType = this.B.getProblemType();
            feedbackBean = new FeedbackBean(srCode, problemId, problemType, problemType, this.B.getProblemName());
        }
        this.B = feedbackBean;
        this.z.w();
        this.B.setShowLog(this.h0);
        this.W.setChecked(this.h0);
        FaqLogger.d("ProblemSuggestActivity_", "break cancel " + this.B.getLogsSize() + " " + this.B.getShowLog() + " " + this.g0);
        z0(this.z.y());
        this.o0 = false;
        if (this.B.getShowLog()) {
            U();
        }
    }

    public void I() {
        this.k0 = true;
        Gson create = this.B.haveMedias() ? new GsonBuilder().registerTypeAdapter(Uri.class, new UriSerializer()).create() : new Gson();
        this.B.setProblemName((this.H == 2 ? this.K : this.J).getText().toString());
        String srCode = this.B.getSrCode();
        AsCache asCache = this.A;
        if (asCache != null) {
            asCache.put(TextUtils.isEmpty(srCode) ? "lastSubmit" : "lastSubmit_srCode", create.toJson(this.B), 172800);
        }
        FaqSdk.getISdk().onClick(getClass().getName(), "Submit", this.B);
        this.z.d(0, 0);
        this.z.j(this, this.g0);
    }

    public void K() {
        this.B.setParentId("");
        this.B.setChildId("");
        this.B.setProblemDesc("");
        a(this.B);
        List<MediaItem> medias = this.B.getMedias();
        if (medias != null) {
            medias.clear();
        }
        this.z.w();
        this.B.setContact("");
        this.B.setShowLog(this.h0);
        com.huawei.phoneservice.feedback.adapter.f fVar = this.P;
        if (fVar != null) {
            fVar.e(-1);
        }
        this.J.setText("");
        this.Q.setText(this.B.getProblemDesc());
        this.R.d(this.B.getMedias());
        this.U.setText(this.B.getContact());
        this.W.setChecked(this.B.getShowLog());
        AlertDialog alertDialog = this.d;
        if (alertDialog != null) {
            alertDialog.dismiss();
        }
    }

    private void M() {
        if (!ModuleConfigUtils.feedbackLogEnabled() || !ModuleConfigUtils.feedbackNoticeEnabled()) {
            this.a0.setVisibility(8);
            return;
        }
        String lowerCase = Locale.getDefault().getLanguage().toLowerCase(Locale.ENGLISH);
        if (Language.ZH.equals(lowerCase)) {
            lowerCase = Locale.getDefault().toLanguageTag().contains("zh-Hant") ? "zh-tw" : "zh-cn";
        }
        FeedbackCommonManager.INSTANCE.queryIsoLanguage(this, lowerCase, new x(QueryIsoLanguageResponse.class, this));
    }

    private void N() {
        SdkProblemManager.getManager().getUnread(this, "", new j());
    }

    private void P() {
        this.Q.addTextChangedListener(new v());
        this.U.addTextChangedListener(new w());
    }

    private void s0(int i2) {
        this.N.setVisibility(0);
        this.N.setText(i2);
        this.d0.setVisibility(0);
        this.b0.setEnabled(false);
    }

    public final boolean B() {
        FeedbackBean feedbackBean;
        return (this.H != 0 || (feedbackBean = this.B) == null || ((this.s0 || TextUtils.isEmpty(feedbackBean.getParentId())) && TextUtils.isEmpty(this.B.getProblemDesc()) && !this.B.haveMedias())) ? false : true;
    }

    public final void C0(String str) {
        Intent intent = new Intent((Context) this, (Class<?>) FeedbackSubmitSuccessActivity.class);
        intent.putExtra("problemId", str);
        startActivity(intent);
        AsCache asCache = this.A;
        if (asCache != null) {
            asCache.remove("feedBackCache");
        }
        finish();
    }

    public final void D0(List<com.huawei.phoneservice.feedback.entity.b> list) {
        this.O.setVisibility(0);
        this.J.setVisibility(8);
        this.O.setLayoutManager(new AutoLineLayoutManager());
        com.huawei.phoneservice.feedback.adapter.f fVar = new com.huawei.phoneservice.feedback.adapter.f(list, this);
        this.P = fVar;
        fVar.f(new k(list));
        this.O.setAdapter(this.P);
        if (TextUtils.isEmpty(this.B.getProblemType())) {
            return;
        }
        int size = list.size();
        for (int i2 = 0; i2 < size; i2++) {
            com.huawei.phoneservice.feedback.entity.b bVar = list.get(i2);
            if (bVar != null && bVar.a.equals(this.B.getParentId())) {
                this.P.e(i2);
                this.J.setText(bVar.b);
                return;
            }
        }
    }

    public final void F0(List<com.huawei.phoneservice.feedback.entity.b> list) {
        TextView textView;
        String str;
        List<com.huawei.phoneservice.feedback.entity.e> list2;
        this.O.setVisibility(8);
        this.J.setVisibility(0);
        this.J.setEnabled(true);
        if (TextUtils.isEmpty(this.B.getProblemType()) || list == null) {
            return;
        }
        for (com.huawei.phoneservice.feedback.entity.b bVar : list) {
            String str2 = bVar.a;
            if (str2 != null && str2.equals(this.B.getParentId())) {
                if (!TextUtils.isEmpty(this.B.getChildId()) && (list2 = bVar.d) != null && !list2.isEmpty()) {
                    for (com.huawei.phoneservice.feedback.entity.e eVar : bVar.d) {
                        String str3 = eVar.a;
                        if (str3 != null && str3.equals(this.B.getChildId())) {
                            textView = this.J;
                            str = eVar.b;
                        }
                    }
                    return;
                }
                textView = this.J;
                str = bVar.b;
                textView.setText(str);
                return;
            }
        }
    }

    public final void O() {
        GridView gridView;
        int i2;
        this.n0 = (GridView) findViewById(R$id.list_media);
        ProblemSuggestPhotoAdapter problemSuggestPhotoAdapter = new ProblemSuggestPhotoAdapter(this);
        this.R = problemSuggestPhotoAdapter;
        this.n0.setAdapter((ListAdapter) problemSuggestPhotoAdapter);
        this.n0.setNumColumns(x());
        String sdk = FaqSdk.getSdk().getSdk(FaqConstants.FAQ_HIDE_ADD_ATTACHMENT);
        if (sdk == null || !"Y".equals(sdk.toUpperCase(Locale.ROOT))) {
            gridView = this.n0;
            i2 = 0;
        } else {
            gridView = this.n0;
            i2 = 8;
        }
        gridView.setVisibility(i2);
    }

    public final void Q() {
        CharInputFilter charInputFilter = new CharInputFilter("[&<>\"'()\"\\n\" ]");
        EmojiFilter emojiFilter = new EmojiFilter();
        InputFilter.LengthFilter lengthFilter = new InputFilter.LengthFilter(500);
        InputFilter.LengthFilter lengthFilter2 = new InputFilter.LengthFilter(100);
        this.Q.setFilters(new InputFilter[]{lengthFilter, new AttackCharFilter()});
        this.U.setFilters(new InputFilter[]{charInputFilter, emojiFilter, lengthFilter2});
        this.Q.setOnFocusChangeListener(this);
        this.U.setOnFocusChangeListener(this);
        this.W.setOnCheckedChangeListener(new l());
        findViewById(R$id.cbx_text).setOnClickListener(new t());
        X();
    }

    public final void R() {
        if (!this.p0) {
            this.b0.setEnabled(this.F);
        } else {
            this.b0.setEnabled(true);
            this.p0 = false;
        }
    }

    public final void S() {
        this.b0.setEnabled(true);
    }

    @Override
    public com.huawei.phoneservice.feedback.mvp.presenter.a y() {
        com.huawei.phoneservice.feedback.mvp.presenter.a aVar = new com.huawei.phoneservice.feedback.mvp.presenter.a(this, this, this);
        this.z = aVar;
        return aVar;
    }

    public final void U() {
        ZipUtil.deleteFile(new File(FeedbackWebConstants.getZipFilePath(this)));
        boolean z2 = (this.h0 && !this.i0) || this.l0 || this.k0;
        this.j0 = z2;
        if (z2) {
            s0(R$string.feedback_sdk_zipcompressing);
        }
        new Handler().postDelayed(new n(), 500L);
    }

    public void V() {
        a(getString(R$string.feedback_sdk_tips_continue_to_submit), getString(R$string.feedback_sdk_appupdate3_continue), getString(R$string.feedback_sdk_common_cancel), new e(), new f());
    }

    public void W() {
        a(getString(R$string.feedback_sdk_tips_upload_waiting_or_exit_new), null, null, new g(), new h());
        this.z.A();
    }

    public final void X() {
        this.U.setOnTouchListener(new a(null));
        try {
            int parseInt = Integer.parseInt(FaqSdk.getSdk().getSdk(FaqConstants.FAQ_MIN_DESC_INPUT));
            this.t0 = parseInt;
            if (parseInt < 1 || parseInt > 10) {
                this.t0 = 10;
            }
        } catch (NumberFormatException unused) {
            this.t0 = 10;
        }
        EditText editText = this.Q;
        Resources resources = getResources();
        int i2 = R$plurals.feedback_sdk_problem_question_info_update;
        int i3 = this.t0;
        editText.setHint(resources.getQuantityString(i2, i3, Integer.valueOf(i3)));
        this.Q.setOnTouchListener(new u());
    }

    public final void Y() {
        a(getString(R$string.feedback_sdk_tips_save_edit), getString(R$string.feedback_sdk_common_yes), getString(R$string.feedback_sdk_common_no), new r(), new s());
    }

    public final boolean Z() {
        if (this.A == null) {
            return false;
        }
        if (!TextUtils.isEmpty(this.B.getSrCode())) {
            String asString = this.A.getAsString("lastSubmit_srCode");
            if (!TextUtils.isEmpty(asString)) {
                FeedbackBean feedbackBean = (FeedbackBean) new GsonBuilder().registerTypeAdapter(Uri.class, new UriDeserializer()).create().fromJson(asString, FeedbackBean.class);
                if (this.B.getSrCode().equals(feedbackBean.getSrCode())) {
                    this.B = feedbackBean;
                    return true;
                }
            }
        } else if (TextUtils.isEmpty(this.B.getProblemId())) {
            String asString2 = this.A.getAsString("lastSubmit");
            if (!TextUtils.isEmpty(asString2)) {
                this.B = (FeedbackBean) new GsonBuilder().registerTypeAdapter(Uri.class, new UriDeserializer()).create().fromJson(asString2, FeedbackBean.class);
                return true;
            }
        }
        return false;
    }

    @Override
    public void a() {
        String srCode = this.B.getSrCode();
        AsCache asCache = this.A;
        if (asCache != null) {
            asCache.remove(TextUtils.isEmpty(srCode) ? "lastSubmit" : "lastSubmit_srCode");
        }
        this.d0.setVisibility(8);
        this.e0.setVisibility(8);
        S();
    }

    public final void a0() {
        a(getString(R$string.feedback_sdk_tips_continue_edit), getString(R$string.feedback_sdk_common_yes), getString(R$string.feedback_sdk_common_no), new p(), new q());
    }

    @Override
    public FeedbackInfo b() {
        return this.B.getInfo();
    }

    public final void b0() {
        if (ModuleConfigUtils.feedbackLogEnabled()) {
            if (!TextUtils.isEmpty(this.B.getSrCode()) || TextUtils.isEmpty(SdkProblemManager.getSdk().getSdk(FaqConstants.FAQ_LOG_SERVER_APPID))) {
                this.V.setVisibility(8);
                return;
            }
            this.V.setVisibility(0);
            if (0 == this.B.getLogsSize()) {
                U();
            }
        }
    }

    @Override
    public FeedbackBean c() {
        return this.B;
    }

    public final void c0() {
        String string;
        Resources resources;
        int i2;
        FeedbackBean feedbackBean = this.B;
        if (feedbackBean == null) {
            return;
        }
        if (!TextUtils.isEmpty(feedbackBean.getSrCode()) || !TextUtils.isEmpty(this.B.getProblemType())) {
            if (TextUtils.isEmpty(this.B.getProblemDesc()) || this.B.getProblemDesc().trim().length() < this.t0) {
                string = getString(R$string.feedback_sdk_feedback_desc_hint, Integer.valueOf(this.t0));
                c(string);
            }
            if (this.T.getVisibility() == 0) {
                String contact = this.B.getContact();
                if (this.u0 || !TextUtils.isEmpty(contact)) {
                    boolean isEmail = FaqRegexMatches.isEmail(contact);
                    boolean isMobile = FaqRegexMatches.isMobile(contact);
                    String string2 = getResources().getString(R$string.feedback_sdk_problem_please_check_phone_email_formatted);
                    if (this.u0) {
                        if (!TextUtils.isEmpty(contact) && !isEmail && !isMobile) {
                            c(string2);
                            return;
                        }
                    } else if (!isEmail && !isMobile) {
                        c(string2);
                        return;
                    }
                } else {
                    resources = getResources();
                    i2 = R$string.feedback_sdk_problem_phone_email;
                }
            }
            D();
            return;
        }
        resources = getResources();
        i2 = R$string.feedback_sdk_problem_choose_question_type;
        string = resources.getString(i2);
        c(string);
    }

    @Override
    public void e() {
        s0(R$string.feedback_sdk_common_in_submission);
        this.e0.setVisibility(0);
    }

    public void e0(com.huawei.phoneservice.feedback.entity.b bVar) {
        List<com.huawei.phoneservice.feedback.entity.e> list;
        int size = (bVar == null || (list = bVar.d) == null) ? 0 : list.size();
        String[] strArr = new String[size];
        int i2 = -1;
        for (int i3 = 0; i3 < size; i3++) {
            strArr[i3] = bVar.d.get(i3).b;
            if (bVar.d.get(i3).a.equals(this.B.getChildId())) {
                i2 = i3;
            }
        }
        if (bVar == null) {
            return;
        }
        a(this, bVar.b, getString(R$string.feedback_sdk_common_cancel), strArr, i2, new b(bVar));
    }

    @Override
    public void f() {
        z();
    }

    public final void h0(ProblemInfo problemInfo) {
        if (problemInfo != null && problemInfo.isInteract()) {
            this.H = 2;
            this.B = new FeedbackBean(problemInfo.getSrCode(), problemInfo.getProblemId(), problemInfo.getProblemType(), problemInfo.getProblemType(), problemInfo.getProblemName());
            b(this.z.y());
            return;
        }
        if (problemInfo == null || !problemInfo.isDetail()) {
            this.C = problemInfo == null ? 0 : problemInfo.getUnread();
            this.H = 0;
            if (this.B == null) {
                this.B = new FeedbackBean();
            }
        } else {
            this.H = 1;
            if (this.B == null) {
                this.B = new FeedbackBean(problemInfo.getProblemId(), problemInfo.getProblemType(), problemInfo.getProblemType(), problemInfo.getContact());
            }
        }
        this.z.r(this, false);
    }

    @Override
    public int j() {
        return R$layout.feedback_sdk_activity_problem_suggest;
    }

    @Override
    public int[] k() {
        return new int[]{R$id.ll_category, R$id.txt_style, R$id.txt_style_2, R$id.grid_styles, R$id.ll_description, R$id.rl_description, R$id.ll_contact, R$id.problem_suggest_tv_privacy, R$id.edit_contact, R$id.cbx_log};
    }

    public final void k0(View view, boolean z2) {
        String obj;
        EditText editText = (EditText) view;
        if (editText == null) {
            return;
        }
        if (z2) {
            CharSequence hint = editText.getHint();
            if (hint != null) {
                editText.setTag(hint.toString());
            }
            obj = "";
        } else {
            Object tag = editText.getTag();
            if (tag == null) {
                return;
            } else {
                obj = tag.toString();
            }
        }
        editText.setHint(obj);
    }

    @Override
    public void l() {
        this.f0.j(FeedbackNoticeView.c.PROGRESS);
        M();
        if (!FaqCommonUtils.isConnectionAvailable(this)) {
            a(FaqConstants.FaqErrorCode.INTERNET_ERROR);
            return;
        }
        try {
            this.A = AsCache.get(this, AsCache.FEED_BACK_CACHE_FILE_NAME);
        } catch (IOException | RuntimeException e2) {
            FaqLogger.print("ProblemSuggestActivity_", e2.getMessage());
        }
        SafeIntent safeIntent = new SafeIntent(getIntent());
        h0(safeIntent.hasExtra("problem_info") ? (ProblemInfo) safeIntent.getParcelableExtra("problem_info") : null);
        this.W.setChecked(this.h0);
        boolean isChecked = this.W.isChecked();
        this.g0 = isChecked;
        this.B.setShowLog(isChecked);
        FaqLogger.e("ProblemSuggestActivity_", "   init data isChooseZip:" + this.g0);
    }

    @Override
    public void m() {
        this.R.c(this);
        P();
        this.J.setOnClickListener(this);
        this.b0.setOnClickListener(this);
        this.f0.setOnClickListener(this);
        this.c0.setOnClickListener(this);
    }

    @Override
    public void n() {
        boolean equals = FaqConstants.MODULE_KNOWLEDGE.equals(SdkProblemManager.getSdk().getSdk(FaqConstants.FAQ_ISSELECTED));
        this.h0 = equals;
        this.p0 = !equals;
        setTitle(R$string.faq_sdk_feedback);
        TextView textView = (TextView) findViewById(R$id.description);
        textView.getPaint().setFakeBoldText(true);
        StringBuilder sb = new StringBuilder();
        sb.append(getString(R$string.feedback_sdk_problem_question_info_advice));
        sb.append(" ");
        int i2 = R$string.feedback_sdk_required_fields;
        sb.append(getString(i2));
        textView.setContentDescription(sb.toString());
        TextView textView2 = (TextView) findViewById(R$id.feedback_contact_view);
        textView2.getPaint().setFakeBoldText(true);
        textView2.setContentDescription(getString(R$string.feedback_sdk_problem_contact_type) + " " + getString(i2));
        this.L = (LinearLayout) findViewById(R$id.ll_category);
        TextView textView3 = (TextView) findViewById(R$id.txt_style_title);
        this.I = textView3;
        textView3.setContentDescription(getString(R$string.feedback_sdk_problem_type) + " " + getString(R$string.feedback_sdk_mandatory));
        this.J = (TextView) findViewById(R$id.txt_style);
        this.K = (TextView) findViewById(R$id.txt_style_2);
        this.O = findViewById(R$id.grid_styles);
        this.Q = (EditText) findViewById(R$id.edit_desc);
        this.S = (TextView) findViewById(R$id.txt_number);
        this.c0 = (TextView) findViewById(R$id.tv_tryagain);
        this.N = (TextView) findViewById(R$id.tv_progress);
        this.S.setText(String.format(getResources().getString(R$string.feedback_sdk_problem_input_number), 0, 500));
        O();
        ImageView imageView = (ImageView) findViewById(R$id.feedback_contact_red_star);
        boolean equalsIgnoreCase = "Y".equalsIgnoreCase(SdkProblemManager.getSdk().getSdk(FaqConstants.FAQ_CONTACT_NOT_NECESSARY));
        this.u0 = equalsIgnoreCase;
        imageView.setVisibility(equalsIgnoreCase ? 8 : 0);
        this.U = (EditText) findViewById(R$id.edit_contact);
        this.V = (RelativeLayout) findViewById(R$id.cbx_host);
        this.W = (CheckBox) findViewById(R$id.cbx_log);
        this.a0 = (TextView) findViewById(R$id.problem_suggest_tv_privacy);
        Button button = (Button) findViewById(R$id.btn_submit);
        this.b0 = button;
        com.huawei.phoneservice.feedback.photolibrary.internal.utils.b.a(this, button);
        this.d0 = (LinearLayout) findViewById(R$id.layout_loading);
        this.e0 = (Button) findViewById(R$id.bg_dismiss);
        ScrollView scrollView = (ScrollView) findViewById(R$id.scroll_view);
        this.m0 = scrollView;
        scrollView.setOverScrollMode(0);
        this.T = (LinearLayout) findViewById(R$id.ll_phone_or_email);
        this.f0 = (FeedbackNoticeView) findViewById(R$id.feedback_problem_noticeView);
        Q();
        this.I.getPaint().setFakeBoldText(true);
        this.J.getPaint().setFakeBoldText(true);
    }

    public void onActivityResult(int i2, int i3, @Nullable Intent intent) {
        List<MediaItem> a2;
        super.onActivityResult(i2, i3, intent);
        SafeIntent safeIntent = new SafeIntent(intent);
        if (i2 != 100 || safeIntent.getData() == null || (a2 = a(safeIntent, this.B)) == null) {
            return;
        }
        this.B.setMedias(a2);
        this.R.d(a2);
        this.z.e(this);
    }

    public void onBackPressed() {
        FeedbackBean feedbackBean;
        AsCache asCache;
        AlertDialog alertDialog = this.d;
        if (alertDialog != null && alertDialog.isShowing()) {
            this.d.dismiss();
            return;
        }
        if (!this.z.u()) {
            W();
            return;
        }
        if (this.e0.getVisibility() == 0) {
            return;
        }
        FaqCommonUtils.hideIme(this);
        if (B()) {
            Y();
            return;
        }
        if (this.H == 0 && (feedbackBean = this.B) != null && TextUtils.isEmpty(feedbackBean.getParentId()) && TextUtils.isEmpty(this.B.getProblemDesc()) && !this.B.haveMedias() && (asCache = this.A) != null) {
            asCache.remove("feedBackCache");
        }
        super/*androidx.activity.ComponentActivity*/.onBackPressed();
    }

    @Override
    public void onClick(View view) {
        if (NoDoubleClickUtil.isDoubleClick(view)) {
            return;
        }
        int id = view.getId();
        if (id == R$id.txt_style) {
            w0(this.z.y());
            return;
        }
        if (id == R$id.btn_submit) {
            FaqCommonUtils.hideIme(this);
            c0();
            return;
        }
        if (view.getId() == R$id.feedback_problem_noticeView) {
            l();
            return;
        }
        if (view.getId() == R$id.tv_tryagain) {
            this.l0 = true;
            this.c0.setVisibility(8);
            ZipUtil.deleteFile(new File(FeedbackWebConstants.getZipFilePath(this)));
            s0(R$string.feedback_sdk_zipcompress_again);
            this.o0 = false;
            new Handler().postDelayed(new o(), 500L);
        }
    }

    @Override
    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        this.n0.setNumColumns(x());
        Button button = this.b0;
        if (button != null) {
            com.huawei.phoneservice.feedback.photolibrary.internal.utils.b.a(this, button);
        }
    }

    @Override
    public void onCreate(@Nullable Bundle bundle) {
        if (bundle != null) {
            SafeBundle safeBundle = new SafeBundle(bundle);
            this.B = (FeedbackBean) safeBundle.getParcelable("FeedbackBean");
            FaqSdk.getSdk().saveMapOnSaveInstanceState(safeBundle.getString("CacheMap"));
            FeedbackBean feedbackBean = this.B;
            this.r0 = feedbackBean != null;
            if (feedbackBean != null) {
                this.G = feedbackBean.getLogsSize() == 0;
            }
            this.F = safeBundle.getBoolean("isCompress");
        }
        super.onCreate(bundle);
    }

    @Override
    public void onFocusChange(View view, boolean z2) {
        int id = view.getId();
        if (id == R$id.edit_contact || id == R$id.edit_desc) {
            k0(view, z2);
        }
    }

    public boolean onPrepareOptionsMenu(Menu menu) {
        menu.clear();
        getMenuInflater().inflate(R$menu.feedback_sdk_problem_menu_item, menu);
        MenuItem findItem = menu.findItem(R$id.feedback_sdk_show_history);
        View actionView = findItem.getActionView();
        new BadgeHelper(this).b(true).a((ImageView) actionView.findViewById(R$id.menu_history)).setBadgeNumber(this.C);
        actionView.setOnClickListener(new z());
        findItem.setVisible(this.D);
        return super/*android.app.Activity*/.onPrepareOptionsMenu(menu);
    }

    public void onSaveInstanceState(@NonNull Bundle bundle) {
        super/*androidx.activity.ComponentActivity*/.onSaveInstanceState(bundle);
        bundle.putParcelable("FeedbackBean", this.B);
        bundle.putString("CacheMap", FaqSdk.getSdk().getMapOnSaveInstance());
        bundle.putBoolean("isCompress", this.F);
    }

    public final void p0(List<com.huawei.phoneservice.feedback.entity.b> list) {
        List<com.huawei.phoneservice.feedback.entity.e> list2;
        for (com.huawei.phoneservice.feedback.entity.b bVar : list) {
            if (!TextUtils.isEmpty(this.B.getChildId()) && (list2 = bVar.d) != null && !list2.isEmpty()) {
                Iterator<com.huawei.phoneservice.feedback.entity.e> it = bVar.d.iterator();
                while (true) {
                    if (!it.hasNext()) {
                        break;
                    }
                    String str = it.next().a;
                    if (str != null && str.equals(this.B.getChildId())) {
                        this.B.setParentId(bVar.a);
                        break;
                    }
                }
            }
        }
    }

    public final boolean u0(List<com.huawei.phoneservice.feedback.entity.b> list) {
        for (com.huawei.phoneservice.feedback.entity.b bVar : list) {
            if (bVar != null && !FaqCommonUtils.isEmpty(bVar.d) && bVar.d.size() > 0) {
                return true;
            }
        }
        return false;
    }

    public void w0(List<com.huawei.phoneservice.feedback.entity.b> list) {
        int size = list == null ? 0 : list.size();
        String[] strArr = new String[size];
        int i2 = -1;
        for (int i3 = 0; i3 < size; i3++) {
            strArr[i3] = list.get(i3).b;
            if (list.get(i3).a.equals(this.B.getParentId())) {
                i2 = i3;
            }
        }
        a(this, getString(R$string.feedback_sdk_problem_type), getString(R$string.feedback_sdk_common_cancel), strArr, i2, new a0(list));
    }

    public final void z0(List<com.huawei.phoneservice.feedback.entity.b> list) {
        if (TextUtils.isEmpty(this.B.getSrCode())) {
            this.I.setVisibility(0);
            this.K.setVisibility(8);
            if (u0(list)) {
                if (this.H == 1) {
                    p0(list);
                }
                F0(list);
            } else {
                D0(list);
            }
            if (!TextUtils.isEmpty(this.B.getProblemId())) {
                this.D = false;
                invalidateOptionsMenu();
            } else if (!FaqStringUtil.isEmpty(SdkProblemManager.getSdk().getSdk("accessToken")) && ModuleConfigUtils.feedbackHistoryEnabled()) {
                this.D = true;
                invalidateOptionsMenu();
                if (this.C <= 0) {
                    N();
                }
            }
            this.T.setVisibility(8);
            if (ModuleConfigUtils.feedbackContactEnabled()) {
                this.T.setVisibility(0);
            }
        } else {
            this.J.setVisibility(8);
            if (TextUtils.isEmpty(this.B.getProblemName())) {
                this.I.setVisibility(8);
                this.K.setVisibility(8);
                this.O.setVisibility(8);
            } else {
                this.I.setVisibility(0);
                this.K.setVisibility(0);
                this.O.setVisibility(8);
                this.K.setText(this.B.getProblemName());
            }
            this.D = false;
            invalidateOptionsMenu();
            this.T.setVisibility(8);
        }
        this.Q.setText(this.B.getProblemDesc());
        this.Q.setSelection(this.B.getProblemDesc().length());
        this.R.d(this.B.getMedias());
        this.U.setText(this.B.getContact());
        this.W.setChecked(this.B.getShowLog());
    }

    public void f(String str) {
        FeedbackCommonManager.INSTANCE.queryNotice(this, str, new y(QueryNoticeResponse.class, this));
    }

    @Override
    public void a(int i2) {
        FeedbackBean feedbackBean = this.B;
        if (feedbackBean != null) {
            a(feedbackBean.getMediaItem(i2));
        }
    }

    @Override
    public void b(int i2) {
        a(this.B, i2);
        this.B.remove(i2);
        this.R.d(this.B.getMedias());
        this.n0.setAdapter((ListAdapter) this.R);
        this.z.e(this);
    }

    @Override
    public void c(int i2) {
    }

    public void e(String str) {
        long filesSize = this.g0 ? this.B.getFilesSize() + this.B.getLogsSize() : this.B.getFilesSize();
        if (filesSize == 0) {
            filesSize = 1;
        }
        a(filesSize, new c(), new d());
    }

    @Override
    public void a(FaqConstants.FaqErrorCode faqErrorCode) {
        FeedbackBean feedbackBean;
        u();
        if (faqErrorCode == FaqConstants.FaqErrorCode.INTERNET_ERROR) {
            this.f0.g(faqErrorCode);
            this.f0.setVisibility(0);
            this.f0.setEnabled(true);
            return;
        }
        this.s0 = true;
        this.f0.setVisibility(8);
        this.L.setVisibility(8);
        if (this.H == 0 && (feedbackBean = this.B) != null) {
            feedbackBean.setProblemType("1004003", null);
        }
        FeedbackBean feedbackBean2 = this.B;
        if (feedbackBean2 != null && !TextUtils.isEmpty(feedbackBean2.getProblemId())) {
            this.D = false;
            invalidateOptionsMenu();
        } else if (ModuleConfigUtils.feedbackHistoryEnabled() && !FaqStringUtil.isEmpty(SdkProblemManager.getSdk().getSdk("accessToken"))) {
            this.D = true;
            invalidateOptionsMenu();
            if (this.C <= 0) {
                N();
            }
        }
        if (ModuleConfigUtils.feedbackContactEnabled()) {
            this.T.setVisibility(0);
        }
        this.Q.setText(this.B.getProblemDesc());
        this.U.setText(this.B.getContact());
        b0();
    }

    @Override
    public void b(String str) {
    }

    @Override
    public void c(String str) {
        FaqToastUtils.makeText(this, str);
        Log.e("ProblemSuggestActivity_", "showToast...." + str);
        if (this.k0) {
            this.b0.setEnabled(true);
        }
        this.k0 = false;
    }

    @Override
    public void a(com.huawei.phoneservice.feedback.utils.a aVar) {
        int i2;
        this.G = false;
        this.j0 = (this.h0 && !this.i0) || (this.l0 && this.g0) || (this.k0 && this.g0);
        StringBuilder sb = new StringBuilder();
        sb.append("zipCompressFinished  ");
        sb.append(this.h0);
        sb.append(" ");
        sb.append(!this.i0);
        sb.append(" ");
        sb.append(this.l0);
        sb.append(" ");
        sb.append(this.k0);
        sb.append(" ");
        sb.append(this.g0);
        sb.append(" ");
        sb.append(aVar.toString());
        FaqLogger.d("ProblemSuggestActivity_", sb.toString());
        if (aVar == com.huawei.phoneservice.feedback.utils.a.ZIP_COMPRESS_SUCCESS) {
            this.F = true;
            this.E = false;
            if (this.j0) {
                i2 = R$string.feedback_sdk_zipcompresssuccess;
                s0(i2);
            }
        } else if (aVar == com.huawei.phoneservice.feedback.utils.a.ZIP_COMPRESS_FAILED) {
            this.F = false;
            this.E = true;
            if (this.j0) {
                i2 = R$string.feedback_sdk_zipcompressfailed;
                s0(i2);
            }
        }
        new Handler().postDelayed(new m(aVar), 500L);
    }

    @Override
    public void b(List<com.huawei.phoneservice.feedback.entity.b> list) {
        AsCache asCache;
        u();
        this.m0.setVisibility(0);
        this.f0.setVisibility(8);
        boolean Z = Z();
        this.o0 = Z;
        if (!Z && (asCache = this.A) != null && !this.r0) {
            String asString = asCache.getAsString("feedBackCache");
            if (!TextUtils.isEmpty(asString)) {
                FeedbackBean feedbackBean = (FeedbackBean) new GsonBuilder().registerTypeAdapter(Uri.class, new UriDeserializer()).create().fromJson(asString, FeedbackBean.class);
                this.B = feedbackBean;
                if (feedbackBean != null) {
                    this.q0 = true;
                    feedbackBean.setLogsSize(0L);
                } else {
                    FeedbackBean feedbackBean2 = new FeedbackBean();
                    this.B = feedbackBean2;
                    feedbackBean2.setShowLog(this.h0);
                }
            }
        }
        z0(list);
        b0();
        if (this.B.haveMedias()) {
            this.z.e(this);
            this.R.d(this.B.getMedias());
        }
        if (this.o0) {
            V();
        } else if (this.q0) {
            a0();
        }
    }

    @Override
    public void a(String str) {
        AlertDialog alertDialog = this.d;
        if (alertDialog != null && alertDialog.isShowing()) {
            this.d.dismiss();
        }
        if (TextUtils.isEmpty(this.B.getSrCode())) {
            c(getString(!TextUtils.isEmpty(this.B.getProblemId()) ? R$string.feedback_sdk_commit_successs : R$string.feedback_sdk_submit_successs));
        }
        String problemId = TextUtils.isEmpty(this.B.getProblemId()) ? str : this.B.getProblemId();
        this.B.setProblemId(str);
        SdkProblemListener sdkListener = SdkProblemManager.getManager().getSdkListener();
        this.b0.setEnabled(false);
        this.e0.setVisibility(0);
        this.e0.postDelayed(new i(sdkListener, str, problemId), 2000L);
    }

    @Override
    public void a(boolean z2) {
        StringBuilder sb = new StringBuilder();
        sb.append("isCompress()  ");
        sb.append(z2);
        sb.append(" ");
        sb.append((this.E || this.G) ? false : true);
        FaqLogger.d("ProblemSuggestActivity_", sb.toString());
        boolean z3 = !z2;
        this.F = z3;
        if (this.E || this.G) {
            return;
        }
        this.b0.setEnabled(z3);
    }

    public class j implements OnReadListener {
        public j() {
        }

        @Override
        public void unread(Throwable th, String str, int i) {
            ProblemSuggestActivity.this.C = i;
            ProblemSuggestActivity.this.invalidateOptionsMenu();
        }

        @Override
        public void read(Throwable th, String str) {
        }
    }

    public class v implements TextWatcher {
        public v() {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            if (ProblemSuggestActivity.this.B != null) {
                String trim = ProblemSuggestActivity.this.Q.getText().toString().trim();
                ProblemSuggestActivity.this.B.setProblemDesc(trim);
                int length = trim.length();
                ProblemSuggestActivity.this.S.setTextColor(ContextCompat.getColor(ProblemSuggestActivity.this, length >= 500 ? R$color.feedback_sdk_problem_question_max_number : R$color.feedback_sdk_problem_question_number));
                ProblemSuggestActivity.this.S.setText(String.format(ProblemSuggestActivity.this.getResources().getString(R$string.feedback_sdk_problem_input_number), Integer.valueOf(length), 500));
            }
        }

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }
    }

    public class w implements TextWatcher {
        public w() {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            EditText editText;
            int i;
            if (ProblemSuggestActivity.this.B != null) {
                String trim = ProblemSuggestActivity.this.U.getText().toString().trim();
                if (trim.length() >= 100) {
                    editText = ProblemSuggestActivity.this.U;
                    i = R$drawable.feedback_sdk_problem_max_num_rectangle_bg;
                } else {
                    editText = ProblemSuggestActivity.this.U;
                    i = R$drawable.feedback_sdk_problem_rectangle_bg;
                }
                editText.setBackgroundResource(i);
                ProblemSuggestActivity.this.B.setContact(trim);
            }
        }

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }
    }
}