导航菜单

页面标题

页面副标题

bbinstant v6.24.0 - NewFeedbackActivity.java 源代码

正在查看: bbinstant v6.24.0 应用的 NewFeedbackActivity.java JAVA 源代码文件

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


package com.bigbasket.bbinstant.ui.feedback;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import androidx.appcompat.widget.Toolbar;
import com.bigbasket.bbinstant.analytics.snowplow.PlowUtils;
import com.bigbasket.bbinstant.core.utils.KeyboardUtils;
import com.bigbasket.bbinstant.ui.BBInstantActivity;
import com.bigbasket.bbinstant.ui.BaseActivity;
import com.google.android.material.snackbar.Snackbar;

public class NewFeedbackActivity extends BaseActivity implements com.bigbasket.bbinstant.ui.feedback.b, g, View.OnTouchListener {
    private BackBtnPressInterceptingEditText etComment;
    private e feedbackPresenter;
    private ImageView ivAngry;
    private ImageView ivHappy;
    private ImageView ivSad;
    private ImageView ivSuperAngry;
    private ImageView ivSuperHappy;
    private LinearLayout llCaptionAndComment;
    private ProgressBar progressBar;
    private RelativeLayout rlFooter;
    private RelativeLayout rlRoot;
    private ScrollView scrollView;
    private int selectedEmojiId;
    private Toolbar toolBar;
    private TextView tvCaptionLine1;
    private TextView tvCaptionLine2;
    private TextView tvScreenTitle;
    private TextView tvSkip;
    private TextView tvSubmit;
    private final String TAG = NewFeedbackActivity.class.getSimpleName();
    private boolean backBtnPressed = false;
    private ImageView ivPreviouslySelectedEmoji = null;
    private final int EMOJI_SUPER_ANGRY = 1;
    private final int EMOJI_ANGRY = 2;
    private final int EMOJI_SAD = 3;
    private final int EMOJI_HAPPY = 4;
    private final int EMOJI_SUPER_HAPPY = 5;
    private boolean isMandatoryFeedback = false;
    private boolean isComingBackFromPlayStoreApp = false;

    class a implements f {
        a() {
        }

        @Override
        public void onBackPressed() {
            NewFeedbackActivity.this.checkAndNavigate();
        }
    }

    class b implements View.OnClickListener {
        b() {
        }

        @Override
        public void onClick(View view) {
            NewFeedbackActivity.this.feedbackPresenter.submitFeedback(NewFeedbackActivity.this.getApplicationContext(), NewFeedbackActivity.this.etComment.getText().toString(), NewFeedbackActivity.this.selectedEmojiId, false);
        }
    }

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

        @Override
        public void onClick(View view) {
            NewFeedbackActivity.this.feedbackPresenter.submitFeedback(NewFeedbackActivity.this.getApplicationContext(), "", 0, true);
        }
    }

    private void animate(View view, int i) {
        scaleOut(this.ivPreviouslySelectedEmoji);
        scaleIn(view);
        this.selectedEmojiId = i;
    }

    public boolean checkAndNavigate() {
        if (this.etComment.getText() != null) {
            if (this.etComment.getText().toString().trim().length() > 0) {
                showExitConfirmationDialog();
                return false;
            }
            finish();
        }
        return true;
    }

    private void handleNavigation() {
        if (!this.isMandatoryFeedback) {
            finish();
            return;
        }
        Intent intent = new Intent(this, (Class<?>) BBInstantActivity.class);
        intent.setFlags(65536);
        startActivity(intent);
        finish();
    }

    private void init() {
        this.feedbackPresenter = new e(this);
    }

    @SuppressLint({"ClickableViewAccessibility"})
    private void initListeners() {
        this.ivSuperAngry.setOnTouchListener(this);
        this.ivAngry.setOnTouchListener(this);
        this.ivSad.setOnTouchListener(this);
        this.ivHappy.setOnTouchListener(this);
        this.ivSuperHappy.setOnTouchListener(this);
        this.etComment.setBackPressInterceptListener(new a());
        this.tvSubmit.setOnClickListener(new b());
        this.tvSkip.setOnClickListener(new c());
    }

    private void initViews() {
        Toolbar toolbar = (Toolbar) findViewById(2131362669);
        this.toolBar = toolbar;
        setSupportActionBar(toolbar);
        if (getSupportActionBar() != null) {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
            getSupportActionBar().setDisplayShowHomeEnabled(true);
            getSupportActionBar().setDisplayShowTitleEnabled(false);
        }
        this.rlRoot = (RelativeLayout) findViewById(2131362474);
        this.scrollView = (ScrollView) findViewById(2131362502);
        this.llCaptionAndComment = (LinearLayout) findViewById(2131362260);
        this.rlFooter = (RelativeLayout) findViewById(2131362472);
        this.ivSuperAngry = (ImageView) findViewById(2131362171);
        this.ivAngry = (ImageView) findViewById(2131362168);
        this.ivSad = (ImageView) findViewById(2131362170);
        this.ivHappy = (ImageView) findViewById(2131362169);
        this.ivSuperHappy = (ImageView) findViewById(2131362172);
        this.etComment = (BackBtnPressInterceptingEditText) findViewById(2131362085);
        this.tvScreenTitle = (TextView) findViewById(2131362706);
        this.tvSkip = (TextView) findViewById(2131362708);
        this.tvSubmit = (TextView) findViewById(2131362710);
        this.tvCaptionLine1 = (TextView) findViewById(2131362690);
        this.tvCaptionLine2 = (TextView) findViewById(2131362691);
        this.progressBar = (ProgressBar) findViewById(2131362435);
        String stringExtra = getIntent().getStringExtra("FeedbackType");
        if (stringExtra == null || !stringExtra.equals("mandatory")) {
            return;
        }
        this.isMandatoryFeedback = true;
        this.toolBar.setVisibility(8);
    }

    private void processEmojiClick(View view, int i) {
        this.backBtnPressed = false;
        if (shouldRearrangeView()) {
            showDetailView();
            animate(view, i);
        } else if (this.ivPreviouslySelectedEmoji != view) {
            animate(view, i);
        }
    }

    private void scaleIn(View view) {
        view.animate().scaleX(1.5f).scaleY(1.5f).setDuration(300L).setStartDelay(50L);
        this.ivPreviouslySelectedEmoji = (ImageView) view;
    }

    private void scaleOut(View view) {
        if (view != null) {
            view.animate().scaleX(1.0f).scaleY(1.0f).setDuration(300L).setStartDelay(50L);
            this.ivPreviouslySelectedEmoji = null;
        }
    }

    private void setEmojiCaptions(String str, String str2) {
        this.tvCaptionLine1.setText(str);
        this.tvCaptionLine2.setText(str2);
    }

    private boolean shouldRearrangeView() {
        return this.llCaptionAndComment.getVisibility() == 8;
    }

    private void showDetailView() {
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -2);
        layoutParams.addRule(3, 2131361882);
        layoutParams.addRule(2, 2131362472);
        this.scrollView.setLayoutParams(layoutParams);
        this.scrollView.requestLayout();
        this.llCaptionAndComment.setVisibility(0);
        this.rlFooter.setVisibility(0);
        KeyboardUtils.show(this, this.etComment);
    }

    private void showExitConfirmationDialog() {
        ?? exitConfirmationDialogFragment = new ExitConfirmationDialogFragment();
        exitConfirmationDialogFragment.setCancelable(false);
        exitConfirmationDialogFragment.setBottomSheetActionCallback(this);
        exitConfirmationDialogFragment.show(getSupportFragmentManager(), "exitDialogFragment");
    }

    private void showRatingDialog() {
        ?? playStoreRatingDialogFragment = new PlayStoreRatingDialogFragment();
        playStoreRatingDialogFragment.setCancelable(false);
        playStoreRatingDialogFragment.setBottomSheetActionCallback(this);
        if (playStoreRatingDialogFragment.isDetached() || isFinishing() || isDestroyed()) {
            return;
        }
        playStoreRatingDialogFragment.show(getSupportFragmentManager(), "playStoreRatingFragment");
    }

    private void toggleSubmitButtonState(boolean z) {
        if (z) {
            this.tvSubmit.setClickable(true);
            this.tvSubmit.setTextColor(getResources().getColor(2131099918));
        } else {
            this.tvSubmit.setClickable(false);
            this.tvSubmit.setTextColor(getResources().getColor(2131099919));
        }
    }

    @Override
    public void dismissLoader() {
        this.progressBar.setVisibility(8);
    }

    @Override
    public void displayLoader() {
        this.progressBar.setVisibility(0);
    }

    @Override
    public void onBackPressed() {
        checkAndNavigate();
    }

    @Override
    public void onBottomSheetAction(int i) {
        switch (i) {
            case 2131362699:
                handleNavigation();
                break;
            case 2131362702:
                handleNavigation();
                break;
            case 2131362704:
                this.isComingBackFromPlayStoreApp = true;
                break;
            case 2131362709:
                KeyboardUtils.showKeyboard(this);
                break;
        }
    }

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(2131558437);
        init();
        initViews();
        initListeners();
    }

    @Override
    public void onFeedbackSubmissionFailed(String str) {
        this.progressBar.setVisibility(8);
        Snackbar.make(this.rlRoot, str, -1).show();
    }

    @Override
    public void onFeedbackSubmissionSuccess(boolean z) {
        if (!z) {
            handleNavigation();
            return;
        }
        this.etComment.setText("");
        PlowUtils.ScreenViewHelper.trackOnPlaystoreRatingDialog();
        showRatingDialog();
    }

    @Override
    protected void onResume() {
        super.onResume();
        if (this.isComingBackFromPlayStoreApp) {
            this.isComingBackFromPlayStoreApp = false;
            handleNavigation();
        }
    }

    @Override
    public boolean onSupportNavigateUp() {
        return checkAndNavigate();
    }

    @Override
    public boolean onTouch(android.view.View r7, android.view.MotionEvent r8) {
        throw new UnsupportedOperationException("Method not decompiled: com.bigbasket.bbinstant.ui.feedback.NewFeedbackActivity.onTouch(android.view.View, android.view.MotionEvent):boolean");
    }

    public void showAbstractView() {
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -2);
        layoutParams.addRule(15);
        this.scrollView.setLayoutParams(layoutParams);
        this.scrollView.requestLayout();
        this.llCaptionAndComment.setVisibility(8);
        this.rlFooter.setVisibility(8);
        scaleOut(this.ivPreviouslySelectedEmoji);
        KeyboardUtils.hide(this, this.etComment);
    }
}