导航菜单

页面标题

页面副标题

Mint v5.7.3 - PlanPageActivity.java 源代码

正在查看: Mint v5.7.3 应用的 PlanPageActivity.java JAVA 源代码文件

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


package com.htmedia.mint.htsubscription.planpagerewamp.ui.activities;

import android.app.Activity;
import android.app.ActivityOptions;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.res.ResourcesCompat;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.firebase.crashlytics.internal.metadata.UserMetadata;
import com.google.firebase.perf.FirebasePerformance;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import com.htmedia.mint.AppController;
import com.htmedia.mint.R;
import com.htmedia.mint.htsubscription.CheckSubscriptionFromLocal;
import com.htmedia.mint.htsubscription.GetSubscriptionIntent;
import com.htmedia.mint.htsubscription.GetUserSubscriptionDetail;
import com.htmedia.mint.htsubscription.SnowplowSubscriptionAnalytices;
import com.htmedia.mint.htsubscription.SubscriptionConverter;
import com.htmedia.mint.htsubscription.SubscriptionPlanSingleton;
import com.htmedia.mint.htsubscription.SubscriptionTrigger;
import com.htmedia.mint.htsubscription.SyncPurchaseWithSession;
import com.htmedia.mint.htsubscription.WebEngageAnalytices;
import com.htmedia.mint.htsubscription.ZSErrorCodeHandling;
import com.htmedia.mint.htsubscription.ZohoInAppConfig;
import com.htmedia.mint.htsubscription.planpagerewamp.Constants;
import com.htmedia.mint.htsubscription.planpagerewamp.adapters.BenefitsVerticalListAdapter;
import com.htmedia.mint.htsubscription.planpagerewamp.adapters.CouponsPagerAdapter;
import com.htmedia.mint.htsubscription.planpagerewamp.adapters.PPFaqAdapter;
import com.htmedia.mint.htsubscription.planpagerewamp.adapters.PlansInfoPagerAdapter;
import com.htmedia.mint.htsubscription.planpagerewamp.adapters.PlansListAdapter;
import com.htmedia.mint.htsubscription.planpagerewamp.adapters.PlansTenureAdapter;
import com.htmedia.mint.htsubscription.planpagerewamp.coupon.CouponModulePlanPage;
import com.htmedia.mint.htsubscription.planpagerewamp.ui.customviews.CustomPagerIndicator;
import com.htmedia.mint.htsubscription.planpagerewamp.ui.customviews.CustomViewPager;
import com.htmedia.mint.htsubscription.subsutils.SubscriptionUtils;
import com.htmedia.mint.juspay.JuspayCheckout;
import com.htmedia.mint.piano.PianoAppConstant;
import com.htmedia.mint.piano.PianoCallbackListener;
import com.htmedia.mint.piano.PianoCallbacks;
import com.htmedia.mint.piano.PianoResponse;
import com.htmedia.mint.pojo.Content;
import com.htmedia.mint.pojo.ForyouPojo;
import com.htmedia.mint.pojo.Metadata;
import com.htmedia.mint.pojo.config.Config;
import com.htmedia.mint.pojo.config.FrequentlyQuestion;
import com.htmedia.mint.pojo.config.planpage.PlanPageV2;
import com.htmedia.mint.pojo.mintsubscribenowmodel.SubscribeNowPerant;
import com.htmedia.mint.pojo.planpage.PaymentMethod;
import com.htmedia.mint.pojo.planpage.PianoPlan;
import com.htmedia.mint.pojo.planpage.PlanPageExperience;
import com.htmedia.mint.pojo.planpage.faq.FaqQuesAns;
import com.htmedia.mint.pojo.subscription.ErrorCode;
import com.htmedia.mint.pojo.subscription.SubscriptionError;
import com.htmedia.mint.pojo.subscription.SubscriptionSource;
import com.htmedia.mint.pojo.subscription.plandetail.htapi.MintPlanWithZSPlan;
import com.htmedia.mint.pojo.subscription.plandetail.htapi.MintServerPlan;
import com.htmedia.mint.pojo.subscription.plandetail.htapi.SubsPlans;
import com.htmedia.mint.pojo.subscription.userdetail.MintSubscriptionDetail;
import com.htmedia.mint.razorpay.coupon.CouponUtils;
import com.htmedia.mint.razorpay.pojo.coupon.partner.CouponPartner;
import com.htmedia.mint.razorpay.pojo.coupon.partner.PartnersOfferPojo;
import com.htmedia.mint.razorpay.presenter.PartnersOfferPresenter;
import com.htmedia.mint.razorpay.presenter.PartnersOfferViewInterface;
import com.htmedia.mint.razorpay.ui.SubscriptionCheckOutPage;
import com.htmedia.mint.razorpay.utils.RazorPayCheckout;
import com.htmedia.mint.studentoffer.StudentOfferWebView;
import com.htmedia.mint.ui.activity.HomeActivity;
import com.htmedia.mint.utils.f0;
import com.htmedia.mint.utils.m1;
import com.htmedia.mint.utils.n;
import com.htmedia.mint.utils.o0;
import com.htmedia.mint.utils.q;
import com.htmedia.mint.utils.s0;
import com.htmedia.sso.activities.LoginRegisterActivity;
import com.razorpay.PaymentData;
import com.razorpay.PaymentResultWithDataListener;
import com.zoho.zsm.inapppurchase.core.ZSInAppPurchaseKit;
import com.zoho.zsm.inapppurchase.interfaces.PlanDetailsListener;
import com.zoho.zsm.inapppurchase.interfaces.PurchaseUpdationListener;
import com.zoho.zsm.inapppurchase.model.ZSCustomField;
import com.zoho.zsm.inapppurchase.model.ZSError;
import com.zoho.zsm.inapppurchase.model.ZSPlan;
import com.zoho.zsm.inapppurchase.model.ZSSubscriptionDetail;
import java.io.IOException;
import java.io.Serializable;
import java.math.RoundingMode;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.net.URLConnection;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.Timer;
import javax.net.ssl.HttpsURLConnection;
import k6.c1;
import k6.d1;
import k6.r;
import l5.c;
import org.json.JSONObject;
import x4.g2;

public class PlanPageActivity extends com.htmedia.mint.ui.activity.a implements d1, PlanDetailsListener, PianoCallbackListener, PlansListAdapter.SelectedIndex, PlansTenureAdapter.SelectedTenure, CouponsPagerAdapter.SelectCoupon, GetUserSubscriptionDetail.OnSubscriptionDetail, PurchaseUpdationListener, PaymentResultWithDataListener {
    public static final int AFTER_SUBSCRIPTION_REQUEST = 1002;
    public static final int AFTER_SUBSCRIPTION_SUCCESS_REQUEST = 1003;
    public static final int ONBOARDING_REQUEST_CODE = 1004;
    private static final int SIGN_IN_REQUEST = 1001;
    private String adFreeUser;
    BenefitsVerticalListAdapter benefitsVerticalListAdapter;
    private Config config;
    private r configPresenter;
    private Content content;
    COUNTRY country;
    private String couponCodePartner;
    private CouponModulePlanPage couponModulePlanPage;
    private View[] couponViewArray;
    CouponsPagerAdapter couponsPagerAdapter;
    private Handler handler;
    private String initialPlan;
    private String initialTenure;
    private boolean isAndroidCarouselInteractionEnabled;
    private boolean isAndroidCarouselTimerEnabled;
    private boolean isNightMode;
    private boolean isRazorPayEnabled;
    private boolean isToShowAdFreeText;
    private JuspayCheckout juspayCheckout;
    g2 mBinding;
    private boolean mNeedToSetPassword;
    String mStringCountry;
    private MintPlanWithZSPlan mintPlanWithZSPlan;
    private NumberFormat numberFormat;
    private ProgressDialog pDialog;
    PPFaqAdapter pPFaqAdapter;
    private PlanPageExperience planPageExperience;
    PlansInfoPagerAdapter plansInfoPagerAdapter;
    private PlansListAdapter plansListAdapter;
    private RazorPayCheckout razorPayCheckout;
    Runnable runnable;
    private ZSPlan selectedPlan;
    private long startTimeStamp;
    private String strNewPlan;
    private String strNewTenure;
    private String strOldPlan;
    private String strOldTenure;
    private String subscriberChoicePlan;
    private Timer timer;
    private View[] viewArray;
    public String paywallReason = "";
    String TAG = "PlanPageActivity";
    ArrayList<String> plansInfoPagesList = new ArrayList<>();
    int currentPage = 0;
    private long PERIOD_MS = 0;
    private int initialPagerSize = 0;
    private String androidDiscountLabel = "";
    private String subscriberChoiceLabel = "";
    private int mSelectedPlan = 0;
    private String mPlanCategory = "";
    private String mCouponCode = "";
    private String selectedPlanCode = "";
    private ArrayList<MintPlanWithZSPlan> mintOnlyList = new ArrayList<>();
    private ArrayList<MintPlanWithZSPlan> wsjOnlyList = new ArrayList<>();
    private ArrayList<MintPlanWithZSPlan> ecoOnlyList = new ArrayList<>();
    private ArrayList<MintPlanWithZSPlan> mintLiteOnlyList = new ArrayList<>();
    private ArrayList<MintPlanWithZSPlan> mintBarronList = new ArrayList<>();
    private ArrayList<MintPlanWithZSPlan> wsjBarronList = new ArrayList<>();
    private ArrayList<MintPlanWithZSPlan> masterPlanList = new ArrayList<>();
    private ArrayList<PartnersOfferPojo> bankCouponOfferList = new ArrayList<>();
    private ArrayList<PartnersOfferPojo> partnerBenefitsList = new ArrayList<>();
    private String funnelName = "";
    private String premiumStory = "";
    private String lastAccessUrl = "";
    private SubscriptionConverter.PLAN_CAMPAIGN planCampaign = SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_KNOWN;
    private q.d couponModule = q.d.d;
    private CouponUtils.COUPONSTATUS couponstatus = CouponUtils.COUPONSTATUS.APPLY;
    ArrayList<PartnersOfferPojo> partnersOfferPojosList = new ArrayList<>();

    static class AnonymousClass15 {
        static final int[] $SwitchMap$com$htmedia$mint$htsubscription$SubscriptionConverter$PLAN_CAMPAIGN;
        static final int[] $SwitchMap$com$htmedia$mint$htsubscription$planpagerewamp$ui$activities$PlanPageActivity$COUNTRY;
        static final int[] $SwitchMap$com$htmedia$mint$utils$AppConstants$PAYMENT_TYPE;

        static {
            int[] iArr = new int[q.v.values().length];
            $SwitchMap$com$htmedia$mint$utils$AppConstants$PAYMENT_TYPE = iArr;
            try {
                iArr[q.v.a.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                $SwitchMap$com$htmedia$mint$utils$AppConstants$PAYMENT_TYPE[q.v.e.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                $SwitchMap$com$htmedia$mint$utils$AppConstants$PAYMENT_TYPE[q.v.c.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                $SwitchMap$com$htmedia$mint$utils$AppConstants$PAYMENT_TYPE[q.v.d.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                $SwitchMap$com$htmedia$mint$utils$AppConstants$PAYMENT_TYPE[q.v.b.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            int[] iArr2 = new int[COUNTRY.values().length];
            $SwitchMap$com$htmedia$mint$htsubscription$planpagerewamp$ui$activities$PlanPageActivity$COUNTRY = iArr2;
            try {
                iArr2[COUNTRY.US.ordinal()] = 1;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                $SwitchMap$com$htmedia$mint$htsubscription$planpagerewamp$ui$activities$PlanPageActivity$COUNTRY[COUNTRY.India.ordinal()] = 2;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                $SwitchMap$com$htmedia$mint$htsubscription$planpagerewamp$ui$activities$PlanPageActivity$COUNTRY[COUNTRY.Other.ordinal()] = 3;
            } catch (NoSuchFieldError unused8) {
            }
            int[] iArr3 = new int[SubscriptionConverter.PLAN_CAMPAIGN.values().length];
            $SwitchMap$com$htmedia$mint$htsubscription$SubscriptionConverter$PLAN_CAMPAIGN = iArr3;
            try {
                iArr3[SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_ECO.ordinal()] = 1;
            } catch (NoSuchFieldError unused9) {
            }
            try {
                $SwitchMap$com$htmedia$mint$htsubscription$SubscriptionConverter$PLAN_CAMPAIGN[SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_WSJ.ordinal()] = 2;
            } catch (NoSuchFieldError unused10) {
            }
            try {
                $SwitchMap$com$htmedia$mint$htsubscription$SubscriptionConverter$PLAN_CAMPAIGN[SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_MINT.ordinal()] = 3;
            } catch (NoSuchFieldError unused11) {
            }
            try {
                $SwitchMap$com$htmedia$mint$htsubscription$SubscriptionConverter$PLAN_CAMPAIGN[SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_MINT_LITE.ordinal()] = 4;
            } catch (NoSuchFieldError unused12) {
            }
            try {
                $SwitchMap$com$htmedia$mint$htsubscription$SubscriptionConverter$PLAN_CAMPAIGN[SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_MINT_BARRON.ordinal()] = 5;
            } catch (NoSuchFieldError unused13) {
            }
            try {
                $SwitchMap$com$htmedia$mint$htsubscription$SubscriptionConverter$PLAN_CAMPAIGN[SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_WSJ_BARRON.ordinal()] = 6;
            } catch (NoSuchFieldError unused14) {
            }
        }
    }

    private class AsyncTaskRunner extends AsyncTask<Void, Void, COUNTRY> {
        static final boolean $assertionsDisabled = false;

        private AsyncTaskRunner() {
        }

        @Override
        public COUNTRY doInBackground(Void... voidArr) {
            URL url = null;
            String locationUrl = (AppController.j().g() == null || TextUtils.isEmpty(AppController.j().g().getLocationUrl())) ? null : AppController.j().g().getLocationUrl();
            try {
            } catch (MalformedURLException e) {
                e.printStackTrace();
                o0.h(e, locationUrl, e.getMessage());
            }
            if (locationUrl == null) {
                return COUNTRY.Other;
            }
            url = new URL(locationUrl);
            try {
                HttpsURLConnection httpsURLConnection = (HttpsURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(url.openConnection()));
                httpsURLConnection.setRequestMethod(FirebasePerformance.HttpMethod.GET);
                httpsURLConnection.setRequestProperty("charset", "utf-8");
                httpsURLConnection.connect();
                if (httpsURLConnection.getResponseCode() == 200) {
                    String headerField = httpsURLConnection.getHeaderField("meta-geo");
                    if (TextUtils.isEmpty(headerField)) {
                        headerField = "";
                    }
                    if (!TextUtils.isEmpty(headerField)) {
                        if (!headerField.startsWith("us") && !headerField.startsWith("US")) {
                            if (headerField.startsWith("in") || headerField.startsWith("IN")) {
                                return COUNTRY.India;
                            }
                        }
                        return COUNTRY.US;
                    }
                }
            } catch (ProtocolException e2) {
                e2.printStackTrace();
                o0.h(e2, locationUrl, e2.getMessage());
            } catch (IOException e3) {
                e3.printStackTrace();
                o0.h(e3, locationUrl, e3.getMessage());
            } catch (Exception e7) {
                e7.printStackTrace();
                o0.h(e7, locationUrl, e7.getMessage());
            }
            return COUNTRY.Other;
        }

        @Override
        public void onPostExecute(COUNTRY country) {
            super.onPostExecute((AsyncTaskRunner) country);
            ?? r0 = PlanPageActivity.this;
            r0.country = country;
            f0.e3((Context) r0, country.name());
            f0.f3(PlanPageActivity.this, country.name());
            PlanPageActivity.this.mStringCountry = country.name();
            PlanPageActivity.this.setCouponsBenefitsAndFaQ(country.name());
        }
    }

    public enum COUNTRY {
        US,
        India,
        Other,
        NA
    }

    private void activateBottomSheet(MintSubscriptionDetail mintSubscriptionDetail) {
        new l5.c(new c.a() {
            @Override
            public void onOptionClicked(int i, MintSubscriptionDetail mintSubscriptionDetail2) {
                if (i == 0) {
                    PlanPageActivity.this.openSubscriptionCheckout(null, true);
                } else if (i == 1) {
                    PlanPageActivity.this.initiatePayment(mintSubscriptionDetail2);
                }
            }
        }, mintSubscriptionDetail).show(getSupportFragmentManager(), "PaymentOptionBottomSheet");
    }

    public void autoApplyCouponCode() {
        updateBottomFooterInitial();
        q.d dVar = this.couponModule;
        if (dVar != null) {
            if ((dVar == q.d.d || dVar == q.d.a) && !TextUtils.isEmpty(this.couponCodePartner)) {
                CouponModulePlanPage couponModulePlanPage = this.couponModulePlanPage;
                Config config = this.config;
                String str = this.couponCodePartner;
                MintPlanWithZSPlan mintPlanWithZSPlan = this.mintPlanWithZSPlan;
                couponModulePlanPage.couponApply(config, str, null, (mintPlanWithZSPlan == null || mintPlanWithZSPlan.getSubsPlans() == null || TextUtils.isEmpty(this.mintPlanWithZSPlan.getSubsPlans().getPlanCode())) ? "" : this.mintPlanWithZSPlan.getSubsPlans().getPlanCode());
            }
        }
    }

    private List<String> checkSubscriberChoiceGroup(String str, List<String> list) {
        ArrayList arrayList = new ArrayList();
        if (list.contains(str)) {
            arrayList.add(str);
        }
        return arrayList;
    }

    public void checkZSUserSubscriptionDetail() {
        new SyncPurchaseWithSession.SyncPaymentFailureAsyncTask(this).execute(this.selectedPlan);
        new GetUserSubscriptionDetail(this, this).fetchUserSubscriptionDetail("subscribenowbutton", q.f0.d, true);
    }

    private void createCouponPagerCustomIndicator() {
        ArrayList<PartnersOfferPojo> arrayList = this.bankCouponOfferList;
        if (arrayList == null || arrayList.size() <= 0 || this.couponViewArray != null) {
            return;
        }
        ArrayList<PartnersOfferPojo> arrayList2 = this.bankCouponOfferList;
        int i = 3;
        if (arrayList2 != null && arrayList2.size() > 0 && this.bankCouponOfferList.size() <= 3) {
            i = this.bankCouponOfferList.size();
        }
        this.couponViewArray = new View[i];
        for (int i2 = 0; i2 < i; i2++) {
            View inflate = ((LayoutInflater) getSystemService("layout_inflater")).inflate(R.layout.item_custom_indicator, (ViewGroup) null);
            this.couponViewArray[i2] = inflate.findViewById(R.id.indicatorView);
            this.mBinding.g.c.addView(inflate);
        }
        CustomPagerIndicator.setCouponCustomIndicator(this, 0, this.couponViewArray);
    }

    private void createCustomIndicator() {
        ArrayList<String> arrayList = this.plansInfoPagesList;
        if (arrayList == null || arrayList.size() <= 0 || this.viewArray != null) {
            return;
        }
        int size = this.plansInfoPagesList.size();
        this.viewArray = new View[size];
        for (int i = 0; i < size; i++) {
            View inflate = ((LayoutInflater) getSystemService("layout_inflater")).inflate(R.layout.item_custom_indicator, (ViewGroup) null);
            this.viewArray[i] = inflate.findViewById(R.id.indicatorView);
            this.mBinding.j.a.addView(inflate);
        }
        CustomPagerIndicator.setCustomIndicator(this, this.initialPagerSize, 0, this.viewArray);
    }

    private String getFaqUrl() {
        String androidFaqs;
        Config config;
        SubscriptionConverter.PLAN_CAMPAIGN plan_campaign = this.planCampaign;
        if (plan_campaign == null || plan_campaign == SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_KNOWN) {
            PlanPageExperience planPageExperience = this.planPageExperience;
            androidFaqs = (planPageExperience == null || planPageExperience.getFaqBenefitsCoupons() == null || TextUtils.isEmpty(this.planPageExperience.getFaqBenefitsCoupons().getAndroidFaqs())) ? "" : this.planPageExperience.getFaqBenefitsCoupons().getAndroidFaqs();
            if (this.country != null && TextUtils.isEmpty(androidFaqs)) {
                int i = AnonymousClass15.$SwitchMap$com$htmedia$mint$htsubscription$planpagerewamp$ui$activities$PlanPageActivity$COUNTRY[this.country.ordinal()];
                if (i == 1) {
                    Config config2 = this.config;
                    return (config2 == null || config2.getFaqURLs() == null || this.config.getFaqURLs().getUsaFaq() == null) ? "" : this.config.getFaqURLs().getUsaFaq();
                }
                if (i == 2) {
                    Config config3 = this.config;
                    return (config3 == null || config3.getFaqURLs() == null || this.config.getFaqURLs().getIndiaFaq() == null) ? "" : this.config.getFaqURLs().getIndiaFaq();
                }
                if (i == 3) {
                    Config config4 = this.config;
                    return (config4 == null || config4.getFaqURLs() == null || this.config.getFaqURLs().getNonIndiaNonUSFaq() == null) ? "" : this.config.getFaqURLs().getNonIndiaNonUSFaq();
                }
            }
        } else {
            int i2 = AnonymousClass15.$SwitchMap$com$htmedia$mint$htsubscription$SubscriptionConverter$PLAN_CAMPAIGN[plan_campaign.ordinal()];
            if (i2 == 1) {
                Config config5 = this.config;
                if (config5 == null || config5.getFaqURLs() == null || this.config.getFaqURLs().getEconomistFaq() == null) {
                    return "";
                }
                androidFaqs = this.config.getFaqURLs().getEconomistFaq();
            } else if (i2 == 2) {
                Config config6 = this.config;
                if (config6 == null || config6.getFaqURLs() == null || this.config.getFaqURLs().getWsjFaq() == null) {
                    return "";
                }
                androidFaqs = this.config.getFaqURLs().getWsjFaq();
            } else if (i2 == 3) {
                Config config7 = this.config;
                if (config7 == null || config7.getFaqURLs() == null || this.config.getFaqURLs().getMintOnlyFaq() == null) {
                    return "";
                }
                androidFaqs = this.config.getFaqURLs().getMintOnlyFaq();
            } else {
                if (i2 != 4 || (config = this.config) == null || config.getFaqURLs() == null || this.config.getFaqURLs().getMintLiteFaq() == null) {
                    return "";
                }
                androidFaqs = this.config.getFaqURLs().getMintLiteFaq();
            }
        }
        return androidFaqs;
    }

    private int getHeightOfScreen() {
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        return displayMetrics.heightPixels;
    }

    private int getIndexForDefaultSelection(ArrayList<MintPlanWithZSPlan> arrayList) {
        SubscriptionConverter.PLAN_CAMPAIGN plan_campaign = this.planCampaign;
        if ((plan_campaign == null || (plan_campaign != SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_ECO && plan_campaign != SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_MINT && plan_campaign != SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_MINT_LITE && plan_campaign != SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_MINT_BARRON && plan_campaign != SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_WSJ_BARRON && plan_campaign != SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_WSJ)) && arrayList != null && arrayList.size() > 0) {
            int size = arrayList.size();
            for (int i = 0; i < size; i++) {
                MintPlanWithZSPlan mintPlanWithZSPlan = arrayList.get(i);
                if (mintPlanWithZSPlan != null && mintPlanWithZSPlan.getPianoPlan() != null && mintPlanWithZSPlan.getPianoPlan().isDefaultSelectionPlan()) {
                    return i;
                }
            }
        }
        return 0;
    }

    private int getLastSelectedPosition(ArrayList<MintPlanWithZSPlan> arrayList) {
        int size = this.masterPlanList.size();
        int size2 = arrayList.size();
        int i = 0;
        for (int i2 = 0; i2 < size; i2++) {
            for (int i3 = 0; i3 < size2; i3++) {
                if (this.masterPlanList.get(i2).getZsPlan() == arrayList.get(i3).getZsPlan()) {
                    i = i3;
                }
            }
        }
        return i;
    }

    private MintPlanWithZSPlan getMasterPlan(List<MintPlanWithZSPlan> list) {
        MintPlanWithZSPlan mintPlanWithZSPlan = null;
        if (list != null && list.size() > 0) {
            Iterator<MintPlanWithZSPlan> it = list.iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                MintPlanWithZSPlan next = it.next();
                if (next != null && next.getPianoPlan() != null && next.getPianoPlan().isMasterPlan()) {
                    mintPlanWithZSPlan = next;
                    break;
                }
            }
            if (mintPlanWithZSPlan != null) {
                String planCode = mintPlanWithZSPlan.getSubsPlans() != null ? mintPlanWithZSPlan.getSubsPlans().getPlanCode() : "";
                if (!TextUtils.isEmpty(planCode) && !planCode.equalsIgnoreCase(this.subscriberChoicePlan)) {
                    Iterator<MintPlanWithZSPlan> it2 = list.iterator();
                    while (true) {
                        if (!it2.hasNext()) {
                            break;
                        }
                        MintPlanWithZSPlan next2 = it2.next();
                        String planCode2 = next2.getSubsPlans() != null ? next2.getSubsPlans().getPlanCode() : "";
                        if (!TextUtils.isEmpty(this.subscriberChoicePlan) && this.subscriberChoicePlan.equalsIgnoreCase(planCode2)) {
                            mintPlanWithZSPlan = next2;
                            break;
                        }
                    }
                }
            }
            if (mintPlanWithZSPlan == null) {
                return list.get(0);
            }
        }
        return mintPlanWithZSPlan;
    }

    private SubscriptionConverter.PLAN_CAMPAIGN getPlanCampaignEnum(String str) {
        SubscriptionConverter.PLAN_CAMPAIGN[] values = SubscriptionConverter.PLAN_CAMPAIGN.values();
        for (int i = 0; i < values.length; i++) {
            if (values[i].getPlanCategory().equalsIgnoreCase(str)) {
                return values[i];
            }
        }
        return SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_KNOWN;
    }

    private MintPlanWithZSPlan getPlanWRTZoho(String str, ArrayList<MintPlanWithZSPlan> arrayList) {
        Iterator<MintPlanWithZSPlan> it = arrayList.iterator();
        while (it.hasNext()) {
            MintPlanWithZSPlan next = it.next();
            if (next != null && next.getSubsPlans() != null && str.equalsIgnoreCase(next.getSubsPlans().getPlanCode())) {
                return next;
            }
        }
        return null;
    }

    private String getSubscribeNowCTA(boolean z, MintPlanWithZSPlan mintPlanWithZSPlan) {
        if (this.config == null) {
            this.config = AppController.j().g();
        }
        return SubscriptionConverter.isJuspayEnable(this.config) ? "Subscribe Now" : getResources().getString(R.string.continue_text);
    }

    private MintSubscriptionDetail getUpdatedSubscriptionDetail(Intent intent) {
        MintSubscriptionDetail l = AppController.j().l();
        if (l == null) {
            Bundle extras = intent != null ? intent.getExtras() : null;
            if (extras != null) {
                l = (MintSubscriptionDetail) extras.getParcelable("Subscription");
                if (l.getStatus() == null) {
                    l.setStatus(extras.getSerializable("Status"));
                }
                if (l.getSource() == null) {
                    l.setSource(extras.getSerializable("Source"));
                }
                if (l.getIntervalUnit() == null) {
                    l.setIntervalUnit(extras.getSerializable("PlanIntervalUnit"));
                }
            }
        }
        return l;
    }

    private MintPlanWithZSPlan getUpdatedTenure(int i, String str) {
        ArrayList<MintPlanWithZSPlan> arrayList;
        int i2;
        MintPlanWithZSPlan mintPlanWithZSPlan = new MintPlanWithZSPlan();
        if (SubscriptionConverter.PLAN_CATEGORY.MINT.getPlanCategory().equalsIgnoreCase(str)) {
            arrayList = this.mintOnlyList;
            i2 = arrayList.size();
        } else if (SubscriptionConverter.PLAN_CATEGORY.WSJ.getPlanCategory().equalsIgnoreCase(str)) {
            arrayList = this.wsjOnlyList;
            i2 = arrayList.size();
        } else if (SubscriptionConverter.PLAN_CATEGORY.ECO.getPlanCategory().equalsIgnoreCase(str)) {
            arrayList = this.ecoOnlyList;
            i2 = arrayList.size();
        } else {
            arrayList = null;
            i2 = 0;
        }
        for (int i3 = 0; i3 < i2; i3++) {
            if (i == i3) {
                mintPlanWithZSPlan = arrayList.get(i);
                mintPlanWithZSPlan.setPlanCategory(str);
                mintPlanWithZSPlan.setSubscriberChoiceLabel(this.subscriberChoiceLabel);
                mintPlanWithZSPlan.setTenureLength(i2);
            }
        }
        return mintPlanWithZSPlan;
    }

    public void goBack() {
        if (getIntent().getExtras() != null && getIntent().getExtras().containsKey("isNotification") && getIntent().getExtras().getInt("isNotification") > q.m.a.ordinal()) {
            startActivity(new Intent((Context) this, (Class<?>) HomeActivity.class));
        }
        setSubscriptionIntent();
        finish();
    }

    private boolean handleDeeplink(Bundle bundle) {
        Set<String> queryParameterNames;
        if (bundle == null || !bundle.containsKey("urlPlankey")) {
            return true;
        }
        String string = bundle.getString("urlPlankey", "");
        if (TextUtils.isEmpty(string)) {
            return true;
        }
        Uri parse = Uri.parse(string);
        String path = parse.getPath();
        if ((!path.equalsIgnoreCase(s0.R0.b()) && !path.equalsIgnoreCase(s0.e0.b())) || (queryParameterNames = parse.getQueryParameterNames()) == null || queryParameterNames.isEmpty()) {
            return true;
        }
        this.couponCodePartner = parse.getQueryParameter(FirebaseAnalytics.Param.COUPON);
        boolean isCampaignSourceAvailable = isCampaignSourceAvailable(parse.getQueryParameterNames());
        this.funnelName = "Campaign";
        if (!isCampaignSourceAvailable) {
            this.planCampaign = SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_KNOWN;
            return true;
        }
        String queryParameter = parse.getQueryParameter("utm_campaign");
        if (TextUtils.isEmpty(queryParameter)) {
            this.planCampaign = SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_MINT;
        } else {
            this.planCampaign = getPlanCampaignEnum(queryParameter);
        }
        this.subscriberChoicePlan = parse.getQueryParameter("plan_code");
        return true;
    }

    private void initConfigAndUpdateUI(Config config) {
        this.mBinding.e.b.t();
        this.mBinding.e.b.setRepeatCount(-1);
        initNumberFormat();
        this.isRazorPayEnabled = config != null && config.getSubscription().isRazorPayEnabled();
    }

    private void initCountryAndPlans() {
        String str = this.mStringCountry;
        if (str == null || str.equalsIgnoreCase(COUNTRY.NA.name())) {
            new AsyncTaskRunner().execute(new Void[0]);
        } else {
            setCouponsBenefitsAndFaQ(this.mStringCountry);
        }
    }

    private void initFaq() {
        n6.a aVar = new n6.a(this, new n6.f() {
            public void fetchFaq(FaqQuesAns faqQuesAns) {
                PlanPageActivity.this.dismissProgressDialog();
                PlanPageActivity.this.setFaqsDataOnView((faqQuesAns == null || faqQuesAns.getFaqQuesAns() == null) ? new ArrayList() : faqQuesAns.getFaqQuesAns());
            }

            public void onFaqError(String str) {
                PlanPageActivity.this.dismissProgressDialog();
                PlanPageActivity.this.mBinding.u.setVisibility(8);
            }
        });
        String faqUrl = getFaqUrl();
        if (!TextUtils.isEmpty(faqUrl)) {
            aVar.a(0, "FetchFaq", faqUrl, (JSONObject) null, (HashMap) null, false, false);
        } else {
            Config config = this.config;
            setFaqsDataOnView((config == null || config.getFrequentlyQuestion() == null) ? new ArrayList() : this.config.getFrequentlyQuestion());
        }
    }

    public void initHandler() {
        if (this.handler == null) {
            this.handler = new Handler();
        }
        this.handler.postDelayed(this.runnable, this.PERIOD_MS);
    }

    private void initJuspay() {
        JuspayCheckout juspayCheckout = new JuspayCheckout(this, false);
        this.juspayCheckout = juspayCheckout;
        juspayCheckout.o(this);
    }

    private void initNumberFormat() {
        if (this.numberFormat == null) {
            NumberFormat numberInstance = NumberFormat.getNumberInstance(new Locale("en"));
            this.numberFormat = numberInstance;
            numberInstance.setRoundingMode(RoundingMode.CEILING);
            this.numberFormat.setMaximumFractionDigits(2);
        }
    }

    private void initPianoExp() {
        PianoCallbacks pianoCallbacks = new PianoCallbacks(this, this);
        HashMap<String, String> hashMap = new HashMap<>();
        if (!TextUtils.isEmpty(this.mStringCountry)) {
            if (COUNTRY.India.name().equalsIgnoreCase(this.mStringCountry)) {
                hashMap.put("Country", "in");
            } else {
                hashMap.put("Country", this.mStringCountry.toLowerCase());
            }
        }
        pianoCallbacks.checkUserScope(PianoAppConstant.PIANO_PLAN_PAGE_NAME, null, "https://accounts.hindustantimes.com/lm/userplan", hashMap, this.content);
    }

    private void initPlanPage() {
        Bundle extras = getIntent().getExtras();
        if (extras == null || !handleDeeplink(extras)) {
            return;
        }
        this.funnelName = extras.getString("funnelName", "");
        this.paywallReason = extras.containsKey("paywallReason") ? extras.getString("paywallReason") : "";
        SubscriptionPlanSingleton.getInstance().setFunnelName(this.funnelName);
        SubscriptionPlanSingleton.getInstance().setPaywallReason(this.paywallReason);
        if (this.funnelName.equalsIgnoreCase(WebEngageAnalytices.SUBSCRIPTION_POP_UP)) {
            this.content = SubscriptionPlanSingleton.getInstance().getContent();
        }
        if (extras.containsKey("keyPremiumStrory")) {
            this.premiumStory = extras.getString("keyPremiumStrory");
        }
        if (TextUtils.isEmpty(this.premiumStory)) {
            this.premiumStory = this.paywallReason;
        }
        if (extras.containsKey("lastAceessUrl")) {
            this.lastAccessUrl = extras.getString("lastAceessUrl");
        }
        SnowplowSubscriptionAnalytices.trackLinkClick(extras);
    }

    private void initProgressDialogAndShow() {
        ProgressDialog progressDialog = this.pDialog;
        if (progressDialog != null && !progressDialog.isShowing()) {
            this.pDialog.show();
            return;
        }
        if (this.pDialog == null) {
            ProgressDialog progressDialog2 = new ProgressDialog(this);
            this.pDialog = progressDialog2;
            progressDialog2.setMessage("Please wait...!");
            this.pDialog.setCancelable(false);
            if (this.pDialog.isShowing()) {
                return;
            }
            this.pDialog.show();
        }
    }

    private void initSubscription(com.htmedia.mint.pojo.config.Config r7) {
        throw new UnsupportedOperationException("Method not decompiled: com.htmedia.mint.htsubscription.planpagerewamp.ui.activities.PlanPageActivity.initSubscription(com.htmedia.mint.pojo.config.Config):void");
    }

    private void initializeAllReleatedDetails() {
        String E1 = f0.E1(this);
        this.mStringCountry = E1;
        if (E1 != null) {
            COUNTRY country = COUNTRY.US;
            if (E1.equalsIgnoreCase(country.name())) {
                this.country = country;
            } else {
                String str = this.mStringCountry;
                COUNTRY country2 = COUNTRY.India;
                if (str.equalsIgnoreCase(country2.name())) {
                    this.country = country2;
                } else {
                    String str2 = this.mStringCountry;
                    COUNTRY country3 = COUNTRY.Other;
                    if (str2.equalsIgnoreCase(country3.name())) {
                        this.country = country3;
                    }
                }
            }
        } else {
            this.country = COUNTRY.NA;
        }
        initConfigAndUpdateUI(this.config);
        this.couponModulePlanPage = new CouponModulePlanPage(this, this.mBinding);
        initPlanPage();
        SubscriptionConverter.PLAN_CAMPAIGN plan_campaign = SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_MINT;
        SubscriptionConverter.PLAN_CAMPAIGN plan_campaign2 = this.planCampaign;
        if (plan_campaign == plan_campaign2 || SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_ECO == plan_campaign2 || SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_WSJ == plan_campaign2 || SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_MINT_LITE == plan_campaign2) {
            initSubscription(this.config);
        } else {
            initPianoExp();
        }
        initProgressDialogAndShow();
    }

    public void initiatePayment(MintSubscriptionDetail mintSubscriptionDetail) {
        SubscriptionPlanSingleton subscriptionPlanSingleton = SubscriptionPlanSingleton.getInstance();
        WebEngageAnalytices.PAYMENTSTORE paymentstore = WebEngageAnalytices.PAYMENTSTORE.PLAY_STORE;
        subscriptionPlanSingleton.setPaymentMethod(paymentstore.getStore());
        WebEngageAnalytices.trackPaymentStatus(WebEngageAnalytices.SUBSCRIPTION_NOW_CLICK, null, this.mintPlanWithZSPlan, null, this.funnelName, null, paymentstore.getStore(), true);
        if (this.selectedPlan == null) {
            MintPlanWithZSPlan mintPlanWithZSPlan = this.mintPlanWithZSPlan;
            if (mintPlanWithZSPlan == null || mintPlanWithZSPlan.getSubsPlans() == null) {
                Toast.makeText((Context) this, (CharSequence) "Something went wrong. Please try later.", 0).show();
                return;
            } else {
                Toast.makeText((Context) this, (CharSequence) "Something went wrong. Please try later.", 0).show();
                return;
            }
        }
        MintPlanWithZSPlan mintPlanWithZSPlan2 = this.mintPlanWithZSPlan;
        SnowplowSubscriptionAnalytices.trackSubscribeNowButtonClick((mintPlanWithZSPlan2 == null || mintPlanWithZSPlan2.getPlanCategory() == null || !this.mintPlanWithZSPlan.getPlanCategory().equalsIgnoreCase(SubscriptionConverter.PLAN_CATEGORY.WSJ.getPlanCategory())) ? false : true, this.selectedPlan);
        String storeOrderId = (mintSubscriptionDetail == null || mintSubscriptionDetail.getSource() == null || mintSubscriptionDetail.getSource() != SubscriptionSource.playstore) ? "" : mintSubscriptionDetail.getStoreOrderId();
        String str = TextUtils.isEmpty(storeOrderId) ? "" : storeOrderId;
        if (str.equalsIgnoreCase("unknown")) {
            MintPlanWithZSPlan mintPlanWithZSPlan3 = this.mintPlanWithZSPlan;
            if (mintPlanWithZSPlan3 == null || mintPlanWithZSPlan3.getSubsPlans() == null) {
                Toast.makeText((Context) this, (CharSequence) "Something went wrong. Please try later.", 0).show();
                return;
            } else {
                Toast.makeText((Context) this, (CharSequence) "Something went wrong. Please try later.", 0).show();
                return;
            }
        }
        ArrayList arrayList = new ArrayList();
        ZSCustomField zSCustomField = new ZSCustomField("cf_localized_currency", this.selectedPlan.getSkuDetails().d());
        arrayList.add(new ZSCustomField("cf_eco_new_app", "yes"));
        arrayList.add(zSCustomField);
        ZohoInAppConfig.getInAppPurchaseKit();
        ZSInAppPurchaseKit.getInstance().initiateNewPurchase(this, this.selectedPlan, str, arrayList, this);
    }

    private boolean isCampaignSourceAvailable(Set<String> set) {
        Iterator<String> it = set.iterator();
        while (it.hasNext()) {
            if ("utm_campaign".equals(it.next())) {
                return true;
            }
        }
        return false;
    }

    private boolean isGooglePayAvailable(List<PaymentMethod> list) {
        if (list == null || list.isEmpty()) {
            return false;
        }
        Iterator<PaymentMethod> it = list.iterator();
        while (it.hasNext()) {
            String type = it.next().getType();
            if (!TextUtils.isEmpty(type) && q.v.b.name().equalsIgnoreCase(type)) {
                return true;
            }
        }
        return false;
    }

    public void lambda$onFaqClick$0(View view) {
        this.mBinding.y.scrollBy(0, view.getHeight() + 50);
    }

    public void lambda$onFaqClick$1(int i) {
        this.mBinding.y.scrollBy(0, i);
    }

    public static void lambda$showTenurePlansList$2(View view) {
    }

    private void mapZohoPlansWithMintPlan(ArrayList<ZSPlan> arrayList) {
        Iterator<ZSPlan> it = arrayList.iterator();
        while (it.hasNext()) {
            ZSPlan next = it.next();
            String str = next.code;
            MintPlanWithZSPlan planWRTZoho = getPlanWRTZoho(str, this.mintOnlyList);
            if (planWRTZoho != null) {
                planWRTZoho.setZsPlan(next);
            } else {
                MintPlanWithZSPlan planWRTZoho2 = getPlanWRTZoho(str, this.wsjOnlyList);
                if (planWRTZoho2 != null) {
                    planWRTZoho2.setZsPlan(next);
                } else {
                    MintPlanWithZSPlan planWRTZoho3 = getPlanWRTZoho(str, this.mintLiteOnlyList);
                    if (planWRTZoho3 != null) {
                        planWRTZoho3.setZsPlan(next);
                    } else {
                        MintPlanWithZSPlan planWRTZoho4 = getPlanWRTZoho(str, this.mintBarronList);
                        if (planWRTZoho4 != null) {
                            planWRTZoho4.setZsPlan(next);
                        } else {
                            MintPlanWithZSPlan planWRTZoho5 = getPlanWRTZoho(str, this.wsjBarronList);
                            if (planWRTZoho5 != null) {
                                planWRTZoho5.setZsPlan(next);
                            }
                        }
                    }
                }
            }
        }
    }

    private void newSubscriptionPage(MintSubscriptionDetail mintSubscriptionDetail) {
        SyncPurchaseWithSession.syncPurchaseWithSession(this, mintSubscriptionDetail);
        Intent intent = new Intent();
        intent.putExtra("Subscription", (Parcelable) mintSubscriptionDetail);
        intent.putExtra("Status", (Serializable) mintSubscriptionDetail.getStatus());
        intent.putExtra("Source", (Serializable) mintSubscriptionDetail.getSource());
        intent.putExtra("PlanIntervalUnit", (Serializable) mintSubscriptionDetail.getIntervalUnit());
        Intent intent2 = getIntent();
        if (intent2 != null && intent2.getExtras() != null && intent2.getExtras().containsKey("isNotification") && intent2.getExtras().getInt("isNotification") > q.m.a.ordinal()) {
            startActivity(new Intent((Context) this, (Class<?>) HomeActivity.class));
        }
        setResult(-1, intent);
        finish();
    }

    public void onFaqClick(int i, int i2, FrequentlyQuestion frequentlyQuestion) {
        int heightOfScreen = (getHeightOfScreen() * 3) / 4;
        int height = this.mBinding.i.b.getHeight();
        int scrollY = this.mBinding.y.getScrollY();
        int height2 = this.mBinding.y.getHeight();
        int[] iArr = new int[2];
        if (i == i2 - 1) {
            final int i3 = scrollY + height2 + height;
            this.mBinding.y.post(new Runnable() {
                @Override
                public final void run() {
                    PlanPageActivity.this.lambda$onFaqClick$1(i3);
                }
            });
            return;
        }
        final View childAt = this.mBinding.i.b.getChildAt(i);
        childAt.getLocationInWindow(iArr);
        if (heightOfScreen <= iArr[1]) {
            this.mBinding.y.post(new Runnable() {
                @Override
                public final void run() {
                    PlanPageActivity.this.lambda$onFaqClick$0(childAt);
                }
            });
        } else {
            this.mBinding.i.b.scrollToPosition(i);
        }
    }

    private void openCheckoutPage(MintSubscriptionDetail mintSubscriptionDetail) {
        SubscriptionPlanSingleton.getInstance().setPaywallReason(this.paywallReason);
        WebEngageAnalytices.trackPaymentStatus(WebEngageAnalytices.SUBSCRIPTION_NOW_CLICK, null, this.mintPlanWithZSPlan, null, this.funnelName, this.paywallReason, WebEngageAnalytices.PAYMENTSTORE.UNKOWN.getStore(), false);
        MintPlanWithZSPlan mintPlanWithZSPlan = this.mintPlanWithZSPlan;
        if (mintPlanWithZSPlan == null || this.selectedPlan == null) {
            return;
        }
        SnowplowSubscriptionAnalytices.trackSubscribeNowButtonClick((mintPlanWithZSPlan == null || mintPlanWithZSPlan.getPlanCategory() == null || !this.mintPlanWithZSPlan.getPlanCategory().equalsIgnoreCase(SubscriptionConverter.PLAN_CATEGORY.WSJ.getPlanCategory())) ? false : true, this.selectedPlan);
        SubscriptionPlanSingleton subscriptionPlanSingleton = SubscriptionPlanSingleton.getInstance();
        MintPlanWithZSPlan mintPlanWithZSPlan2 = this.mintPlanWithZSPlan;
        if (mintPlanWithZSPlan2 != null && mintPlanWithZSPlan2.getZsPlan() == null) {
            this.mintPlanWithZSPlan.setZsPlan(this.selectedPlan);
        }
        subscriptionPlanSingleton.setMintPlanWithZSPlan(this.mintPlanWithZSPlan);
        subscriptionPlanSingleton.setSubsscreen(q.g0.a);
        subscriptionPlanSingleton.setFunnelName(this.funnelName);
        subscriptionPlanSingleton.setPremiumStory(this.premiumStory);
        subscriptionPlanSingleton.setPaywallReason(this.paywallReason);
        subscriptionPlanSingleton.setLastAccessUrl(this.lastAccessUrl);
        subscriptionPlanSingleton.setmNeedToSetPassword(this.mNeedToSetPassword);
        subscriptionPlanSingleton.setToShowAdFreeText(this.isToShowAdFreeText);
        subscriptionPlanSingleton.setMintSubscriptionDetail(mintSubscriptionDetail);
        openRazorPayCheckout(mintSubscriptionDetail, this.mintPlanWithZSPlan);
    }

    private void openRazorPayCheckout(MintSubscriptionDetail mintSubscriptionDetail, MintPlanWithZSPlan mintPlanWithZSPlan) {
        List<PaymentMethod> paymentMethod;
        boolean isJuspayEnableForPlanPage = SubscriptionConverter.isJuspayEnableForPlanPage(this.config, this.country.name() + "");
        PianoPlan pianoPlan = mintPlanWithZSPlan.getPianoPlan();
        if (pianoPlan == null) {
            openSubscriptionCheckout(null, isJuspayEnableForPlanPage);
            return;
        }
        COUNTRY country = this.country;
        if (country == null || country == COUNTRY.India) {
            paymentMethod = pianoPlan.getPaymentMethod();
        } else {
            paymentMethod = pianoPlan.getOutsideIndiaPaymentMethod();
            if (paymentMethod == null) {
                paymentMethod = pianoPlan.getPaymentMethod();
            }
        }
        if (paymentMethod == null || paymentMethod.isEmpty()) {
            openSubscriptionCheckout(paymentMethod, isJuspayEnableForPlanPage);
            return;
        }
        boolean isGooglePayAvailable = isGooglePayAvailable(paymentMethod);
        if (isGooglePayAvailable && isJuspayEnableForPlanPage) {
            activateBottomSheet(mintSubscriptionDetail);
            return;
        }
        if (!isGooglePayAvailable && isJuspayEnableForPlanPage) {
            openSubscriptionCheckout(null, true);
            return;
        }
        if (paymentMethod.size() != 1) {
            openSubscriptionCheckout(paymentMethod, isJuspayEnableForPlanPage);
            return;
        }
        PaymentMethod paymentMethod2 = paymentMethod.get(0);
        String type = paymentMethod2.getType();
        if (TextUtils.isEmpty(type)) {
            openSubscriptionCheckout(paymentMethod, isJuspayEnableForPlanPage);
            return;
        }
        q.v valueOf = q.v.valueOf(type);
        String autoRecurring = paymentMethod2.getAutoRecurring();
        boolean z = !TextUtils.isEmpty(autoRecurring) && ("1".equalsIgnoreCase(autoRecurring.trim()) || "true".equalsIgnoreCase(autoRecurring.trim()));
        int i = AnonymousClass15.$SwitchMap$com$htmedia$mint$utils$AppConstants$PAYMENT_TYPE[valueOf.ordinal()];
        if (i == 1) {
            SubsPlans subsPlans = mintPlanWithZSPlan.getSubsPlans();
            this.razorPayCheckout = new RazorPayCheckout(this, valueOf, (subsPlans == null || subsPlans.getRecurringPrice() < 5000.0d) ? z : false);
            return;
        }
        if (i == 2 || i == 3) {
            this.razorPayCheckout = new RazorPayCheckout(this, valueOf, false);
            return;
        }
        if (i == 4) {
            this.razorPayCheckout = new RazorPayCheckout(this, valueOf, z);
            return;
        }
        if (i != 5) {
            openSubscriptionCheckout(paymentMethod, isJuspayEnableForPlanPage);
        } else if (this.selectedPlan != null) {
            initiatePayment(mintSubscriptionDetail);
        } else {
            openSubscriptionCheckout(paymentMethod, isJuspayEnableForPlanPage);
        }
    }

    public void openSubscriptionCheckout(List<PaymentMethod> list, boolean z) {
        if (z) {
            if (this.juspayCheckout == null) {
                initJuspay();
            }
            JuspayCheckout juspayCheckout = this.juspayCheckout;
            if (juspayCheckout != null) {
                juspayCheckout.u(this, false, this.mintPlanWithZSPlan);
                return;
            }
            return;
        }
        if (list != null) {
            ArrayList arrayList = new ArrayList();
            Iterator<PaymentMethod> it = list.iterator();
            while (it.hasNext()) {
                arrayList.add(it.next().getType());
            }
            SubscriptionPlanSingleton.getInstance().setPaymentOptions(arrayList);
        }
        Intent intent = new Intent((Context) this, (Class<?>) SubscriptionCheckOutPage.class);
        intent.putExtras(getIntent());
        getIntent().putExtra("needSetPassword", this.mNeedToSetPassword);
        startActivityForResult(intent, 20524);
    }

    private void sendChangeTenure(String str) {
        WebEngageAnalytices.changeTenureEvent(str, this.initialPlan, this.initialTenure, this.strOldPlan, this.strOldTenure, this.strNewPlan, this.strNewTenure);
    }

    private void setAddImagesInList() {
        List arrayList;
        PlanPageV2 planPageV2;
        List arrayList2;
        PlanPageV2 planPageV22;
        if (this.config != null) {
            if (this.isNightMode) {
                PlanPageExperience planPageExperience = this.planPageExperience;
                if (planPageExperience == null || planPageExperience.getPlanPageV2() == null || this.planPageExperience.getPlanPageV2().getAndroidHeaderImagesNight() == null || this.planPageExperience.getPlanPageV2().getAndroidHeaderImagesNight().size() <= 0) {
                    Config config = this.config;
                    if (config == null || config.getPlanPageV2() == null || this.config.getPlanPageV2().getAndroidHeaderImagesNight() == null) {
                        arrayList2 = new ArrayList();
                        if (arrayList2 != null || arrayList2.size() <= 0) {
                            return;
                        }
                        ArrayList<String> arrayList3 = (ArrayList) ((ArrayList) arrayList2).clone();
                        this.plansInfoPagesList = arrayList3;
                        this.initialPagerSize = arrayList3.size();
                        return;
                    }
                    planPageV22 = this.config.getPlanPageV2();
                } else {
                    planPageV22 = this.planPageExperience.getPlanPageV2();
                }
                arrayList2 = planPageV22.getAndroidHeaderImagesNight();
                if (arrayList2 != null) {
                    return;
                } else {
                    return;
                }
            }
            PlanPageExperience planPageExperience2 = this.planPageExperience;
            if (planPageExperience2 == null || planPageExperience2.getPlanPageV2() == null || this.planPageExperience.getPlanPageV2().getAndroidHeaderImagesDay() == null || this.planPageExperience.getPlanPageV2().getAndroidHeaderImagesDay().size() <= 0) {
                Config config2 = this.config;
                if (config2 == null || config2.getPlanPageV2() == null || this.config.getPlanPageV2().getAndroidHeaderImagesDay() == null) {
                    arrayList = new ArrayList();
                    if (arrayList != null || arrayList.size() <= 0) {
                    }
                    ArrayList<String> arrayList4 = (ArrayList) ((ArrayList) arrayList).clone();
                    this.plansInfoPagesList = arrayList4;
                    this.initialPagerSize = arrayList4.size();
                    return;
                }
                planPageV2 = this.config.getPlanPageV2();
            } else {
                planPageV2 = this.planPageExperience.getPlanPageV2();
            }
            arrayList = planPageV2.getAndroidHeaderImagesDay();
            if (arrayList != null) {
            }
        }
    }

    private void setBankCoupon() {
        String bankOffer;
        PartnersOfferPresenter partnersOfferPresenter = new PartnersOfferPresenter(this, new PartnersOfferViewInterface() {
            public void fetchPartnersOffer(CouponPartner couponPartner) {
                if (couponPartner.getData() == null || couponPartner.getData().size() <= 0) {
                    PlanPageActivity.this.mBinding.t.setVisibility(8);
                } else {
                    PlanPageActivity.this.bankCouponOfferList = (ArrayList) couponPartner.getData();
                    if (PlanPageActivity.this.bankCouponOfferList == null || PlanPageActivity.this.bankCouponOfferList.size() <= 0) {
                        PlanPageActivity.this.mBinding.t.setVisibility(8);
                    } else {
                        PlanPageActivity.this.mBinding.t.setVisibility(0);
                        PlanPageActivity.this.setUpCouponsViewPager((ArrayList) PlanPageActivity.this.bankCouponOfferList.clone());
                    }
                }
                if (PlanPageActivity.this.couponModule != null && (PlanPageActivity.this.couponModule == q.d.d || PlanPageActivity.this.couponModule == q.d.b)) {
                    PlanPageActivity.this.setPartnerBenefits();
                } else {
                    PlanPageActivity.this.autoApplyCouponCode();
                    PlanPageActivity.this.dismissProgressDialog();
                }
            }

            public void onPartnersOfferError(String str) {
                PlanPageActivity.this.mBinding.t.setVisibility(8);
                if (PlanPageActivity.this.couponModule != null && (PlanPageActivity.this.couponModule == q.d.d || PlanPageActivity.this.couponModule == q.d.b)) {
                    PlanPageActivity.this.setPartnerBenefits();
                } else {
                    PlanPageActivity.this.autoApplyCouponCode();
                    PlanPageActivity.this.dismissProgressDialog();
                }
            }
        });
        PlanPageExperience planPageExperience = this.planPageExperience;
        if (planPageExperience == null || planPageExperience.getFaqBenefitsCoupons() == null || this.planPageExperience.getFaqBenefitsCoupons().getCoupons() == null) {
            Config config = this.config;
            bankOffer = (config == null || config.getPlanPageV2() == null || this.config.getPlanPageV2().getBankOffer() == null) ? "" : this.config.getPlanPageV2().getBankOffer();
        } else {
            bankOffer = this.planPageExperience.getFaqBenefitsCoupons().getCoupons();
        }
        partnersOfferPresenter.fetchPartnersOffers(0, "FetchBankOffer", bankOffer, (JSONObject) null, (HashMap) null, false, false);
    }

    private void setCouponPagerScrollListner(final ArrayList<PartnersOfferPojo> arrayList) {
        createCouponPagerCustomIndicator();
        if (arrayList == null || arrayList.size() <= 1) {
            return;
        }
        this.mBinding.g.a.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            public void onPageScrollStateChanged(int i) {
            }

            public void onPageScrolled(int i, float f, int i2) {
            }

            public void onPageSelected(int i) {
                if (arrayList != null && r0.size() - 1 == i) {
                    ArrayList arrayList2 = arrayList;
                    arrayList2.addAll(arrayList2);
                    PlanPageActivity.this.couponsPagerAdapter.notifyDataSetChanged();
                }
                ?? r0 = PlanPageActivity.this;
                CustomPagerIndicator.setCouponCustomIndicator(r0, i, ((PlanPageActivity) r0).couponViewArray);
            }
        });
    }

    public void setCouponsBenefitsAndFaQ(String str) {
        int i;
        PlanPageV2 planPageV2;
        int i2;
        PlanPageV2 planPageV22;
        if (this.config == null) {
            this.config = AppController.j().g();
        }
        if (str == null || !str.equalsIgnoreCase(COUNTRY.India.name())) {
            PlanPageExperience planPageExperience = this.planPageExperience;
            int i3 = 1;
            if (planPageExperience == null || planPageExperience.getPlanPageV2() == null || this.planPageExperience.getPlanPageV2().getAndroidCouponShowOutsideIndia() >= 4) {
                Config config = this.config;
                if (config == null || config.getPlanPageV2() == null || this.config.getPlanPageV2().getAndroidCouponShowOutsideIndia() >= 4) {
                    i = 1;
                    if (i < q.d.values().length && i >= 0) {
                        i3 = i;
                    }
                    this.couponModule = q.d.values()[i3];
                } else {
                    planPageV2 = this.config.getPlanPageV2();
                }
            } else {
                planPageV2 = this.planPageExperience.getPlanPageV2();
            }
            i = planPageV2.getAndroidCouponShowOutsideIndia();
            if (i < q.d.values().length) {
                i3 = i;
            }
            this.couponModule = q.d.values()[i3];
        } else {
            PlanPageExperience planPageExperience2 = this.planPageExperience;
            int i7 = 3;
            if (planPageExperience2 == null || planPageExperience2.getPlanPageV2() == null || this.planPageExperience.getPlanPageV2().getAndroidCouponShowInsideIndia() >= 4) {
                Config config2 = this.config;
                if (config2 == null || config2.getPlanPageV2() == null || this.config.getPlanPageV2().getAndroidCouponShowInsideIndia() >= 4) {
                    i2 = 3;
                    if (i2 < q.d.values().length && i2 >= 0) {
                        i7 = i2;
                    }
                    this.couponModule = q.d.values()[i7];
                } else {
                    planPageV22 = this.config.getPlanPageV2();
                }
            } else {
                planPageV22 = this.planPageExperience.getPlanPageV2();
            }
            i2 = planPageV22.getAndroidCouponShowInsideIndia();
            if (i2 < q.d.values().length) {
                i7 = i2;
            }
            this.couponModule = q.d.values()[i7];
        }
        fetchPlansFromMintServer();
        initFaq();
    }

    public void setFaqsDataOnView(List<FrequentlyQuestion> list) {
        if (list == null || list.isEmpty() || list.size() <= 0) {
            this.mBinding.u.setVisibility(8);
            return;
        }
        this.mBinding.u.setVisibility(0);
        PPFaqAdapter pPFaqAdapter = new PPFaqAdapter(this, list, new PPFaqAdapter.OnPPFaqItemClick() {
            @Override
            public void onPPFaqClick(int i, int i2, FrequentlyQuestion frequentlyQuestion) {
                PlanPageActivity.this.onFaqClick(i, i2, frequentlyQuestion);
            }
        });
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        linearLayoutManager.setOrientation(1);
        this.mBinding.i.b.setLayoutManager(linearLayoutManager);
        pPFaqAdapter.setFaqList(list);
        this.mBinding.i.b.setAdapter(pPFaqAdapter);
    }

    private void setOnNewSelectedTenure(int i) {
        CouponUtils.COUPONSTATUS couponstatus;
        int size = this.masterPlanList.size();
        for (int i2 = 0; i2 < size; i2++) {
            if (this.masterPlanList.get(i2).getPlanCategory().equalsIgnoreCase(this.mPlanCategory)) {
                this.masterPlanList.set(i2, getUpdatedTenure(i, this.mPlanCategory));
                this.mintPlanWithZSPlan = getUpdatedTenure(i, this.mPlanCategory);
            }
        }
        MintPlanWithZSPlan mintPlanWithZSPlan = this.mintPlanWithZSPlan;
        if (mintPlanWithZSPlan != null && mintPlanWithZSPlan.getSubsPlans() != null) {
            SubsPlans subsPlans = this.mintPlanWithZSPlan.getSubsPlans();
            setPlanValues(subsPlans != null ? subsPlans.getDescription() : "", subsPlans != null ? subsPlans.getName() : "", this.strNewPlan, this.strNewTenure);
            sendChangeTenure(WebEngageAnalytices.CHANGE_TENURE);
        }
        MintPlanWithZSPlan mintPlanWithZSPlan2 = this.mintPlanWithZSPlan;
        if (mintPlanWithZSPlan2 != null && (couponstatus = this.couponstatus) != null && couponstatus != CouponUtils.COUPONSTATUS.APPLY) {
            if (mintPlanWithZSPlan2.isCouponApplied()) {
                this.couponstatus = CouponUtils.COUPONSTATUS.APPLIED;
            } else {
                this.couponstatus = CouponUtils.COUPONSTATUS.INVALID;
            }
        }
        this.plansListAdapter.notifyDataSetChanged();
        updateBottomFooterInitial();
    }

    private void setPagerScrollListner() {
        createCustomIndicator();
        this.mBinding.j.b.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            public void onPageScrollStateChanged(int i) {
            }

            public void onPageScrolled(int i, float f, int i2) {
            }

            public void onPageSelected(int i) {
                if (i == PlanPageActivity.this.plansInfoPagesList.size() - 1) {
                    ArrayList<String> arrayList = PlanPageActivity.this.plansInfoPagesList;
                    arrayList.addAll(arrayList);
                    PlanPageActivity.this.plansInfoPagerAdapter.notifyDataSetChanged();
                }
                ?? r0 = PlanPageActivity.this;
                r0.currentPage = i;
                CustomPagerIndicator.setCustomIndicator(r0, ((PlanPageActivity) r0).initialPagerSize, i, PlanPageActivity.this.viewArray);
            }
        });
    }

    public void setPartnerBenefits() {
        String partnerOffer;
        PartnersOfferPresenter partnersOfferPresenter = new PartnersOfferPresenter(this, new PartnersOfferViewInterface() {
            public void fetchPartnersOffer(CouponPartner couponPartner) {
                if (couponPartner.getData() == null || couponPartner.getData().size() <= 0) {
                    PlanPageActivity.this.mBinding.q.setVisibility(8);
                } else {
                    PlanPageActivity.this.partnerBenefitsList = (ArrayList) couponPartner.getData();
                    if (PlanPageActivity.this.partnerBenefitsList == null || PlanPageActivity.this.partnerBenefitsList.size() <= 0) {
                        PlanPageActivity.this.mBinding.q.setVisibility(8);
                    } else {
                        PlanPageActivity.this.mBinding.q.setVisibility(0);
                        PlanPageActivity planPageActivity = PlanPageActivity.this;
                        planPageActivity.setUpAdditionBenefitsAdapter(planPageActivity.partnerBenefitsList);
                    }
                }
                PlanPageActivity.this.autoApplyCouponCode();
                PlanPageActivity.this.dismissProgressDialog();
            }

            public void onPartnersOfferError(String str) {
                PlanPageActivity.this.mBinding.q.setVisibility(8);
                PlanPageActivity.this.autoApplyCouponCode();
                PlanPageActivity.this.dismissProgressDialog();
            }
        });
        PlanPageExperience planPageExperience = this.planPageExperience;
        if (planPageExperience == null || planPageExperience.getFaqBenefitsCoupons() == null || this.planPageExperience.getFaqBenefitsCoupons().getAndroidBenefits() == null) {
            Config config = this.config;
            partnerOffer = (config == null || config.getPlanPageV2() == null || this.config.getPlanPageV2().getPartnerOffer() == null) ? "" : this.config.getPlanPageV2().getPartnerOffer();
        } else {
            partnerOffer = this.planPageExperience.getFaqBenefitsCoupons().getAndroidBenefits();
        }
        partnersOfferPresenter.fetchPartnersOffers(0, "FetchPartnersOffer", partnerOffer, (JSONObject) null, (HashMap) null, false, false);
    }

    private void setPlanValues(String str, String str2, String str3, String str4) {
        this.strNewPlan = str;
        this.strNewTenure = str2;
        this.strOldPlan = str3;
        this.strOldTenure = str4;
    }

    private void setSeeCouponApplyCouponText() {
        q.d dVar = this.couponModule;
        if (dVar != null) {
            if (dVar == q.d.d || dVar == q.d.a) {
                this.mBinding.e.h.setText(getString(R.string.see_coupons));
                this.mBinding.e.a.setVisibility(8);
            } else if (dVar == q.d.b || dVar == q.d.c) {
                this.mBinding.e.h.setText(getString(R.string.apply_coupon));
                this.mBinding.e.a.setVisibility(8);
            } else {
                this.mBinding.e.h.setText("");
                this.mBinding.e.a.setVisibility(8);
            }
        }
    }

    private void setSubscribeNowCTA(boolean z, MintPlanWithZSPlan mintPlanWithZSPlan) {
        this.mBinding.e.f.setText(getSubscribeNowCTA(z, mintPlanWithZSPlan));
    }

    private List<String> setSubscriberChoiceGroup(String str, List<String> list, List<String> list2) {
        if (list.contains(str) && !list2.contains(str)) {
            list2.add(str);
        }
        return list2;
    }

    private void setSubscriptionIntent() {
        MintSubscriptionDetail l = AppController.j().l();
        if (l != null && l.isSubscriptionActive()) {
            f0.K("l1_menu_order", this);
        }
        if (GetSubscriptionIntent.getSubscriptionIntent() != null) {
            setResult(-1, GetSubscriptionIntent.getSubscriptionIntent());
        } else {
            setResult(-1);
        }
    }

    private void setToolbar() {
        Toolbar findViewById = findViewById(R.id.toolbar);
        findViewById.setContentInsetStartWithNavigation(0);
        findViewById.setTitle("Back");
        findViewById.setTitleTextColor(ResourcesCompat.getColor(getResources(), R.color.white_divider_black_theme, (Resources.Theme) null));
        findViewById.setNavigationIcon(R.drawable.back);
        setSupportActionBar(findViewById);
        getSupportActionBar().setDisplayShowTitleEnabled(true);
        if (findViewById.getTitle() != null) {
            String charSequence = findViewById.getTitle().toString();
            for (int i = 0; i < findViewById.getChildCount(); i++) {
                AppCompatTextView childAt = findViewById.getChildAt(i);
                if ("androidx.appcompat.widget.AppCompatTextView".equals(childAt.getClass().getName())) {
                    AppCompatTextView appCompatTextView = childAt;
                    if (appCompatTextView.getText().equals(charSequence)) {
                        appCompatTextView.setTypeface(ResourcesCompat.getFont(this, R.font.lato_regular));
                        childAt.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                PlanPageActivity.this.goBack();
                            }
                        });
                    }
                }
            }
        }
    }

    public void setUpAdditionBenefitsAdapter(ArrayList<PartnersOfferPojo> arrayList) {
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        this.mBinding.d.a.setNestedScrollingEnabled(false);
        this.mBinding.d.a.setLayoutManager(linearLayoutManager);
        BenefitsVerticalListAdapter benefitsVerticalListAdapter = new BenefitsVerticalListAdapter(this, arrayList);
        this.benefitsVerticalListAdapter = benefitsVerticalListAdapter;
        this.mBinding.d.a.setAdapter(benefitsVerticalListAdapter);
    }

    private void setUpAppLogo() {
        try {
            m1.b(this, false, this.mBinding.p.a, this.config);
        } catch (Exception unused) {
        }
    }

    private void setUpAutoScroll() {
        ArrayList<String> arrayList = this.plansInfoPagesList;
        if (arrayList == null || arrayList.isEmpty()) {
            return;
        }
        this.runnable = new Runnable() {
            @Override
            public void run() {
                PlanPageActivity.this.startAutoScrollHeader();
                PlanPageActivity.this.stopTimer();
                PlanPageActivity.this.initHandler();
            }
        };
        initHandler();
    }

    public void setUpCouponsViewPager(ArrayList<PartnersOfferPojo> arrayList) {
        int size = arrayList != null ? arrayList.size() : 0;
        if (size > 3) {
            for (int i = 0; i < 3; i++) {
                this.partnersOfferPojosList.add(arrayList.get(i));
            }
        } else if (size > 0) {
            this.partnersOfferPojosList.addAll(arrayList);
        }
        CouponsPagerAdapter couponsPagerAdapter = new CouponsPagerAdapter(this, this.partnersOfferPojosList, this);
        this.couponsPagerAdapter = couponsPagerAdapter;
        this.mBinding.g.a.setAdapter(couponsPagerAdapter);
        this.mBinding.g.a.setNestedScrollingEnabled(false);
        this.mBinding.g.a.setPagingEnabled(true);
        int dimension = (int) getResources().getDimension(R.dimen.dp_15);
        this.mBinding.g.a.setPadding(dimension, 0, dimension, 0);
        this.mBinding.g.a.setPageMargin(dimension);
        setCouponPagerScrollListner(this.partnersOfferPojosList);
    }

    private void setUpDarkMode() {
        if (AppController.j().E()) {
            getWindow().setStatusBarColor(-16777216);
            getWindow().getDecorView().setSystemUiVisibility(0);
            this.mBinding.p.c.setTitleTextColor(ResourcesCompat.getColor(getResources(), R.color.white_divider_black_theme_night, (Resources.Theme) null));
            this.mBinding.p.c.setNavigationIcon(R.drawable.back_night);
            return;
        }
        getWindow().setStatusBarColor(-1);
        getWindow().getDecorView().setSystemUiVisibility(UserMetadata.MAX_INTERNAL_KEY_SIZE);
        this.mBinding.p.c.setTitleTextColor(ResourcesCompat.getColor(getResources(), R.color.white_divider_black_theme, (Resources.Theme) null));
        this.mBinding.p.c.setNavigationIcon(R.drawable.back);
    }

    private void setUpHeaderImagesInteractionTimer() {
        boolean z = this.isAndroidCarouselTimerEnabled;
        if (z && this.isAndroidCarouselInteractionEnabled) {
            this.mBinding.j.b.setPagingEnabled(true);
            setUpAutoScroll();
            return;
        }
        if (z && !this.isAndroidCarouselInteractionEnabled) {
            this.mBinding.j.b.setPagingEnabled(false);
            setUpAutoScroll();
        } else if (!z && this.isAndroidCarouselInteractionEnabled) {
            this.mBinding.j.b.setPagingEnabled(true);
        } else {
            if (z || this.isAndroidCarouselInteractionEnabled) {
                return;
            }
            this.mBinding.j.b.setPagingEnabled(false);
        }
    }

    private void setUpImageHeader() {
        setAddImagesInList();
        ArrayList<String> arrayList = this.plansInfoPagesList;
        if (arrayList == null || arrayList.size() <= 0) {
            this.mBinding.v.setVisibility(8);
            return;
        }
        this.mBinding.v.setVisibility(0);
        PlansInfoPagerAdapter plansInfoPagerAdapter = new PlansInfoPagerAdapter(this, this.plansInfoPagesList);
        this.plansInfoPagerAdapter = plansInfoPagerAdapter;
        this.mBinding.j.b.setAdapter(plansInfoPagerAdapter);
        int dimension = (int) getResources().getDimension(R.dimen.dp_15);
        this.mBinding.j.b.setPadding(dimension, 0, dimension, 0);
        this.mBinding.j.b.setPageMargin(dimension);
        setPagerScrollListner();
    }

    private void setUpPlansAdapter(ArrayList<MintPlanWithZSPlan> arrayList, int i) {
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        this.mBinding.o.a.setNestedScrollingEnabled(false);
        this.mBinding.o.a.setLayoutManager(linearLayoutManager);
        PlansListAdapter plansListAdapter = new PlansListAdapter(this, arrayList, this);
        this.plansListAdapter = plansListAdapter;
        plansListAdapter.setCountry(this.country);
        this.plansListAdapter.setmSelectedIndex(i);
        this.mBinding.o.a.setAdapter(this.plansListAdapter);
    }

    private void setUpStudentOffer() {
        Config config = this.config;
        if ((config == null || config.getPlanPageV2() == null) ? false : this.config.getPlanPageV2().isShowStudentOffer()) {
            this.mBinding.z.setVisibility(0);
        } else {
            this.mBinding.z.setVisibility(8);
        }
        this.mBinding.h.b.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                PlanPageActivity.this.startActivity(new Intent((Context) PlanPageActivity.this, (Class<?>) StudentOfferWebView.class));
            }
        });
    }

    private void setUpTabsMargin(TabLayout tabLayout) {
        ViewGroup viewGroup = (ViewGroup) tabLayout.getChildAt(0);
        for (int i = 0; i < viewGroup.getChildCount() - 1; i++) {
            ((ViewGroup.MarginLayoutParams) viewGroup.getChildAt(i).getLayoutParams()).rightMargin = 20;
        }
    }

    private void setViewsClickListener() {
        this.mBinding.e.d.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String str = "";
                if (!PlanPageActivity.this.mBinding.e.h.getText().toString().trim().equals(PlanPageActivity.this.getString(R.string.see_coupons)) && !PlanPageActivity.this.mBinding.e.h.getText().toString().trim().equals(PlanPageActivity.this.getString(R.string.apply_coupon))) {
                    if (PlanPageActivity.this.mBinding.e.h.getText().toString().trim().equals(PlanPageActivity.this.getString(R.string.remove_coupon))) {
                        PlanPageActivity.this.couponModulePlanPage.removeCoupon();
                        PlanPageActivity.this.mCouponCode = "";
                        PlanPageActivity.this.updateBottomFooterInitial();
                        return;
                    }
                    return;
                }
                Intent intent = new Intent((Context) PlanPageActivity.this, (Class<?>) CouponsBenefitsActivity.class);
                Bundle bundle = new Bundle();
                if (PlanPageActivity.this.partnerBenefitsList != null && !PlanPageActivity.this.partnerBenefitsList.isEmpty()) {
                    bundle.putParcelableArrayList(Constants.PP_BENEFITS_LIST, PlanPageActivity.this.partnerBenefitsList);
                }
                if (PlanPageActivity.this.bankCouponOfferList != null && !PlanPageActivity.this.bankCouponOfferList.isEmpty()) {
                    bundle.putParcelableArrayList(Constants.PP_COUPON_LIST, PlanPageActivity.this.bankCouponOfferList);
                }
                bundle.putString(Constants.PP_TYPE, Constants.PP_TYPE_COUPON);
                bundle.putInt(Constants.KEY_COUPON_STATUS, PlanPageActivity.this.getCouponstatus() == null ? 0 : PlanPageActivity.this.getCouponstatus().ordinal());
                bundle.putString(Constants.COUPON_CODE_ONLY, PlanPageActivity.this.getCouponCode());
                if (PlanPageActivity.this.mintPlanWithZSPlan != null && PlanPageActivity.this.mintPlanWithZSPlan.getSubsPlans() != null && !TextUtils.isEmpty(PlanPageActivity.this.mintPlanWithZSPlan.getSubsPlans().getPlanCode())) {
                    str = PlanPageActivity.this.mintPlanWithZSPlan.getSubsPlans().getPlanCode();
                }
                bundle.putString(Constants.KEY_PLAN_CODE_COUPON, str);
                bundle.putInt(Constants.KEY_COUPON_SHOWN, PlanPageActivity.this.couponModule != null ? PlanPageActivity.this.couponModule.ordinal() : 0);
                intent.putExtras(bundle);
                PlanPageActivity.this.overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up);
                PlanPageActivity.this.startActivityForResult(intent, Constants.COUPON_BENEFITS_REQUEST, ActivityOptions.makeCustomAnimation(PlanPageActivity.this, R.anim.slide_in_up, R.anim.slide_out_up).toBundle());
            }
        });
        this.mBinding.d.c.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent((Context) PlanPageActivity.this, (Class<?>) CouponsBenefitsActivity.class);
                Bundle bundle = new Bundle();
                if (PlanPageActivity.this.partnerBenefitsList != null && !PlanPageActivity.this.partnerBenefitsList.isEmpty()) {
                    bundle.putParcelableArrayList(Constants.PP_BENEFITS_LIST, PlanPageActivity.this.partnerBenefitsList);
                }
                if (PlanPageActivity.this.bankCouponOfferList != null && !PlanPageActivity.this.bankCouponOfferList.isEmpty()) {
                    bundle.putParcelableArrayList(Constants.PP_COUPON_LIST, PlanPageActivity.this.bankCouponOfferList);
                }
                bundle.putString(Constants.PP_TYPE, Constants.PP_TYPE_BENEFIT);
                bundle.putString(Constants.COUPON_CODE_ONLY, PlanPageActivity.this.getCouponCode());
                bundle.putInt(Constants.KEY_COUPON_SHOWN, PlanPageActivity.this.couponModule != null ? PlanPageActivity.this.couponModule.ordinal() : 1);
                bundle.putString(Constants.KEY_PLAN_CODE_COUPON, (PlanPageActivity.this.mintPlanWithZSPlan == null || PlanPageActivity.this.mintPlanWithZSPlan.getSubsPlans() == null || TextUtils.isEmpty(PlanPageActivity.this.mintPlanWithZSPlan.getSubsPlans().getPlanCode())) ? "" : PlanPageActivity.this.mintPlanWithZSPlan.getSubsPlans().getPlanCode());
                bundle.putInt(Constants.KEY_COUPON_STATUS, PlanPageActivity.this.getCouponstatus() == null ? 0 : PlanPageActivity.this.getCouponstatus().ordinal());
                intent.putExtras(bundle);
                PlanPageActivity.this.overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up);
                PlanPageActivity.this.startActivityForResult(intent, Constants.COUPON_BENEFITS_REQUEST, ActivityOptions.makeCustomAnimation(PlanPageActivity.this, R.anim.slide_in_up, R.anim.slide_out_up).toBundle());
            }
        });
        this.mBinding.e.c.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (PlanPageActivity.this.mintPlanWithZSPlan != null) {
                    PlanPageActivity.this.mBinding.s.setVisibility(8);
                    PlanPageActivity planPageActivity = PlanPageActivity.this;
                    planPageActivity.selectedPlan = planPageActivity.mintPlanWithZSPlan.getZsPlan();
                    SubscriptionPlanSingleton.getInstance().setFunnelName(PlanPageActivity.this.funnelName);
                    Content content = PlanPageActivity.this.funnelName.equalsIgnoreCase(WebEngageAnalytices.SUBSCRIPTION_POP_UP) ? SubscriptionPlanSingleton.getInstance().getContent() : null;
                    SubscriptionPlanSingleton.getInstance().setSelectedPlan(PlanPageActivity.this.selectedPlan);
                    Content content2 = content;
                    n.A(PlanPageActivity.this, n.g1, "plan_page", n.s0, content2, (String) null);
                    f5.a.e(PlanPageActivity.this, "plan_detail_page_subscribe_button_click", f5.a.d, f5.a.e, content2, null);
                    if (f0.G1(PlanPageActivity.this, "userName") != null) {
                        PlanPageActivity.this.checkZSUserSubscriptionDetail();
                    } else {
                        WebEngageAnalytices.trackClickEvents("Subscribe Now", null, "Sign In Initiate", null, "Subscription Funnel", "", "");
                        PlanPageActivity.this.openLoginPage("Subscription Funnel");
                    }
                }
            }
        });
    }

    private void showTenurePlansList(Activity activity, String str) {
        ArrayList<MintPlanWithZSPlan> arrayList;
        this.mBinding.s.setVisibility(0);
        this.mBinding.s.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                PlanPageActivity.lambda$showTenurePlansList$2(view);
            }
        });
        this.mBinding.f.b.setLayoutManager(new LinearLayoutManager(activity, 0, false));
        if (SubscriptionConverter.PLAN_CATEGORY.MINT.getPlanCategory().equalsIgnoreCase(str)) {
            ArrayList<MintPlanWithZSPlan> arrayList2 = this.mintOnlyList;
            if (arrayList2 != null && arrayList2.size() > 0) {
                ArrayList<MintPlanWithZSPlan> arrayList3 = this.mintOnlyList;
                PlansTenureAdapter plansTenureAdapter = new PlansTenureAdapter(activity, arrayList3, this, getLastSelectedPosition(arrayList3));
                plansTenureAdapter.setCountry(this.country);
                this.mBinding.f.b.setAdapter(plansTenureAdapter);
            }
        } else if (SubscriptionConverter.PLAN_CATEGORY.WSJ.getPlanCategory().equalsIgnoreCase(str)) {
            ArrayList<MintPlanWithZSPlan> arrayList4 = this.wsjOnlyList;
            if (arrayList4 != null && arrayList4.size() > 0) {
                ArrayList<MintPlanWithZSPlan> arrayList5 = this.wsjOnlyList;
                PlansTenureAdapter plansTenureAdapter2 = new PlansTenureAdapter(activity, arrayList5, this, getLastSelectedPosition(arrayList5));
                plansTenureAdapter2.setCountry(this.country);
                this.mBinding.f.b.setAdapter(plansTenureAdapter2);
            }
        } else if (SubscriptionConverter.PLAN_CATEGORY.BARRONS.getPlanCategory().equalsIgnoreCase(str)) {
            ArrayList<MintPlanWithZSPlan> arrayList6 = this.mintBarronList;
            if (arrayList6 != null && arrayList6.size() > 0) {
                ArrayList<MintPlanWithZSPlan> arrayList7 = this.mintBarronList;
                PlansTenureAdapter plansTenureAdapter3 = new PlansTenureAdapter(activity, arrayList7, this, getLastSelectedPosition(arrayList7));
                plansTenureAdapter3.setCountry(this.country);
                this.mBinding.f.b.setAdapter(plansTenureAdapter3);
            }
        } else if (SubscriptionConverter.PLAN_CATEGORY.WSJ_BARRONS.getPlanCategory().equalsIgnoreCase(str)) {
            ArrayList<MintPlanWithZSPlan> arrayList8 = this.wsjBarronList;
            if (arrayList8 != null && arrayList8.size() > 0) {
                ArrayList<MintPlanWithZSPlan> arrayList9 = this.wsjBarronList;
                PlansTenureAdapter plansTenureAdapter4 = new PlansTenureAdapter(activity, arrayList9, this, getLastSelectedPosition(arrayList9));
                plansTenureAdapter4.setCountry(this.country);
                this.mBinding.f.b.setAdapter(plansTenureAdapter4);
            }
        } else if (SubscriptionConverter.PLAN_CATEGORY.ECO.getPlanCategory().equalsIgnoreCase(str)) {
            ArrayList<MintPlanWithZSPlan> arrayList10 = this.ecoOnlyList;
            if (arrayList10 != null && arrayList10.size() > 0) {
                ArrayList<MintPlanWithZSPlan> arrayList11 = this.ecoOnlyList;
                PlansTenureAdapter plansTenureAdapter5 = new PlansTenureAdapter(activity, arrayList11, this, getLastSelectedPosition(arrayList11));
                plansTenureAdapter5.setCountry(this.country);
                this.mBinding.f.b.setAdapter(plansTenureAdapter5);
            }
        } else if (SubscriptionConverter.PLAN_CATEGORY.MINT_LITE.getPlanCategory().equalsIgnoreCase(str) && (arrayList = this.mintLiteOnlyList) != null && arrayList.size() > 0) {
            ArrayList<MintPlanWithZSPlan> arrayList12 = this.mintLiteOnlyList;
            this.mBinding.f.b.setAdapter(new PlansTenureAdapter(activity, arrayList12, this, getLastSelectedPosition(arrayList12)));
        }
        this.mBinding.f.a.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                PlanPageActivity.this.mBinding.s.setVisibility(8);
            }
        });
    }

    public void startAutoScrollHeader() {
        CustomViewPager customViewPager = this.mBinding.j.b;
        int i = this.currentPage;
        this.currentPage = i + 1;
        customViewPager.setCurrentItem(i, true);
    }

    public void stopTimer() {
        Handler handler = this.handler;
        if (handler != null) {
            handler.removeCallbacks(this.runnable);
        }
    }

    private void updateMasterPlanList(Config config) {
        if (config == null) {
            config = AppController.j().g();
        }
        PlanPageExperience planPageExperience = this.planPageExperience;
        List<String> arrayList = (planPageExperience == null || planPageExperience.getSubscriberChoiceList() == null || this.planPageExperience.getSubscriberChoiceList().isEmpty()) ? (config == null || config.getPlanPageV2() == null) ? new ArrayList<>() : config.getPlanPageV2().getSubscriberChoiceGroup() : this.planPageExperience.getSubscriberChoiceList();
        if (arrayList == null || arrayList.size() <= 0) {
            arrayList = new ArrayList<>();
            arrayList.add(SubscriptionConverter.PLAN_CATEGORY.MINT.getPlanCategory());
            arrayList.add(SubscriptionConverter.PLAN_CATEGORY.WSJ.getPlanCategory());
            arrayList.add(SubscriptionConverter.PLAN_CATEGORY.ECO.getPlanCategory());
            arrayList.add(SubscriptionConverter.PLAN_CATEGORY.MINT_LITE.getPlanCategory());
            arrayList.add(SubscriptionConverter.PLAN_CATEGORY.BARRONS.getPlanCategory());
            arrayList.add(SubscriptionConverter.PLAN_CATEGORY.WSJ_BARRONS.getPlanCategory());
        }
        if (!arrayList.isEmpty() && this.planCampaign != null) {
            List<String> arrayList2 = new ArrayList<>();
            switch (AnonymousClass15.$SwitchMap$com$htmedia$mint$htsubscription$SubscriptionConverter$PLAN_CAMPAIGN[this.planCampaign.ordinal()]) {
                case 1:
                    arrayList2 = setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.WSJ_BARRONS.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.BARRONS.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.MINT_LITE.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.WSJ.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.MINT.getPlanCategory(), arrayList, checkSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.ECO.getPlanCategory(), arrayList))))));
                    break;
                case 2:
                    arrayList2 = setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.WSJ_BARRONS.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.BARRONS.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.MINT_LITE.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.ECO.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.MINT.getPlanCategory(), arrayList, checkSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.WSJ.getPlanCategory(), arrayList))))));
                    break;
                case 3:
                    arrayList2 = setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.WSJ_BARRONS.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.BARRONS.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.MINT_LITE.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.ECO.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.WSJ.getPlanCategory(), arrayList, checkSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.MINT.getPlanCategory(), arrayList))))));
                    break;
                case 4:
                    arrayList2 = setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.WSJ_BARRONS.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.BARRONS.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.ECO.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.WSJ.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.MINT.getPlanCategory(), arrayList, checkSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.MINT_LITE.getPlanCategory(), arrayList))))));
                    break;
                case 5:
                    arrayList2 = setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.WSJ_BARRONS.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.ECO.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.WSJ.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.MINT.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.MINT_LITE.getPlanCategory(), arrayList, checkSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.BARRONS.getPlanCategory(), arrayList))))));
                    break;
                case 6:
                    arrayList2 = setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.BARRONS.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.ECO.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.WSJ.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.MINT.getPlanCategory(), arrayList, setSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.MINT_LITE.getPlanCategory(), arrayList, checkSubscriberChoiceGroup(SubscriptionConverter.PLAN_CATEGORY.WSJ_BARRONS.getPlanCategory(), arrayList))))));
                    break;
            }
            if (arrayList2 != null && arrayList2.size() > 0) {
                arrayList = arrayList2;
            }
        }
        ArrayList<MintPlanWithZSPlan> arrayList3 = this.masterPlanList;
        if (arrayList3 == null) {
            this.masterPlanList = new ArrayList<>();
        } else {
            arrayList3.clear();
        }
        int size = arrayList.size();
        int i = 0;
        while (true) {
            if (i >= size) {
                ArrayList<MintPlanWithZSPlan> arrayList4 = this.masterPlanList;
                if (arrayList4 == null || arrayList4.isEmpty()) {
                    this.mBinding.w.setVisibility(8);
                    return;
                }
                this.mBinding.w.setVisibility(0);
                int indexForDefaultSelection = getIndexForDefaultSelection(this.masterPlanList);
                this.mPlanCategory = this.masterPlanList.get(indexForDefaultSelection).getPlanCategory();
                MintPlanWithZSPlan mintPlanWithZSPlan = this.masterPlanList.get(indexForDefaultSelection);
                this.mintPlanWithZSPlan = mintPlanWithZSPlan;
                if (mintPlanWithZSPlan != null && mintPlanWithZSPlan.getSubsPlans() != null) {
                    SubsPlans subsPlans = this.mintPlanWithZSPlan.getSubsPlans();
                    String description = subsPlans != null ? subsPlans.getDescription() : "";
                    String name = subsPlans != null ? subsPlans.getName() : "";
                    this.initialTenure = name;
                    this.initialPlan = description;
                    setPlanValues(description, name, description, name);
                }
                setUpPlansAdapter(this.masterPlanList, indexForDefaultSelection);
                return;
            }
            String str = arrayList.get(i);
            MintPlanWithZSPlan mintPlanWithZSPlan2 = null;
            if (SubscriptionConverter.PLAN_CATEGORY.MINT.getPlanCategory().equalsIgnoreCase(str)) {
                ArrayList<MintPlanWithZSPlan> arrayList5 = this.mintOnlyList;
                if (arrayList5 != null && arrayList5.size() > 0) {
                    mintPlanWithZSPlan2 = getMasterPlan(this.mintOnlyList);
                }
                if (mintPlanWithZSPlan2 != null) {
                    mintPlanWithZSPlan2.setPlanCategory(str);
                    if (i == 0 && TextUtils.isEmpty(this.subscriberChoicePlan)) {
                        this.subscriberChoicePlan = mintPlanWithZSPlan2.getSubsPlans() != null ? mintPlanWithZSPlan2.getSubsPlans().getPlanCode() : "";
                    }
                    mintPlanWithZSPlan2.setSubscriberChoicePlan(this.subscriberChoicePlan);
                    mintPlanWithZSPlan2.setTenureLength(this.mintOnlyList.size());
                    this.masterPlanList.add(mintPlanWithZSPlan2);
                }
            } else if (SubscriptionConverter.PLAN_CATEGORY.WSJ.getPlanCategory().equalsIgnoreCase(str)) {
                ArrayList<MintPlanWithZSPlan> arrayList6 = this.wsjOnlyList;
                if (arrayList6 != null && arrayList6.size() > 0) {
                    mintPlanWithZSPlan2 = getMasterPlan(this.wsjOnlyList);
                }
                if (mintPlanWithZSPlan2 != null && COUNTRY.US != this.country) {
                    mintPlanWithZSPlan2.setPlanCategory(str);
                    if (i == 0 && TextUtils.isEmpty(this.subscriberChoicePlan)) {
                        this.subscriberChoicePlan = mintPlanWithZSPlan2.getSubsPlans() != null ? mintPlanWithZSPlan2.getSubsPlans().getPlanCode() : "";
                    }
                    mintPlanWithZSPlan2.setSubscriberChoicePlan(this.subscriberChoicePlan);
                    mintPlanWithZSPlan2.setTenureLength(this.wsjOnlyList.size());
                    this.masterPlanList.add(mintPlanWithZSPlan2);
                }
            } else if (SubscriptionConverter.PLAN_CATEGORY.BARRONS.getPlanCategory().equalsIgnoreCase(str)) {
                ArrayList<MintPlanWithZSPlan> arrayList7 = this.mintBarronList;
                if (arrayList7 != null && arrayList7.size() > 0) {
                    mintPlanWithZSPlan2 = getMasterPlan(this.mintBarronList);
                }
                if (mintPlanWithZSPlan2 != null && COUNTRY.US != this.country) {
                    mintPlanWithZSPlan2.setPlanCategory(str);
                    if (i == 0 && TextUtils.isEmpty(this.subscriberChoicePlan)) {
                        this.subscriberChoicePlan = mintPlanWithZSPlan2.getSubsPlans() != null ? mintPlanWithZSPlan2.getSubsPlans().getPlanCode() : "";
                    }
                    mintPlanWithZSPlan2.setSubscriberChoicePlan(this.subscriberChoicePlan);
                    mintPlanWithZSPlan2.setTenureLength(this.mintBarronList.size());
                    this.masterPlanList.add(mintPlanWithZSPlan2);
                }
            } else if (SubscriptionConverter.PLAN_CATEGORY.WSJ_BARRONS.getPlanCategory().equalsIgnoreCase(str)) {
                ArrayList<MintPlanWithZSPlan> arrayList8 = this.wsjBarronList;
                if (arrayList8 != null && arrayList8.size() > 0) {
                    mintPlanWithZSPlan2 = getMasterPlan(this.wsjBarronList);
                }
                if (mintPlanWithZSPlan2 != null && COUNTRY.US != this.country) {
                    mintPlanWithZSPlan2.setPlanCategory(str);
                    if (i == 0 && TextUtils.isEmpty(this.subscriberChoicePlan)) {
                        this.subscriberChoicePlan = mintPlanWithZSPlan2.getSubsPlans() != null ? mintPlanWithZSPlan2.getSubsPlans().getPlanCode() : "";
                    }
                    mintPlanWithZSPlan2.setSubscriberChoicePlan(this.subscriberChoicePlan);
                    mintPlanWithZSPlan2.setTenureLength(this.wsjBarronList.size());
                    this.masterPlanList.add(mintPlanWithZSPlan2);
                }
            } else if (SubscriptionConverter.PLAN_CATEGORY.ECO.getPlanCategory().equalsIgnoreCase(str)) {
                ArrayList<MintPlanWithZSPlan> arrayList9 = this.ecoOnlyList;
                if (arrayList9 != null && arrayList9.size() > 0) {
                    mintPlanWithZSPlan2 = getMasterPlan(this.ecoOnlyList);
                }
                if (mintPlanWithZSPlan2 != null && COUNTRY.India == this.country) {
                    mintPlanWithZSPlan2.setPlanCategory(str);
                    if (i == 0 && TextUtils.isEmpty(this.subscriberChoicePlan)) {
                        this.subscriberChoicePlan = mintPlanWithZSPlan2.getSubsPlans() != null ? mintPlanWithZSPlan2.getSubsPlans().getPlanCode() : "";
                    }
                    mintPlanWithZSPlan2.setSubscriberChoicePlan(this.subscriberChoicePlan);
                    mintPlanWithZSPlan2.setTenureLength(this.ecoOnlyList.size());
                    this.masterPlanList.add(mintPlanWithZSPlan2);
                }
            } else if (SubscriptionConverter.PLAN_CATEGORY.MINT_LITE.getPlanCategory().equalsIgnoreCase(str)) {
                ArrayList<MintPlanWithZSPlan> arrayList10 = this.mintLiteOnlyList;
                if (arrayList10 != null && arrayList10.size() > 0) {
                    mintPlanWithZSPlan2 = getMasterPlan(this.mintLiteOnlyList);
                }
                if (mintPlanWithZSPlan2 != null) {
                    mintPlanWithZSPlan2.setPlanCategory(str);
                    if (i == 0 && TextUtils.isEmpty(this.subscriberChoicePlan)) {
                        this.subscriberChoicePlan = mintPlanWithZSPlan2.getSubsPlans() != null ? mintPlanWithZSPlan2.getSubsPlans().getPlanCode() : "";
                    }
                    mintPlanWithZSPlan2.setSubscriberChoicePlan(this.subscriberChoicePlan);
                    mintPlanWithZSPlan2.setTenureLength(this.ecoOnlyList.size());
                    this.masterPlanList.add(mintPlanWithZSPlan2);
                }
            }
            i++;
        }
    }

    private void validateUserSubscriptionAndInitatePayment(MintSubscriptionDetail mintSubscriptionDetail) {
        SubscriptionPlanSingleton.getInstance().setSelectedPlan(this.selectedPlan);
        if ((mintSubscriptionDetail != null && mintSubscriptionDetail.isSubscriptionActive() && !mintSubscriptionDetail.isGifted()) || SubscriptionConverter.isSKUPlanActive(mintSubscriptionDetail)) {
            AppController.j().V(mintSubscriptionDetail);
            f0.c4(this, mintSubscriptionDetail);
            goBack();
        } else {
            if (!this.isRazorPayEnabled) {
                initiatePayment(mintSubscriptionDetail);
                return;
            }
            MintPlanWithZSPlan mintPlanWithZSPlan = this.mintPlanWithZSPlan;
            if (mintPlanWithZSPlan == null || mintPlanWithZSPlan.getSubsPlans() == null) {
                initiatePayment(mintSubscriptionDetail);
            } else {
                openCheckoutPage(mintSubscriptionDetail);
            }
        }
    }

    @Override
    public void changePlanTenure(int i) {
        showTenurePlansList(this, this.mPlanCategory);
    }

    public void dismissProgressDialog() {
        try {
            ProgressDialog progressDialog = this.pDialog;
            if (progressDialog != null && progressDialog.isShowing()) {
                this.pDialog.dismiss();
            }
        } catch (IllegalArgumentException unused) {
        } catch (Throwable th2) {
            this.pDialog = null;
            throw th2;
        }
        this.pDialog = null;
    }

    public void fetchPlansFromMintServer() {
        Config g = AppController.j().g();
        String str = (g.getSso() != null ? g.getSso().getPlanFetch() : "") + "?device=android&country=IN";
        HashMap hashMap = new HashMap();
        hashMap.put("ProductId", getResources().getString(R.string.zs_product_id));
        new c1(this, this).a(0, "FetchPlan", str, hashMap, (JSONObject) null, false, false, false, "");
    }

    public ArrayList<PartnersOfferPojo> getBankCouponOfferList() {
        return this.bankCouponOfferList;
    }

    public String getCouponCode() {
        return this.mCouponCode;
    }

    public CouponUtils.COUPONSTATUS getCouponstatus() {
        return this.couponstatus;
    }

    public ArrayList<MintPlanWithZSPlan> getEcoOnlyList() {
        return this.ecoOnlyList;
    }

    public ArrayList<MintPlanWithZSPlan> getMintOnlyList() {
        return this.mintOnlyList;
    }

    public void getMintPlan(com.htmedia.mint.pojo.subscription.plandetail.htapi.MintPlan r10) {
        throw new UnsupportedOperationException("Method not decompiled: com.htmedia.mint.htsubscription.planpagerewamp.ui.activities.PlanPageActivity.getMintPlan(com.htmedia.mint.pojo.subscription.plandetail.htapi.MintPlan):void");
    }

    public void getMintServerPlan(MintServerPlan mintServerPlan) {
    }

    @Override
    public void getPianoResponse(String str, ForyouPojo foryouPojo, PianoResponse pianoResponse) {
        if (pianoResponse != null) {
            PlanPageExperience planPageExperience = pianoResponse.getPlanPageExperience();
            this.planPageExperience = planPageExperience;
            if (planPageExperience != null && planPageExperience.getPlanUI() != null) {
                String androidCouponCode = planPageExperience.getPlanUI().getAndroidCouponCode();
                if (!TextUtils.isEmpty(androidCouponCode)) {
                    this.couponCodePartner = androidCouponCode;
                }
            }
        }
        initSubscription(this.config);
    }

    public PlansListAdapter getPlansListAdapter() {
        return this.plansListAdapter;
    }

    public void getPremiumPlan(SubscribeNowPerant subscribeNowPerant) {
    }

    @Override
    public void getUserSubscriptionDetail(MintSubscriptionDetail mintSubscriptionDetail) {
        validateUserSubscriptionAndInitatePayment(mintSubscriptionDetail);
    }

    public ArrayList<MintPlanWithZSPlan> getWsjOnlyList() {
        return this.wsjOnlyList;
    }

    protected void onActivityResult(int i, int i2, @Nullable Intent intent) {
        super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(i, i2, intent);
        boolean z = false;
        z = false;
        z = false;
        if (i == 1234 && i2 == -1) {
            if (intent == null || !intent.hasExtra(Constants.COUPON_CODE_ONLY)) {
                return;
            }
            String stringExtra = intent.getStringExtra(Constants.COUPON_CODE_ONLY);
            String str = "";
            if (TextUtils.isEmpty(stringExtra)) {
                setCouponCode("");
                this.couponModulePlanPage.removeCoupon();
                PlansListAdapter plansListAdapter = this.plansListAdapter;
                if (plansListAdapter != null) {
                    plansListAdapter.notifyDataSetChanged();
                }
                updateBottomFooterInitial();
                return;
            }
            int intExtra = intent.getIntExtra(Constants.KEY_COUPON_STATUS, 0);
            CouponUtils.COUPONSTATUS couponstatus = CouponUtils.COUPONSTATUS.values()[(intExtra >= 0 || intExtra < CouponUtils.COUPONSTATUS.values().length) ? intExtra : 0];
            this.couponstatus = couponstatus;
            if (couponstatus == null || (couponstatus != null && couponstatus == CouponUtils.COUPONSTATUS.APPLY)) {
                CouponModulePlanPage couponModulePlanPage = this.couponModulePlanPage;
                Config config = this.config;
                MintPlanWithZSPlan mintPlanWithZSPlan = this.mintPlanWithZSPlan;
                if (mintPlanWithZSPlan != null && mintPlanWithZSPlan.getSubsPlans() != null && !TextUtils.isEmpty(this.mintPlanWithZSPlan.getSubsPlans().getPlanCode())) {
                    str = this.mintPlanWithZSPlan.getSubsPlans().getPlanCode();
                }
                couponModulePlanPage.couponApply(config, stringExtra, null, str);
                return;
            }
            if (TextUtils.isEmpty(this.mCouponCode) || !this.mCouponCode.equalsIgnoreCase(stringExtra)) {
                setCouponCode(stringExtra);
                MintPlanWithZSPlan mintPlanWithZSPlan2 = this.mintPlanWithZSPlan;
                if (mintPlanWithZSPlan2 != null && mintPlanWithZSPlan2.getSubsPlans() != null) {
                    str = this.mintPlanWithZSPlan.getSubsPlans().getPlanCode();
                }
                this.couponModulePlanPage.getCouponPlanFromAnotherScreen(stringExtra, str, Constants.couponPlan);
                return;
            }
            return;
        }
        if (i == SIGN_IN_REQUEST && i2 == -1) {
            if (intent != null && intent.hasExtra("isSignUp")) {
                this.mNeedToSetPassword = intent.getBooleanExtra("isSignUp", false);
            }
            HashMap hashMap = new HashMap();
            String F1 = f0.F1(this);
            if (F1 != null) {
                hashMap.put("userEmail", F1);
            }
            if (f0.G1(this, "userName") != null) {
                hashMap.put("userName", f0.G1(this, "userName"));
            }
            if (!hashMap.isEmpty()) {
                o0.i(hashMap);
            }
            checkZSUserSubscriptionDetail();
            return;
        }
        if (i != 1003 || i2 != -1) {
            if (i == 1002 && i2 == -1) {
                SubscriptionTrigger.openOnBoardJourneyVideo(this);
                return;
            }
            if (i == 20524 && i2 == -1) {
                newSubscriptionPage(getUpdatedSubscriptionDetail(intent));
                return;
            } else {
                if (i == 1004 && i2 == -1) {
                    setSubscriptionIntent();
                    finish();
                    return;
                }
                return;
            }
        }
        Intent intent2 = getIntent();
        if (intent2 != null && intent2.getExtras() != null && intent2.getExtras().containsKey("needSetPassword")) {
            z = intent2.getExtras().getBoolean("needSetPassword");
        }
        if (z) {
            Intent intent3 = new Intent((Context) this, (Class<?>) LoginRegisterActivity.class);
            intent3.putExtra("origin", "Subscription After");
            intent3.setFlags(603979776);
            startActivityForResult(intent3, AFTER_SUBSCRIPTION_REQUEST);
            return;
        }
        if (f0.R0(this) == q.n.c) {
            SubscriptionTrigger.openOnBoardJourneyVideo(this);
            return;
        }
        Intent intent4 = new Intent((Context) this, (Class<?>) LoginRegisterActivity.class);
        intent4.putExtra("origin", "Linking");
        intent4.putExtra("linkingType", f0.R0(this).ordinal());
        intent4.setFlags(603979776);
        startActivityForResult(intent4, AFTER_SUBSCRIPTION_REQUEST);
    }

    public void onBackPressed() {
        JuspayCheckout juspayCheckout = this.juspayCheckout;
        if (juspayCheckout == null || !(juspayCheckout == null || juspayCheckout.r())) {
            goBack();
        }
    }

    protected void onCreate(Bundle bundle) {
        super/*androidx.fragment.app.FragmentActivity*/.onCreate(bundle);
        getWindow().setSoftInputMode(32);
        this.startTimeStamp = System.currentTimeMillis();
        this.mBinding = (g2) DataBindingUtil.setContentView(this, R.layout.activity_plan_page);
        boolean E = AppController.j().E();
        this.isNightMode = E;
        this.mBinding.c(Boolean.valueOf(E));
        this.config = AppController.j().g();
        setToolbar();
        setUpDarkMode();
        initializeAllReleatedDetails();
        initJuspay();
    }

    public void onError(@NonNull ZSError zSError) {
    }

    public void onError(String str, String str2) {
        dismissProgressDialog();
    }

    public void onPaymentError(int i, String str, PaymentData paymentData) {
        this.razorPayCheckout.onPaymentError(i, str, paymentData);
    }

    public void onPaymentSuccess(String str, PaymentData paymentData) {
        this.razorPayCheckout.onPaymentSuccess(str, paymentData);
    }

    public void onPlanDetailsFetched(@NonNull ArrayList<ZSPlan> arrayList) {
        if (arrayList == null || arrayList.size() <= 0) {
            return;
        }
        mapZohoPlansWithMintPlan(SubscriptionConverter.getFilterPlanByCustomField(SubscriptionUtils.filterActivePlanFromZOHO(arrayList)));
        updateMasterPlanList(this.config);
        q.d dVar = this.couponModule;
        if (dVar != null && (dVar == q.d.d || dVar == q.d.a)) {
            setBankCoupon();
        } else if (dVar != null && dVar == q.d.b) {
            setPartnerBenefits();
        } else if (dVar == null || dVar != q.d.c) {
            dismissProgressDialog();
        } else {
            autoApplyCouponCode();
        }
        setUpHeaderImagesInteractionTimer();
        setUpStudentOffer();
        n.z(this, f0.S2(this, System.currentTimeMillis(), this.startTimeStamp), false);
    }

    public void onPurchaseSyncedWithServer(@NonNull ZSSubscriptionDetail zSSubscriptionDetail) {
        dismissProgressDialog();
        MintSubscriptionDetail convertZSSubsDetailWithMintSubs = GetUserSubscriptionDetail.convertZSSubsDetailWithMintSubs(zSSubscriptionDetail);
        SyncPurchaseWithSession.syncPurchaseWithSession(this, convertZSSubsDetailWithMintSubs);
        Content content = this.funnelName.equalsIgnoreCase(WebEngageAnalytices.SUBSCRIPTION_POP_UP) ? SubscriptionPlanSingleton.getInstance().getContent() : null;
        n.A(this, n.h1, "plan_page", n.t0, content, (String) null);
        f5.a.e(this, "payment_success", f5.a.d, f5.a.f, content, null);
        WebEngageAnalytices.trackPaymentStatus(WebEngageAnalytices.PAYMENT_SUCESS, zSSubscriptionDetail, this.mintPlanWithZSPlan, null, this.funnelName, this.premiumStory, WebEngageAnalytices.PAYMENTSTORE.PLAY_STORE.getStore(), true);
        getIntent().putExtra("needSetPassword", this.mNeedToSetPassword);
        GetUserSubscriptionDetail.SyncSubscriptionAsyncTask syncSubscriptionAsyncTask = new GetUserSubscriptionDetail.SyncSubscriptionAsyncTask(this);
        if (!TextUtils.isEmpty(this.premiumStory)) {
            syncSubscriptionAsyncTask.setPremiumStory(this.premiumStory);
        }
        if (!TextUtils.isEmpty(this.funnelName)) {
            syncSubscriptionAsyncTask.setFunnelEntry(this.funnelName);
        }
        syncSubscriptionAsyncTask.setPianoExp(SubscriptionPlanSingleton.getInstance().getPianoExpName());
        syncSubscriptionAsyncTask.setZsPlan(this.selectedPlan);
        syncSubscriptionAsyncTask.setMintPlanWithZSPlan(this.mintPlanWithZSPlan);
        syncSubscriptionAsyncTask.setUserSubscriptionStatus("New");
        syncSubscriptionAsyncTask.execute(convertZSSubsDetailWithMintSubs);
    }

    protected void onResume() {
        super/*androidx.fragment.app.FragmentActivity*/.onResume();
        n.q0(this, WebEngageAnalytices.PLAN_DETAIL_SCREEN);
        n.A(this, n.f1, "plan_page", n.s0, this.content, (String) null);
        WebEngageAnalytices.trackActivityLandEvent(WebEngageAnalytices.PLAN_DETAIL_SCREEN, this.funnelName, this.content, this.paywallReason);
    }

    protected void onStart() {
        super/*androidx.appcompat.app.AppCompatActivity*/.onStart();
        setUpAppLogo();
    }

    public void onStorePurchaseCompleted() {
        f0.w3(this, "issubscribedmint", true);
        Toast.makeText((Context) this, (CharSequence) "Purchase Completed Successfully.", 0).show();
        initProgressDialogAndShow();
    }

    @Override
    public void onSubscriptionError(SubscriptionError subscriptionError) {
        if (subscriptionError.getErrorCode() == ErrorCode.TOKEN_API_FAILED || subscriptionError.getErrorCode() == ErrorCode.UNKNOWN_ERROR) {
            Toast.makeText((Context) this, (CharSequence) "Something went wrong. Please try later.", 0).show();
        } else if (subscriptionError.getErrorCode() == ErrorCode.TOKEN_EXPIRE) {
            WebEngageAnalytices.trackClickEvents("Sign In", null, "Sign In Initiate", null, "Subscription Funnel", "", "");
            openLoginPage("Subscription Funnel");
        } else if (subscriptionError.getErrorCode() == ErrorCode.ITEM_ALREADY_PURCHASED) {
            Toast.makeText((Context) this, (CharSequence) ZSErrorCodeHandling.ZSErrorCodeMessages.PURCHASE_ALREADY_PROCESSED, 1).show();
        }
        o0.e(subscriptionError.getErrorCode().name(), subscriptionError.getMessage(), getClass().getName());
        if (CheckSubscriptionFromLocal.isSubscribedUser(this)) {
            setSubscriptionIntent();
            finish();
        }
    }

    public void openLoginPage(String str) {
        Intent intent = new Intent((Context) this, (Class<?>) LoginRegisterActivity.class);
        intent.putExtra("ssoReason", "plans_page");
        intent.putExtra("origin", str);
        if (!TextUtils.isEmpty(this.premiumStory) && this.premiumStory.equalsIgnoreCase("premium")) {
            intent.putExtra("premiumStory", true);
        }
        intent.setFlags(603979776);
        if (str.equals("Subscription After")) {
            startActivityForResult(intent, AFTER_SUBSCRIPTION_REQUEST);
        } else {
            startActivityForResult(intent, SIGN_IN_REQUEST);
        }
    }

    @Override
    public void pianoError(String str, ForyouPojo foryouPojo, PianoResponse pianoResponse) {
        Metadata metadata;
        Content content = this.content;
        if (content != null && (metadata = content.getMetadata()) != null) {
            String agency = metadata.getAgency();
            if ("Economist".equalsIgnoreCase(agency)) {
                this.planCampaign = SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_ECO;
            } else if ("WSJ".equalsIgnoreCase(agency)) {
                this.planCampaign = SubscriptionConverter.PLAN_CAMPAIGN.CAMPAIGN_WSJ;
            }
        }
        initSubscription(this.config);
    }

    public void setBankCouponOfferList(ArrayList<PartnersOfferPojo> arrayList) {
        this.bankCouponOfferList = arrayList;
    }

    public void setCouponCode(String str) {
        this.mCouponCode = str;
    }

    public void setCouponstatus(CouponUtils.COUPONSTATUS couponstatus) {
        this.couponstatus = couponstatus;
    }

    public void setEcoOnlyList(ArrayList<MintPlanWithZSPlan> arrayList) {
        this.ecoOnlyList = arrayList;
    }

    public void setMintOnlyList(ArrayList<MintPlanWithZSPlan> arrayList) {
        this.mintOnlyList = arrayList;
    }

    public void setPlansListAdapter(PlansListAdapter plansListAdapter) {
        this.plansListAdapter = plansListAdapter;
    }

    @Override
    public void setSelectedCoupon(int i, String str) {
        this.mCouponCode = str;
        if (str == null || TextUtils.isEmpty(str)) {
            return;
        }
        CouponModulePlanPage couponModulePlanPage = this.couponModulePlanPage;
        Config config = this.config;
        String str2 = this.mCouponCode;
        MintPlanWithZSPlan mintPlanWithZSPlan = this.mintPlanWithZSPlan;
        couponModulePlanPage.couponApply(config, str2, null, (mintPlanWithZSPlan == null || mintPlanWithZSPlan.getSubsPlans() == null || TextUtils.isEmpty(this.mintPlanWithZSPlan.getSubsPlans().getPlanCode())) ? "" : this.mintPlanWithZSPlan.getSubsPlans().getPlanCode());
    }

    @Override
    public void setSelectedIndex(int i) {
        CouponUtils.COUPONSTATUS couponstatus;
        ArrayList<MintPlanWithZSPlan> arrayList = this.masterPlanList;
        if (arrayList != null && !arrayList.isEmpty()) {
            this.mintPlanWithZSPlan = this.masterPlanList.get(i);
        }
        MintPlanWithZSPlan mintPlanWithZSPlan = this.mintPlanWithZSPlan;
        if (mintPlanWithZSPlan != null && mintPlanWithZSPlan.getSubsPlans() != null && this.mintPlanWithZSPlan.getSubsPlans().getPlanCode() != null) {
            this.selectedPlanCode = this.mintPlanWithZSPlan.getSubsPlans().getPlanCode();
        }
        MintPlanWithZSPlan mintPlanWithZSPlan2 = this.mintPlanWithZSPlan;
        String str = "";
        if (mintPlanWithZSPlan2 != null && mintPlanWithZSPlan2.getSubsPlans() != null) {
            SubsPlans subsPlans = this.mintPlanWithZSPlan.getSubsPlans();
            setPlanValues(subsPlans != null ? subsPlans.getDescription() : "", subsPlans != null ? subsPlans.getName() : "", this.strNewPlan, this.strNewTenure);
            sendChangeTenure(WebEngageAnalytices.CHANGE_PLAN);
        }
        this.mSelectedPlan = i;
        ArrayList<MintPlanWithZSPlan> arrayList2 = this.masterPlanList;
        if (arrayList2 != null && arrayList2.size() > 0 && this.masterPlanList.get(i).getPlanCategory() != null) {
            str = this.masterPlanList.get(i).getPlanCategory();
        }
        this.mPlanCategory = str;
        MintPlanWithZSPlan mintPlanWithZSPlan3 = this.mintPlanWithZSPlan;
        if (mintPlanWithZSPlan3 != null && (couponstatus = this.couponstatus) != null && couponstatus != CouponUtils.COUPONSTATUS.APPLY) {
            if (mintPlanWithZSPlan3.isCouponApplied()) {
                this.couponstatus = CouponUtils.COUPONSTATUS.APPLIED;
            } else {
                this.couponstatus = CouponUtils.COUPONSTATUS.INVALID;
            }
        }
        updateBottomFooterInitial();
    }

    @Override
    public void setSelectedTenure(int i) {
        setOnNewSelectedTenure(i);
    }

    public void setWsjOnlyList(ArrayList<MintPlanWithZSPlan> arrayList) {
        this.wsjOnlyList = arrayList;
    }

    public void showProgressDialog() {
        ProgressDialog progressDialog = this.pDialog;
        if (progressDialog == null || progressDialog.isShowing()) {
            return;
        }
        this.pDialog.show();
    }

    public void updateBottomFooterInitial() {
        String str;
        if (this.plansListAdapter != null) {
            MintPlanWithZSPlan mintPlanWithZSPlan = this.masterPlanList.get(this.mSelectedPlan);
            if (mintPlanWithZSPlan != null && mintPlanWithZSPlan.getSubsPlans() != null && mintPlanWithZSPlan.getSubsPlans().getPlanCode() != null) {
                this.selectedPlanCode = mintPlanWithZSPlan.getSubsPlans().getPlanCode();
            }
            setSubscribeNowCTA(SubscriptionConverter.PLAN_CATEGORY.MINT.getPlanCategory().equals(mintPlanWithZSPlan.getPlanCategory()), mintPlanWithZSPlan);
            SubsPlans subsPlans = mintPlanWithZSPlan.getSubsPlans();
            if (subsPlans != null) {
                subsPlans.getName();
                boolean isCouponApplied = mintPlanWithZSPlan.isCouponApplied();
                double recurringPrice = subsPlans.getRecurringPrice();
                double discountPrice = mintPlanWithZSPlan.getDiscountPrice();
                this.numberFormat.format(mintPlanWithZSPlan.getActualPrice());
                String currencySymbol = subsPlans.getCurrencySymbol();
                String str2 = currencySymbol + (isCouponApplied ? this.numberFormat.format(discountPrice) : this.numberFormat.format(recurringPrice));
                COUNTRY country = this.country;
                if (country == null || country == COUNTRY.India) {
                    this.mBinding.e.g.setText(str2);
                    if (!isCouponApplied) {
                        this.mBinding.e.g.setText(str2);
                    } else if (mintPlanWithZSPlan.isTrialCoupon()) {
                        this.mBinding.e.g.setText(currencySymbol + this.numberFormat.format(recurringPrice));
                    } else {
                        this.mBinding.e.g.setText(str2);
                    }
                } else {
                    List outsideIndiaPaymentMethod = mintPlanWithZSPlan.getPianoPlan() != null ? mintPlanWithZSPlan.getPianoPlan().getOutsideIndiaPaymentMethod() : null;
                    if (outsideIndiaPaymentMethod != null && outsideIndiaPaymentMethod.size() == 1 && "GOOGLE_PLAY".equalsIgnoreCase(((PaymentMethod) outsideIndiaPaymentMethod.get(0)).getType())) {
                        ZSPlan zsPlan = mintPlanWithZSPlan.getZsPlan();
                        if (zsPlan != null && zsPlan.getSkuDetails() != null) {
                            str2 = zsPlan.getSkuDetails().d();
                        }
                        this.mBinding.e.g.setText(str2);
                    } else {
                        this.mBinding.e.g.setText(str2);
                        if (!isCouponApplied) {
                            this.mBinding.e.g.setText(str2);
                        } else if (mintPlanWithZSPlan.isTrialCoupon()) {
                            this.mBinding.e.g.setText(currencySymbol + this.numberFormat.format(recurringPrice));
                        } else {
                            this.mBinding.e.g.setText(str2);
                        }
                    }
                }
            }
        }
        if (getCouponCode() == null || TextUtils.isEmpty(getCouponCode())) {
            setSeeCouponApplyCouponText();
        } else {
            this.mBinding.e.h.setText(getString(R.string.remove_coupon));
            this.mBinding.e.a.setVisibility(0);
        }
        CouponUtils.COUPONSTATUS couponstatus = this.couponstatus;
        if (couponstatus != null && couponstatus == CouponUtils.COUPONSTATUS.INVALID) {
            this.mBinding.e.e.setTextColor(getResources().getColor(R.color.planPageRed));
            this.mBinding.e.e.setText(getResources().getString(R.string.invalid_coupon_));
            setSeeCouponApplyCouponText();
            return;
        }
        if (this.isNightMode) {
            this.mBinding.e.e.setTextColor(getResources().getColor(R.color.planPageDarkText));
        } else {
            this.mBinding.e.e.setTextColor(getResources().getColor(R.color.planPageLightText));
        }
        TextView textView = this.mBinding.e.e;
        if (getCouponCode() == null || TextUtils.isEmpty(getCouponCode())) {
            str = this.androidDiscountLabel;
        } else {
            str = "'" + getCouponCode() + "' applied";
        }
        textView.setText(str);
    }
}