导航菜单

页面标题

页面副标题

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

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

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


package com.huawei.phoneservice.feedback.ui;

import android.app.AlertDialog;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ScrollView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentActivity;
import com.huawei.phoneservice.faq.base.constants.FaqConstants;
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$dimen;
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$plurals;
import com.huawei.phoneservice.feedback.R$string;
import com.huawei.phoneservice.feedback.adapter.ProblemSuggestPhotoAdapter;
import com.huawei.phoneservice.feedback.entity.FeedbackBean;
import com.huawei.phoneservice.feedback.mvp.base.FeedbackBaseActivity;
import com.huawei.phoneservice.feedback.widget.FeedbackNoticeView;
import com.huawei.phoneservice.feedbackcommon.entity.FeedbackInfo;
import com.huawei.phoneservice.feedbackcommon.photolibrary.internal.entity.MediaItem;
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.NetworkUtils;
import com.huawei.phoneservice.feedbackcommon.utils.SdkProblemListener;
import com.huawei.phoneservice.feedbackcommon.utils.SdkProblemManager;
import com.huawei.secure.android.common.intent.SafeBundle;
import com.huawei.secure.android.common.intent.SafeIntent;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;

public class ProblemSuggestForDeepLinkActivity extends FeedbackBaseActivity<com.huawei.phoneservice.feedback.mvp.presenter.a> implements View.OnClickListener, com.huawei.phoneservice.feedback.mvp.contract.a, View.OnFocusChangeListener, ProblemSuggestPhotoAdapter.b {
    public FeedbackBean A;
    public TextView B;
    public TextView C;
    public TextView D;
    public EditText E;
    public ProblemSuggestPhotoAdapter F;
    public TextView G;
    public LinearLayout H;
    public EditText I;
    public Button J;
    public LinearLayout K;
    public Button L;
    public FeedbackNoticeView N;
    public boolean O;
    public ScrollView P;
    public GridView Q;
    public boolean R;
    public String S;
    public String T;
    public String U;
    public String V;
    public com.huawei.phoneservice.feedback.mvp.presenter.a z;

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

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

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

        @Override
        public void onClick(View view) {
            if (NoDoubleClickUtil.isDoubleClick(view)) {
                return;
            }
            ProblemSuggestForDeepLinkActivity.this.t();
            ProblemSuggestForDeepLinkActivity.this.B();
        }
    }

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

        @Override
        public void onClick(View view) {
            ProblemSuggestForDeepLinkActivity.this.t();
        }
    }

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

        public f(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, ProblemSuggestForDeepLinkActivity.this.A.getSrCode(), null);
            }
            Intent intent = new Intent();
            intent.putExtra("parentProblemId", this.c);
            intent.putExtra("problemId", this.b);
            intent.putExtra("srCode", ProblemSuggestForDeepLinkActivity.this.A.getSrCode());
            ProblemSuggestForDeepLinkActivity.this.setResult(-1, intent);
            ProblemSuggestForDeepLinkActivity.this.finish();
        }
    }

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

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

        public g(a aVar) {
            this();
        }
    }

    private void A() {
        if (!NetworkUtils.isNetworkConnected(this)) {
            this.L.setVisibility(8);
            c(getResources().getString(R$string.feedback_sdk_no_network));
        } else if ((!this.A.haveMedias() && 0 == this.A.getLogsSize()) || NetworkUtils.isWifiConnected(this)) {
            B();
        } else {
            this.L.setVisibility(8);
            e(com.huawei.quickcard.utils.NetworkUtils.NETWORK_TYPE_WIFI);
        }
    }

    public void B() {
        this.O = true;
        this.A.setProblemName(this.C.getText().toString());
        try {
            this.A.setAssociatedId(Long.parseLong(this.U));
        } catch (NumberFormatException unused) {
            FaqLogger.print("ProblemSuggestForDeep", "NumberFormatException");
        }
        this.A.setUniqueCode(this.V);
        FaqSdk.getISdk().onClick(getClass().getName(), "Submit", this.A);
        this.z.j(this, false);
    }

    private void C() {
        SafeBundle safeBundle = new SafeBundle(new SafeIntent(getIntent()).getExtras());
        this.R = "Y".equals(safeBundle.getString("showContact"));
        this.S = safeBundle.getString("appId");
        this.T = safeBundle.getString("categoryId");
        this.U = safeBundle.getString("problemId");
        this.V = safeBundle.getString("unicode");
    }

    private void D() {
        CharInputFilter charInputFilter = new CharInputFilter("[&<>\"'()\"\\n\" ]");
        EmojiFilter emojiFilter = new EmojiFilter();
        InputFilter.LengthFilter lengthFilter = new InputFilter.LengthFilter(500);
        InputFilter.LengthFilter lengthFilter2 = new InputFilter.LengthFilter(100);
        this.E.setFilters(new InputFilter[]{lengthFilter, new AttackCharFilter()});
        this.I.setFilters(new InputFilter[]{charInputFilter, emojiFilter, lengthFilter2});
        this.E.setOnFocusChangeListener(this);
        this.I.setOnFocusChangeListener(this);
        this.I.setOnTouchListener(new g(null));
        this.E.setHint(getResources().getQuantityString(R$plurals.feedback_sdk_problem_question_info_update, 10, 10));
        this.E.setOnTouchListener(new a());
    }

    private void E() {
        this.J.setEnabled(true);
    }

    private void G() {
        FeedbackBean feedbackBean = this.A;
        if (feedbackBean == null) {
            return;
        }
        if (TextUtils.isEmpty(feedbackBean.getProblemDesc()) || this.A.getProblemDesc().trim().length() < 10) {
            c(getString(R$string.feedback_sdk_feedback_desc_hint, 10));
            return;
        }
        if (this.H.getVisibility() == 0) {
            String contact = this.A.getContact();
            if (TextUtils.isEmpty(contact)) {
                c(getResources().getString(R$string.feedback_sdk_problem_phone_email));
                return;
            }
            boolean isEmail = FaqRegexMatches.isEmail(contact);
            boolean isMobile = FaqRegexMatches.isMobile(contact);
            if (!isEmail && !isMobile) {
                c(getResources().getString(R$string.feedback_sdk_problem_please_check_phone_email_formatted));
                return;
            }
        }
        this.L.setVisibility(0);
        A();
    }

    private void M(int i) {
        this.D.setVisibility(0);
        this.D.setText(i);
        this.K.setVisibility(0);
        this.J.setEnabled(false);
    }

    @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 I(boolean z, EditText editText) {
        String obj;
        if (z) {
            editText.setTag(editText.getHint().toString());
            obj = "";
        } else {
            obj = editText.getTag().toString();
        }
        editText.setHint(obj);
    }

    @Override
    public void a() {
        this.K.setVisibility(8);
        this.L.setVisibility(8);
        E();
    }

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

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

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

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

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

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

    @Override
    public void l() {
        setTitle(R$string.faq_sdk_feedback);
        try {
            this.N.j(FeedbackNoticeView.c.PROGRESS);
            C();
            if (!FaqCommonUtils.isConnectionAvailable(this)) {
                this.N.g(FaqConstants.FaqErrorCode.INTERNET_ERROR);
                return;
            }
            this.A = new FeedbackBean();
            this.z.i(this, this.S, this.U, this.V);
            this.H.setVisibility(this.R ? 0 : 8);
        } catch (RuntimeException e2) {
            FaqLogger.print("ProblemSuggestForDeep", e2.getMessage());
            finish();
        }
    }

    @Override
    public void m() {
        this.F.c(this);
        this.E.addTextChangedListener(new b());
        this.I.addTextChangedListener(new c());
        this.J.setOnClickListener(this);
        this.N.setOnClickListener(this);
    }

    @Override
    public void n() {
        TextView textView = (TextView) findViewById(R$id.txt_style);
        this.C = textView;
        textView.setSelected(true);
        TextView textView2 = (TextView) findViewById(R$id.txt_channel);
        this.B = textView2;
        textView2.setSelected(true);
        this.E = (EditText) findViewById(R$id.edit_question);
        this.G = (TextView) findViewById(R$id.txt_number);
        this.D = (TextView) findViewById(R$id.tv_progress);
        this.G.setText(String.format(getResources().getString(R$string.feedback_sdk_problem_input_number), 0, 500));
        this.F = new ProblemSuggestPhotoAdapter(this);
        GridView gridView = (GridView) findViewById(R$id.list_media);
        this.Q = gridView;
        gridView.setAdapter((ListAdapter) this.F);
        this.Q.setNumColumns(x());
        String sdk = FaqSdk.getSdk().getSdk(FaqConstants.FAQ_HIDE_ADD_ATTACHMENT);
        if (sdk == null || !"Y".equals(sdk.toUpperCase(Locale.ROOT))) {
            this.Q.setVisibility(0);
        } else {
            this.Q.setVisibility(8);
        }
        this.I = (EditText) findViewById(R$id.edit_contact);
        Button button = (Button) findViewById(R$id.btn_submit);
        this.J = button;
        com.huawei.phoneservice.feedback.photolibrary.internal.utils.b.a(this, button);
        this.K = (LinearLayout) findViewById(R$id.layout_loading);
        this.L = (Button) findViewById(R$id.bg_dismiss);
        ScrollView scrollView = (ScrollView) findViewById(R$id.scroll_view);
        this.P = scrollView;
        scrollView.setOverScrollMode(0);
        this.H = (LinearLayout) findViewById(R$id.ll_phone_or_email);
        this.N = (FeedbackNoticeView) findViewById(R$id.feedback_problem_noticeView);
        D();
    }

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

    @Override
    public void onBackPressed(View view) {
        super.onBackPressed(view);
        if ("Y".equals(FaqSdk.getSdk().getSdk(FaqConstants.FAQ_IS_DEEPLICK))) {
            FaqLogger.print("ProblemSuggestForDeep", "ONBACKPRESSED IS DEEPLINK RELEASE");
            FaqSdk.getSdk().release();
        }
        a(this.A);
    }

    @Override
    public void onClick(View view) {
        if (NoDoubleClickUtil.isDoubleClick(view)) {
            return;
        }
        if (view.getId() == R$id.btn_submit) {
            FaqCommonUtils.hideIme(this);
            G();
        } else if (view.getId() == R$id.feedback_problem_noticeView) {
            l();
        }
    }

    @Override
    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        this.Q.setNumColumns(x());
        Button button = this.J;
        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);
            String string = safeBundle.getString("CacheMap");
            this.A = (FeedbackBean) safeBundle.getParcelable("FeedbackBean");
            FaqSdk.getSdk().saveMapOnSaveInstanceState(string);
        }
        super.onCreate(bundle);
    }

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

    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        if (i == 4 && "Y".equals(FaqSdk.getSdk().getSdk(FaqConstants.FAQ_IS_DEEPLICK))) {
            FaqLogger.print("ProblemSuggestForDeep", "ONKEYDOWN IS DEEPLINK RELEASE");
            FaqSdk.getSdk().release();
        }
        return super/*android.app.Activity*/.onKeyDown(i, keyEvent);
    }

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

    private void f(String str) {
        FeedbackNoticeView feedbackNoticeView = this.N;
        FaqConstants.FaqErrorCode faqErrorCode = FaqConstants.FaqErrorCode.EMPTY_DATA_ERROR;
        feedbackNoticeView.g(faqErrorCode);
        this.N.h(faqErrorCode, R$drawable.ic_icon_tips_disable);
        this.N.s(faqErrorCode, getResources().getDimensionPixelOffset(R$dimen.feedback_sdk_loading_empty_icon_size));
        this.N.getNoticeTextView().setText(str);
    }

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

    @Override
    public void b(int i) {
        a(this.A, i);
        this.A.remove(i);
        this.F.d(this.A.getMedias());
        this.Q.setAdapter((ListAdapter) this.F);
        this.z.e(this);
    }

    @Override
    public void c(int i) {
        Resources resources;
        int i2;
        FaqLogger.d("ProblemSuggestForDeep", "showErrorCode:" + i);
        if (i == 401) {
            resources = getResources();
            i2 = R$string.feedback_sdk_lapsed;
        } else {
            if (i != 405) {
                a(FaqConstants.FaqErrorCode.CONNECT_SERVER_ERROR);
                u();
                this.N.setVisibility(0);
                this.N.setEnabled(true);
                this.P.setVisibility(8);
            }
            resources = getResources();
            i2 = R$string.feedback_sdk_submit_repeated;
        }
        f(resources.getString(i2));
        u();
        this.N.setVisibility(0);
        this.N.setEnabled(true);
        this.P.setVisibility(8);
    }

    public void e(String str) {
        FaqLogger.d("ProblemSuggestForDeep", "openUploadFlow      " + str);
        long filesSize = this.A.getFilesSize();
        if (filesSize == 0) {
            filesSize = 1;
        }
        a(filesSize, new d(), new e());
    }

    @Override
    public void a(FaqConstants.FaqErrorCode faqErrorCode) {
        FaqLogger.d("ProblemSuggestForDeep", "showError      " + faqErrorCode);
        u();
        this.N.g(faqErrorCode);
        this.N.setVisibility(0);
        this.N.setEnabled(true);
        this.P.setVisibility(8);
    }

    @Override
    public void b(String str) {
        FaqLogger.d("ProblemSuggestForDeep", "uploadFileDone......" + str);
    }

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

    @Override
    public void a(com.huawei.phoneservice.feedback.utils.a aVar) {
        FaqLogger.d("ProblemSuggestForDeep", "zipCompressFinished......" + aVar);
    }

    @Override
    public void b(List<com.huawei.phoneservice.feedback.entity.b> list) {
        if (FaqStringUtil.isEmpty(ModuleConfigUtils.getChannelName())) {
            a(FaqConstants.FaqErrorCode.EMPTY_DATA_ERROR);
            FaqLogger.d("ProblemSuggestForDeep", "channelName is NULL......");
            return;
        }
        FaqLogger.d("ProblemSuggestForDeep", "showStyles......");
        this.B.setText(ModuleConfigUtils.getChannelName());
        u();
        this.P.setVisibility(0);
        this.N.setVisibility(8);
        ArrayList<com.huawei.phoneservice.feedback.entity.b> arrayList = new ArrayList(list);
        Iterator<com.huawei.phoneservice.feedback.entity.b> it = list.iterator();
        while (it.hasNext()) {
            for (com.huawei.phoneservice.feedback.entity.e eVar : it.next().d) {
                com.huawei.phoneservice.feedback.entity.b bVar = new com.huawei.phoneservice.feedback.entity.b();
                bVar.b = eVar.b;
                bVar.c = eVar.c;
                bVar.a = eVar.a;
                arrayList.add(bVar);
            }
        }
        for (com.huawei.phoneservice.feedback.entity.b bVar2 : arrayList) {
            if (this.T.equals(bVar2.a)) {
                this.C.setText(bVar2.b);
                this.A.setProblemType(bVar2.a, null);
                return;
            }
        }
    }

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

    @Override
    public void a(boolean z) {
        FaqLogger.d("ProblemSuggestForDeep", "isCompress......" + z);
    }

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

        @Override
        public void afterTextChanged(Editable editable) {
            TextView textView;
            FragmentActivity fragmentActivity;
            int i;
            if (ProblemSuggestForDeepLinkActivity.this.A != null) {
                String trim = ProblemSuggestForDeepLinkActivity.this.E.getText().toString().trim();
                ProblemSuggestForDeepLinkActivity.this.A.setProblemDesc(trim);
                if (trim.length() >= 500) {
                    textView = ProblemSuggestForDeepLinkActivity.this.G;
                    fragmentActivity = ProblemSuggestForDeepLinkActivity.this;
                    i = R$color.feedback_sdk_problem_question_max_number;
                } else {
                    textView = ProblemSuggestForDeepLinkActivity.this.G;
                    fragmentActivity = ProblemSuggestForDeepLinkActivity.this;
                    i = R$color.feedback_sdk_problem_question_number;
                }
                textView.setTextColor(ContextCompat.getColor(fragmentActivity, i));
                ProblemSuggestForDeepLinkActivity.this.G.setText(String.format(ProblemSuggestForDeepLinkActivity.this.getResources().getString(R$string.feedback_sdk_problem_input_number), Integer.valueOf(trim.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 c implements TextWatcher {
        public c() {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            EditText editText;
            int i;
            if (ProblemSuggestForDeepLinkActivity.this.A != null) {
                String trim = ProblemSuggestForDeepLinkActivity.this.I.getText().toString().trim();
                if (trim.length() >= 100) {
                    editText = ProblemSuggestForDeepLinkActivity.this.I;
                    i = R$drawable.feedback_sdk_problem_max_num_rectangle_bg;
                } else {
                    editText = ProblemSuggestForDeepLinkActivity.this.I;
                    i = R$drawable.feedback_sdk_problem_rectangle_bg;
                }
                editText.setBackgroundResource(i);
                ProblemSuggestForDeepLinkActivity.this.A.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) {
        }
    }
}