正在查看: Mint v5.7.3 应用的 RenewSubscriptionActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Mint v5.7.3 应用的 RenewSubscriptionActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.htmedia.mint.ui.activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.Html;
import android.text.Spannable;
import android.text.TextUtils;
import android.text.style.ImageSpan;
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.core.graphics.drawable.DrawableCompat;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.viewpager.widget.ViewPager;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import com.htmedia.mint.AppController;
import com.htmedia.mint.htsubscription.CheckSubscriptionFromLocal;
import com.htmedia.mint.htsubscription.GetSubscriptionIntent;
import com.htmedia.mint.htsubscription.GetUserSubscriptionDetail;
import com.htmedia.mint.htsubscription.SubscriptionConverter;
import com.htmedia.mint.htsubscription.SubscriptionPlanSingleton;
import com.htmedia.mint.htsubscription.SubscriptionTrigger;
import com.htmedia.mint.htsubscription.WebEngageAnalytices;
import com.htmedia.mint.htsubscription.subsutils.SubscriptionUtils;
import com.htmedia.mint.juspay.JuspayCheckout;
import com.htmedia.mint.piano.PianoCallbackListener;
import com.htmedia.mint.piano.PianoResponse;
import com.htmedia.mint.pojo.Content;
import com.htmedia.mint.pojo.ForyouPojo;
import com.htmedia.mint.pojo.config.Config;
import com.htmedia.mint.pojo.config.FrequentlyQuestion;
import com.htmedia.mint.pojo.config.Subscription;
import com.htmedia.mint.pojo.config.managesubscription.MSBenefitQueston;
import com.htmedia.mint.pojo.giftingarticle.GiftSubscriptionPojo;
import com.htmedia.mint.pojo.mintsubscribenowmodel.SubscribeNowPerant;
import com.htmedia.mint.pojo.planpage.PlanPageExperience;
import com.htmedia.mint.pojo.subscription.ListItemAllPlanManageSubscription;
import com.htmedia.mint.pojo.subscription.SubscriptionError;
import com.htmedia.mint.pojo.subscription.SubscriptionSource;
import com.htmedia.mint.pojo.subscription.SubscriptionStatus;
import com.htmedia.mint.pojo.subscription.plandetail.htapi.MintPlan;
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.PlanDiscount;
import com.htmedia.mint.pojo.subscription.plandetail.htapi.PlanDiscountMS;
import com.htmedia.mint.pojo.subscription.plandetail.htapi.Plans;
import com.htmedia.mint.pojo.subscription.plandetail.htapi.SubsPlans;
import com.htmedia.mint.pojo.subscription.userdetail.MintSubscriptionDetail;
import com.htmedia.mint.pojo.subscription.userdetail.SubscriptionUserPlan;
import com.htmedia.mint.razorpay.coupon.CouponModuleRenew;
import com.htmedia.mint.razorpay.pojo.coupon.partner.CouponPartner;
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.ui.adapters.PartnersOfferListAdapter;
import com.htmedia.mint.ui.activity.cancelsubscription.CancelStep1Activity;
import com.htmedia.mint.utils.q;
import com.htmedia.sso.activities.LoginRegisterActivity;
import com.htmedia.sso.helpers.SSOSingleton;
import com.snowplowanalytics.snowplow.tracker.constants.Parameters;
import com.thoughtbot.expandablerecyclerview.BuildConfig;
import java.io.IOException;
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.Map;
import java.util.Set;
import javax.net.ssl.HttpsURLConnection;
import org.json.JSONObject;
import q7.e6;
import q7.h6;
import q7.k6;
import q7.q1;
public class RenewSubscriptionActivity extends com.htmedia.mint.ui.activity.a implements GetUserSubscriptionDetail.OnSubscriptionDetail, k6.d1, k6.x1, View.OnClickListener, PianoCallbackListener {
private h6 A;
private k6 B;
private ProgressDialog C;
public MintPlanWithZSPlan D;
private l G;
private Content K;
private e6 L;
private View[] M;
private JuspayCheckout O;
int P;
String Q;
private x4.u2 a;
private String b;
private MintSubscriptionDetail c;
private CouponModuleRenew d;
private k i;
private String j;
private Config o;
private boolean p;
private String q;
private PlanPageExperience r;
private String s;
private NumberFormat t;
private boolean u;
private q.k0 y;
private String z;
private HashMap<String, ArrayList<MintPlanWithZSPlan>> e = new HashMap<>();
private final ArrayList<MintPlanWithZSPlan> f = new ArrayList<>();
private ArrayList<MintPlanWithZSPlan> g = new ArrayList<>();
private final ArrayList<ListItemAllPlanManageSubscription> h = new ArrayList<>();
private final List<String> v = new ArrayList();
private final List<String> w = new ArrayList();
private List<String> x = new ArrayList();
private boolean E = false;
private boolean F = false;
private int H = -1;
private ArrayList<MSBenefitQueston> I = new ArrayList<>();
private String J = BuildConfig.FLAVOR;
private List<String> N = new ArrayList();
boolean R = false;
class a implements ViewPager.OnPageChangeListener {
a() {
}
public void onPageScrollStateChanged(int i) {
}
public void onPageScrolled(int i, float f, int i2) {
}
public void onPageSelected(int i) {
RenewSubscriptionActivity renewSubscriptionActivity = RenewSubscriptionActivity.this;
if (renewSubscriptionActivity.P - 1 == i) {
renewSubscriptionActivity.a.r.b.setPadding(192, 0, 36, 0);
} else {
renewSubscriptionActivity.a.r.b.setPadding(36, 0, 192, 0);
}
?? r0 = RenewSubscriptionActivity.this;
v7.f.a(r0, i, ((RenewSubscriptionActivity) r0).M);
}
}
class b implements View.OnClickListener {
b() {
}
@Override
public void onClick(View view) {
RenewSubscriptionActivity.this.goBack();
}
}
class c implements p6.b {
final boolean a;
c(boolean z) {
this.a = z;
}
@Override
public void f(@Nullable GiftSubscriptionPojo giftSubscriptionPojo) {
if (giftSubscriptionPojo == null || giftSubscriptionPojo.getData() == null) {
RenewSubscriptionActivity.this.w1(this.a);
} else if (giftSubscriptionPojo.getData().getMaximumGiftCodesLimit() <= 0 || giftSubscriptionPojo.getData().getMaximumGiftCodesLimit() - giftSubscriptionPojo.getData().getRemainingGiftCodes() <= 0) {
RenewSubscriptionActivity.this.w1(this.a);
} else {
RenewSubscriptionActivity.this.w1(false);
}
}
@Override
public void onError(@Nullable String str, @Nullable String str2) {
RenewSubscriptionActivity.this.w1(this.a);
}
}
class d extends com.htmedia.mint.utils.a3 {
d() {
}
@Override
public void onLinkClick(String str) {
RenewSubscriptionActivity renewSubscriptionActivity = RenewSubscriptionActivity.this;
renewSubscriptionActivity.Y0(str, renewSubscriptionActivity.c.getPlanCode());
}
}
class e implements h6.b {
e() {
}
@Override
public void a(int i, ListItemAllPlanManageSubscription listItemAllPlanManageSubscription) {
RenewSubscriptionActivity.this.R0(i, listItemAllPlanManageSubscription);
}
@Override
public void b(int i, int i2, ListItemAllPlanManageSubscription listItemAllPlanManageSubscription, List<ListItemAllPlanManageSubscription> list) {
RenewSubscriptionActivity.this.U0(i, i2, listItemAllPlanManageSubscription, list);
}
@Override
public void c(int i, int i2, ListItemAllPlanManageSubscription listItemAllPlanManageSubscription, List<ListItemAllPlanManageSubscription> list) {
RenewSubscriptionActivity.this.S0(i, i2, listItemAllPlanManageSubscription, list);
}
}
class f implements k6.a {
f() {
}
@Override
public void a(int i) {
RenewSubscriptionActivity.this.H = i;
RenewSubscriptionActivity renewSubscriptionActivity = RenewSubscriptionActivity.this;
renewSubscriptionActivity.V0(i, renewSubscriptionActivity.g);
RenewSubscriptionActivity renewSubscriptionActivity2 = RenewSubscriptionActivity.this;
renewSubscriptionActivity2.D = renewSubscriptionActivity2.u0(renewSubscriptionActivity2.D);
RenewSubscriptionActivity.this.X0();
}
}
class g implements q1.b {
g() {
}
@Override
public void a(int i, int i2, FrequentlyQuestion frequentlyQuestion) {
RenewSubscriptionActivity.this.onFaqClick(i, i2, frequentlyQuestion);
}
}
class h implements PartnersOfferViewInterface {
h() {
}
@Override
public void fetchPartnersOffer(CouponPartner couponPartner) {
if (couponPartner.getData() == null || couponPartner.getData().size() <= 0) {
RenewSubscriptionActivity.this.a.E.setVisibility(8);
return;
}
RenewSubscriptionActivity.this.a.E.setVisibility(0);
PartnersOfferListAdapter partnersOfferListAdapter = new PartnersOfferListAdapter(RenewSubscriptionActivity.this, couponPartner.getData(), null);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(RenewSubscriptionActivity.this);
linearLayoutManager.setOrientation(0);
RenewSubscriptionActivity.this.a.M.setLayoutManager(linearLayoutManager);
RenewSubscriptionActivity.this.a.M.setAdapter(partnersOfferListAdapter);
}
@Override
public void onPartnersOfferError(String str) {
RenewSubscriptionActivity.this.a.E.setVisibility(8);
}
}
static class i {
static final int[] a;
static final int[] b;
static {
int[] iArr = new int[q.k0.values().length];
b = iArr;
try {
iArr[q.k0.ACTIVE.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
b[q.k0.EXHAUSTED.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
b[q.k0.RESERVED.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
int[] iArr2 = new int[l.values().length];
a = iArr2;
try {
iArr2[l.LIVE.ordinal()] = 1;
} catch (NoSuchFieldError unused4) {
}
try {
a[l.RECURRING_USER.ordinal()] = 2;
} catch (NoSuchFieldError unused5) {
}
try {
a[l.UPCOMING.ordinal()] = 3;
} catch (NoSuchFieldError unused6) {
}
try {
a[l.CANCELED.ordinal()] = 4;
} catch (NoSuchFieldError unused7) {
}
}
}
private class j extends AsyncTask<Void, Void, k> {
private j() {
}
j(RenewSubscriptionActivity renewSubscriptionActivity, a aVar) {
this();
}
@Override
public k 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();
com.htmedia.mint.utils.o0.h(e, locationUrl, e.getMessage());
}
if (locationUrl == null) {
return k.Other;
}
url = new URL(locationUrl);
try {
HttpsURLConnection httpsURLConnection = (HttpsURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(url.openConnection()));
httpsURLConnection.setRequestMethod("GET");
httpsURLConnection.setRequestProperty("charset", "utf-8");
httpsURLConnection.connect();
if (httpsURLConnection.getResponseCode() == 200) {
String headerField = httpsURLConnection.getHeaderField("meta-geo");
if (TextUtils.isEmpty(headerField)) {
headerField = BuildConfig.FLAVOR;
}
if (!TextUtils.isEmpty(headerField)) {
if (!headerField.startsWith("us") && !headerField.startsWith("US")) {
if (headerField.startsWith("in") || headerField.startsWith("IN")) {
return k.India;
}
}
return k.US;
}
}
} catch (ProtocolException e2) {
e2.printStackTrace();
com.htmedia.mint.utils.o0.h(e2, locationUrl, e2.getMessage());
} catch (IOException e3) {
e3.printStackTrace();
com.htmedia.mint.utils.o0.h(e3, locationUrl, e3.getMessage());
} catch (Exception e4) {
e4.printStackTrace();
com.htmedia.mint.utils.o0.h(e4, locationUrl, e4.getMessage());
}
return k.Other;
}
@Override
public void onPostExecute(k kVar) {
super.onPostExecute(kVar);
RenewSubscriptionActivity.this.i = kVar;
RenewSubscriptionActivity.this.h1();
if (RenewSubscriptionActivity.this.d != null) {
RenewSubscriptionActivity.this.d.fetchCouponData();
}
}
}
enum k {
US,
India,
Other
}
enum l {
LIVE,
CANCELED,
UPCOMING,
RECURRING_USER,
OTHERS
}
private void A0(boolean z) {
if (this.o == null) {
this.o = AppController.j().g();
}
Config config = this.o;
String heading = (config == null || config.getManageSubscription() == null) ? "Manage Subscriptions" : this.o.getManageSubscription().getHeading();
if (z) {
this.a.V.setText("All plans");
} else {
this.a.V.setText(TextUtils.isEmpty(heading) ? "Manage Subscriptions" : Html.fromHtml(heading));
}
this.a.W.setVisibility(8);
}
private void B0() {
if (this.o == null) {
this.o = AppController.j().g();
}
Config config = this.o;
this.I = (config == null || config.getManageSubscription() == null) ? new ArrayList<>() : (ArrayList) this.o.getManageSubscription().getBenefit();
}
private void C0() {
AppController.j().l();
a1();
l1(true);
checkUserLoginStatus();
}
private boolean D0(String str) {
return !TextUtils.isEmpty(str) && str.equalsIgnoreCase(SubscriptionConverter.PLAN_CATEGORY.ECO.getPlanCategory());
}
private boolean E0(String str) {
ArrayList<MintPlanWithZSPlan> arrayList;
HashMap<String, ArrayList<MintPlanWithZSPlan>> hashMap = this.e;
return hashMap != null && hashMap.containsKey(str) && (arrayList = this.e.get(str)) != null && arrayList.size() > 0;
}
private boolean F0(String str) {
if (TextUtils.isEmpty(str)) {
return false;
}
return this.x.contains(str);
}
private static boolean G0(MintSubscriptionDetail mintSubscriptionDetail) {
return (mintSubscriptionDetail == null || TextUtils.isEmpty(mintSubscriptionDetail.getNextBillingDate())) ? false : true;
}
private boolean H0(String str) {
MintSubscriptionDetail mintSubscriptionDetail = this.c;
if (mintSubscriptionDetail == null) {
return false;
}
String planCode = mintSubscriptionDetail.getPlanCode();
return !TextUtils.isEmpty(planCode) && planCode.equalsIgnoreCase(str);
}
private boolean I0(String str) {
return !TextUtils.isEmpty(str) && str.equalsIgnoreCase(SubscriptionConverter.PLAN_CATEGORY.WSJ.getPlanCategory());
}
public void J0(View view) {
if (this.a.w.getVisibility() == 0) {
l1(true);
this.a.H.setVisibility(0);
this.a.w.setVisibility(8);
s0();
this.F = false;
A0(false);
this.a.e0.scrollTo(0, 0);
}
}
public void K0(View view) {
startActivity(new Intent((Context) this, (Class<?>) CancelStep1Activity.class));
}
public void L0(View view) {
this.D = x0(this.c);
this.H = -1;
X0();
}
public void M0(View view) {
this.a.e0.scrollBy(0, view.getHeight() + 50);
}
public void N0(int i2) {
this.a.e0.scrollBy(0, i2);
}
public void O0(View view) {
if (this.a.H.getVisibility() == 0) {
l1(false);
this.a.H.setVisibility(8);
this.a.w.setVisibility(0);
s0();
this.F = true;
A0(true);
this.a.e0.scrollTo(0, 0);
}
}
public void P0(View view) {
if (this.a.x.getVisibility() == 8) {
this.a.j.setImageResource(2131232673);
this.a.x.setVisibility(0);
} else {
this.a.j.setImageResource(2131232675);
this.a.x.setVisibility(8);
}
}
public void Q0(View view) {
boolean z = !this.R;
this.R = z;
j0(z);
}
private void T0() {
this.a.q.b.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
RenewSubscriptionActivity.this.L0(view);
}
});
}
public void V0(int i2, ArrayList<MintPlanWithZSPlan> arrayList) {
if (i2 <= -1 || arrayList.size() <= 0) {
this.D = null;
} else {
this.D = arrayList.get(i2);
}
}
private void W0() {
MintPlanWithZSPlan mintPlanWithZSPlan = this.D;
if (mintPlanWithZSPlan == null) {
Toast.makeText((Context) this, (CharSequence) getResources().getString(2131952559), 0).show();
return;
}
n4.e.h("manage_subscription_page_clicked", this.K, this.J, this.c, mintPlanWithZSPlan);
SubscriptionPlanSingleton subscriptionPlanSingleton = SubscriptionPlanSingleton.getInstance();
SSOSingleton.getInstance().setPlanPageReason(BuildConfig.FLAVOR);
if (this.c == null) {
subscriptionPlanSingleton.setSubsscreen(q.g0.ADVANCE_RENEWAL);
} else {
MintPlanWithZSPlan mintPlanWithZSPlan2 = this.D;
if (H0((mintPlanWithZSPlan2 == null || mintPlanWithZSPlan2.getSubsPlans() == null) ? BuildConfig.FLAVOR : this.D.getSubsPlans().getPlanCode()) || this.D.getPlanDiscountMS() == null || this.D.getPlanDiscountMS().getToBePaid() <= 0) {
subscriptionPlanSingleton.setSubsscreen(q.g0.ADVANCE_RENEWAL);
} else {
subscriptionPlanSingleton.setSubsscreen(q.g0.UPGRADE_PLAN_PAGE);
}
}
subscriptionPlanSingleton.setFunnelName(this.J);
subscriptionPlanSingleton.setLastAccessUrl(BuildConfig.FLAVOR);
subscriptionPlanSingleton.setmNeedToSetPassword(false);
subscriptionPlanSingleton.setMintPlanWithZSPlan(this.D);
subscriptionPlanSingleton.setPianoExpName(BuildConfig.FLAVOR);
subscriptionPlanSingleton.setMintSubscriptionDetail(this.c);
subscriptionPlanSingleton.setContent(this.K);
PlanPageExperience planPageExperience = this.r;
subscriptionPlanSingleton.setPaymentOptions(planPageExperience != null ? planPageExperience.getPaymentOptionsList() : null);
SSOSingleton.getInstance().setPaywallReson(BuildConfig.FLAVOR);
if (!SubscriptionConverter.isJuspayEnable(this.o)) {
Intent intent = new Intent((Context) this, (Class<?>) SubscriptionCheckOutPage.class);
intent.putExtra("funnelName", BuildConfig.FLAVOR);
intent.putExtra("campaigndeviceid", true);
intent.putExtra("isFromRenewPage", true);
startActivityForResult(intent, 9003);
return;
}
if (this.O == null) {
initJuspay();
}
JuspayCheckout juspayCheckout = this.O;
if (juspayCheckout != null) {
juspayCheckout.u(this, false, this.D);
}
}
public void X0() {
W0();
}
public void Y0(String str, String str2) {
if (TextUtils.isEmpty(str)) {
return;
}
WebEngageAnalytices.trackWSJActivation(str2);
Intent intent = new Intent((Context) this, (Class<?>) WebViewActivity.class);
intent.addFlags(67108864);
intent.putExtra("url", str);
intent.putExtra("Title", "WSJ Activation");
intent.putExtra("isComingFromProfile", true);
startActivityForResult(intent, 1090);
}
private void Z0(JSONObject jSONObject) {
if (jSONObject != null) {
try {
String optString = jSONObject.optString("message", BuildConfig.FLAVOR);
if (!TextUtils.isEmpty(optString) && optString.equalsIgnoreCase("success") && jSONObject.has(Parameters.DATA)) {
JSONObject jSONObject2 = jSONObject.getJSONObject(Parameters.DATA);
String optString2 = jSONObject2.optString("redemption_code_status", BuildConfig.FLAVOR);
this.z = jSONObject2.optString("redemption_url", BuildConfig.FLAVOR);
this.y = y0(optString2);
v1();
}
} catch (Exception e2) {
com.htmedia.mint.utils.o1.a("RenewSubscriptionActivi", "parseWSJResponse: " + e2);
}
}
g1();
}
private void a1() {
Config g2 = AppController.j().g();
List<String> arrayList = (g2 == null || g2.getManageSubscription() == null) ? new ArrayList<>() : g2.getManageSubscription().getAllPlanCodes();
this.x = arrayList;
if (arrayList == null) {
this.x = new ArrayList();
}
}
private void c1() {
MintPlanWithZSPlan mintPlanWithZSPlan = this.D;
if (mintPlanWithZSPlan == null || mintPlanWithZSPlan.getPlanDiscountMS() == null) {
this.a.J.setVisibility(8);
this.a.s.g.setVisibility(8);
} else {
this.a.J.setVisibility(0);
this.a.s.g.setVisibility(0);
i1(this.c, this.D);
}
}
private void checkUserLoginStatus() {
if (TextUtils.isEmpty(com.htmedia.mint.utils.f0.G1(this, "userToken"))) {
openLoginPage();
} else {
checkUserSubscriptionDetail();
}
}
private void checkUserSubscriptionDetail() {
MintSubscriptionDetail l2 = AppController.j().l();
this.c = l2;
if (l2 != null) {
new GetUserSubscriptionDetail(this, this).fetchUserSubscriptionDetail("subscribenowbutton", q.f0.HT_SUBSCRIPTION, false);
} else {
p1(l2);
}
initProgressDialogAndShow();
}
private void d1(int i2, List<ListItemAllPlanManageSubscription> list) {
ListItemAllPlanManageSubscription listItemAllPlanManageSubscription;
if (list == null || list.isEmpty() || i2 >= list.size() || (listItemAllPlanManageSubscription = list.get(i2)) == null || listItemAllPlanManageSubscription.getViewType() != 2) {
return;
}
list.remove(i2);
d1(i2, list);
}
private void e0(MintPlan mintPlan) {
ArrayList<MintPlanWithZSPlan> arrayList;
ArrayList<MintPlanWithZSPlan> t0;
if (this.e == null) {
this.e = new HashMap<>();
}
Plans plans = (mintPlan == null || mintPlan.getPlans() == null) ? null : mintPlan.getPlans();
Map<String, PlanDiscountMS> proRataCalculation = mintPlan != null ? mintPlan.getProRataCalculation() : null;
ArrayList<SubsPlans> arrayList2 = (plans == null || plans.getMintOnly() == null) ? new ArrayList<>() : (ArrayList) plans.getMintOnly();
ArrayList<SubsPlans> arrayList3 = (plans == null || plans.getMintWsj() == null) ? new ArrayList<>() : (ArrayList) plans.getMintWsj();
ArrayList<SubsPlans> arrayList4 = (plans == null || plans.getMintEco() == null) ? new ArrayList<>() : (ArrayList) plans.getMintEco();
ArrayList<SubsPlans> arrayList5 = (plans == null || plans.getMintLite() == null) ? new ArrayList<>() : (ArrayList) plans.getMintLite();
ArrayList<SubsPlans> arrayList6 = (plans == null || plans.getMintBarron() == null) ? new ArrayList<>() : (ArrayList) plans.getMintBarron();
ArrayList<SubsPlans> arrayList7 = (plans == null || plans.getWsjBarron() == null) ? new ArrayList<>() : (ArrayList) plans.getWsjBarron();
String planCategory = SubscriptionConverter.PLAN_CATEGORY.WSJ.getPlanCategory();
String planCategory2 = SubscriptionConverter.PLAN_CATEGORY.MINT.getPlanCategory();
String planCategory3 = SubscriptionConverter.PLAN_CATEGORY.ECO.getPlanCategory();
SubscriptionConverter.PLAN_CATEGORY.MINT_LITE.getPlanCategory();
String planCategory4 = SubscriptionConverter.PLAN_CATEGORY.BARRONS.getPlanCategory();
String planCategory5 = SubscriptionConverter.PLAN_CATEGORY.WSJ_BARRONS.getPlanCategory();
ArrayList<MintPlanWithZSPlan> t02 = t0(arrayList2, proRataCalculation);
t02.addAll(t0(arrayList5, proRataCalculation));
if (!t02.isEmpty()) {
this.e.put(planCategory2, t02);
}
k kVar = this.i;
if (kVar != null && kVar != k.US) {
ArrayList<MintPlanWithZSPlan> t03 = t0(arrayList3, proRataCalculation);
if (t03 != null && !t03.isEmpty()) {
this.e.put(planCategory, t03);
}
ArrayList<MintPlanWithZSPlan> t04 = t0(arrayList6, proRataCalculation);
if (t04 != null && !t04.isEmpty()) {
this.e.put(planCategory4, t04);
}
ArrayList<MintPlanWithZSPlan> t05 = t0(arrayList7, proRataCalculation);
if (t05 != null && !t05.isEmpty()) {
this.e.put(planCategory5, t05);
}
}
k kVar2 = this.i;
if (kVar2 != null && kVar2 == k.India && (t0 = t0(arrayList4, proRataCalculation)) != null && !t0.isEmpty()) {
this.e.put(planCategory3, t0);
}
p0(plans, proRataCalculation);
f1();
q1(this.G);
if (this.D == null && (arrayList = this.g) != null && arrayList.size() > 0) {
this.D = this.g.get(0);
}
MintSubscriptionDetail mintSubscriptionDetail = this.c;
if (I0(mintSubscriptionDetail != null ? mintSubscriptionDetail.getPlanType() : BuildConfig.FLAVOR)) {
q0();
} else {
g1();
}
}
private void e1() {
this.a.Y.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
RenewSubscriptionActivity.this.O0(view);
}
});
}
private void f0() {
this.a.S.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
RenewSubscriptionActivity.this.J0(view);
}
});
}
private void f1() {
m0();
this.A = new h6(this, this.h, new e());
ArrayList<ListItemAllPlanManageSubscription> arrayList = this.h;
if (arrayList == null || arrayList.size() <= this.A.j()) {
this.a.J.setVisibility(8);
} else {
MintPlanWithZSPlan mintPlanWithZSPlan = this.h.get(this.A.j()).getMintPlanWithZSPlan();
if (mintPlanWithZSPlan == null || mintPlanWithZSPlan.getPlanDiscountMS() == null) {
this.a.J.setVisibility(8);
this.a.s.g.setVisibility(8);
} else {
this.a.J.setVisibility(0);
this.a.s.g.setVisibility(0);
i1(this.c, mintPlanWithZSPlan);
}
}
this.a.L.setAdapter(this.A);
this.a.L.setLayoutManager(new LinearLayoutManager(this));
}
private void g0() {
this.a.a.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
RenewSubscriptionActivity.this.K0(view);
}
});
}
private void g1() {
MintSubscriptionDetail mintSubscriptionDetail = this.c;
boolean isRenewApplicable = mintSubscriptionDetail != null ? mintSubscriptionDetail.isRenewApplicable() : false;
if (TextUtils.isEmpty(this.q) || isRenewApplicable) {
this.d.setAutoCouponApplied(false);
this.d.setPartenrCouponCode(BuildConfig.FLAVOR);
} else {
this.d.setAutoCouponApplied(true);
this.d.setPartenrCouponCode(this.q);
this.d.autoApplyCoupon(this.q);
}
}
private int getHeightOfScreen() {
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
return displayMetrics.heightPixels;
}
public void goBack() {
dismissProgressDialog();
if (getIntent().getExtras() != null && getIntent().getExtras().containsKey("isNotification") && getIntent().getExtras().getInt("isNotification") > q.m.SPLASH.ordinal()) {
startActivity(new Intent((Context) this, (Class<?>) HomeActivity.class));
}
finish();
}
private void h0(boolean z) {
p6.a aVar = new p6.a(this, new c(z));
Config config = this.o;
String dashboard = (config == null || config.getGiftSubscriptionConfig() == null || TextUtils.isEmpty(this.o.getGiftSubscriptionConfig().getDashboard())) ? "https://apigw.livemint.com/ss/api/v1/subscription/gift/subs/{clientId}/status" : this.o.getGiftSubscriptionConfig().getDashboard();
String G1 = com.htmedia.mint.utils.f0.G1(this, "userClient");
this.b = G1;
aVar.a(0, "GIFTING_SUBS", dashboard.replace("{clientId}", G1) + "?prodId=" + com.htmedia.mint.utils.h1.b(this), null, null, false, true);
}
public void h1() {
ArrayList<MSBenefitQueston> arrayList;
if (this.i == k.US && (arrayList = this.I) != null && arrayList.size() > 1) {
this.I.remove(1);
}
this.a.x.setVisibility(8);
this.a.x.removeAllViews();
boolean E = AppController.j().E();
LayoutInflater from = LayoutInflater.from(this);
Iterator<MSBenefitQueston> it = this.I.iterator();
while (it.hasNext()) {
MSBenefitQueston next = it.next();
View inflate = from.inflate(2131624758, (ViewGroup) null, false);
TextView textView = (TextView) inflate.findViewById(2131431540);
if (E) {
textView.setTextColor(getResources().getColor(2131100511));
} else {
textView.setTextColor(getResources().getColor(2131100499));
}
textView.setText(next.getQuestion());
this.a.x.addView(inflate);
for (String str : next.getAnswer()) {
View inflate2 = from.inflate(2131624757, (ViewGroup) null, false);
TextView textView2 = (TextView) inflate2.findViewById(2131431539);
if (E) {
textView2.setTextColor(getResources().getColor(2131100511));
} else {
textView2.setTextColor(getResources().getColor(2131100499));
}
textView2.setText(str);
this.a.x.addView(inflate2);
}
}
this.a.j.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
RenewSubscriptionActivity.this.P0(view);
}
});
initFaq();
}
private void i0(MintSubscriptionDetail mintSubscriptionDetail) {
Config g2 = AppController.j().g();
if (!((g2 == null || g2.getManageSubscription() == null || !g2.getManageSubscription().isUpgradeJourneyCouponEnabled()) ? false : true)) {
this.a.A.setVisibility(8);
this.a.E.setVisibility(8);
return;
}
if (mintSubscriptionDetail != null ? mintSubscriptionDetail.isRenewApplicable() : false) {
this.a.A.setVisibility(8);
n1(mintSubscriptionDetail);
return;
}
HashMap<String, ArrayList<MintPlanWithZSPlan>> hashMap = this.e;
if (hashMap == null || hashMap.isEmpty()) {
this.a.A.setVisibility(8);
} else {
this.a.A.setVisibility(0);
}
}
private void i1(MintSubscriptionDetail mintSubscriptionDetail, MintPlanWithZSPlan mintPlanWithZSPlan) {
String str;
String str2;
if (mintSubscriptionDetail != null) {
if ((!mintSubscriptionDetail.isSubscriptionActive() && !SubscriptionConverter.isSKUPlanActive(mintSubscriptionDetail)) || mintPlanWithZSPlan == null || mintPlanWithZSPlan.getPlanDiscountMS() == null) {
return;
}
if (this.a.s.g.getVisibility() == 0) {
this.R = true;
}
this.a.Z.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
RenewSubscriptionActivity.this.Q0(view);
}
});
j0(this.R);
SubsPlans subsPlans = mintPlanWithZSPlan.getSubsPlans();
String str3 = BuildConfig.FLAVOR;
if (subsPlans != null) {
str = subsPlans.getCurrencySymbol() + subsPlans.getRecurringPrice();
} else {
str = BuildConfig.FLAVOR;
}
if (TextUtils.isEmpty(str)) {
this.a.s.c.setVisibility(8);
} else {
this.a.s.q.setText(str);
if (subsPlans != null) {
str2 = subsPlans.getName() + " " + com.htmedia.mint.utils.f0.D(subsPlans.getDescription()) + " :";
} else {
str2 = BuildConfig.FLAVOR;
}
this.a.s.p.setText(str2);
this.a.s.c.setVisibility(0);
}
boolean isCouponApplied = mintPlanWithZSPlan.isCouponApplied();
PlanDiscountMS planCouponDiscountMS = isCouponApplied ? mintPlanWithZSPlan.getPlanCouponDiscountMS() : mintPlanWithZSPlan.getPlanDiscountMS();
int couponDiscount = planCouponDiscountMS != null ? planCouponDiscountMS.getCouponDiscount() : 0;
if (!isCouponApplied || couponDiscount <= 0) {
this.a.s.s.setText(BuildConfig.FLAVOR);
this.a.s.d.setVisibility(8);
} else {
int abs = Math.abs(couponDiscount);
this.a.s.s.setText("- " + mintSubscriptionDetail.getCurrencySymbol() + abs);
this.a.s.d.setVisibility(0);
}
if (planCouponDiscountMS == null) {
this.a.J.setVisibility(8);
return;
}
int daysLeft = planCouponDiscountMS.getDaysLeft();
String str4 = daysLeft + " days";
if (daysLeft <= 1) {
str4 = daysLeft + " day";
}
SubsPlans subsPlans2 = mintPlanWithZSPlan.getSubsPlans();
this.a.s.u.setText(str4);
TextView textView = this.a.s.o;
StringBuilder sb2 = new StringBuilder();
sb2.append("- ");
sb2.append(subsPlans2 != null ? subsPlans2.getCurrencySymbol() : BuildConfig.FLAVOR);
sb2.append(planCouponDiscountMS.getBalance());
textView.setText(sb2.toString());
TextView textView2 = this.a.s.i;
StringBuilder sb3 = new StringBuilder();
if (subsPlans2 != null) {
str3 = subsPlans2.getCurrencySymbol();
}
sb3.append(str3);
sb3.append(planCouponDiscountMS.getToBePaid());
textView2.setText(sb3.toString());
}
}
private void init() {
B0();
Config g2 = getApplication().g();
this.o = g2;
Subscription subscription = g2 != null ? g2.getSubscription() : null;
this.p = subscription != null && subscription.isRazorPayEnabled();
this.j = this.o.getAdFreeSubscription() != null ? this.o.getAdFreeSubscription().getAdFreeValue() : BuildConfig.FLAVOR;
this.d = new CouponModuleRenew(this, this.a);
A0(false);
z0();
e1();
f0();
this.a.c.setOnClickListener(this);
g0();
this.K = SubscriptionPlanSingleton.getInstance().getContent();
MintSubscriptionDetail l2 = AppController.j().l();
if (getIntent() != null && getIntent().getExtras() != null && getIntent().getExtras().containsKey("planPageReason")) {
this.J = getIntent().getExtras().getString("planPageReason", BuildConfig.FLAVOR);
}
n4.e.h("manage_subscription_page_viewed", this.K, this.J, l2, (MintPlanWithZSPlan) null);
SubscriptionPlanSingleton.getInstance().setPageReason(this.J);
}
private void initCountryAndPlans() {
new j(this, null).execute(new Void[0]);
}
private void initFaq() {
Config g2 = AppController.j().g();
List<FrequentlyQuestion> arrayList = (g2 == null || g2.getFrequentlyQuestion() == null) ? new ArrayList<>() : g2.getFrequentlyQuestion();
if (arrayList == null || arrayList.isEmpty()) {
this.a.B.setVisibility(8);
return;
}
q7.q1 q1Var = new q7.q1(this, arrayList, new g());
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
linearLayoutManager.setOrientation(1);
this.a.K.setLayoutManager(linearLayoutManager);
q1Var.setFaqList(arrayList);
this.a.K.setAdapter(q1Var);
}
private void initJuspay() {
JuspayCheckout juspayCheckout = new JuspayCheckout(this, true);
this.O = juspayCheckout;
juspayCheckout.o(this);
}
private void initPianoExp() {
C0();
}
private void initProgressDialogAndShow() {
ProgressDialog progressDialog = this.C;
if (progressDialog != null && !progressDialog.isShowing()) {
this.C.show();
return;
}
if (this.C == null) {
ProgressDialog progressDialog2 = new ProgressDialog(this);
this.C = progressDialog2;
progressDialog2.setMessage("Please wait...!");
this.C.setCancelable(false);
if (this.C.isShowing()) {
return;
}
this.C.show();
}
}
private void j0(boolean z) {
if (z) {
if (this.u) {
this.a.o.setImageResource(2131232993);
} else {
this.a.o.setImageResource(2131232992);
}
this.a.s.g.setVisibility(0);
return;
}
if (this.u) {
this.a.o.setImageResource(2131232419);
} else {
this.a.o.setImageResource(2131232418);
}
this.a.s.g.setVisibility(8);
}
private void j1(MintSubscriptionDetail mintSubscriptionDetail, boolean z) {
String str;
boolean I0 = I0(mintSubscriptionDetail != null ? mintSubscriptionDetail.getPlanType() : BuildConfig.FLAVOR);
boolean isEcoPlan = SubscriptionConverter.isEcoPlan(mintSubscriptionDetail != null ? mintSubscriptionDetail.getPlanType() : BuildConfig.FLAVOR);
if (mintSubscriptionDetail != null) {
String planName = mintSubscriptionDetail.getPlanName();
String planDescription = mintSubscriptionDetail.getPlanDescription();
if (!TextUtils.isEmpty(planName)) {
this.a.q.f.setText(planDescription + " " + planName);
}
}
t1(mintSubscriptionDetail);
k kVar = this.i;
if (!(kVar == k.US && I0) && ((kVar == k.India || !isEcoPlan) && !z)) {
this.D = x0(mintSubscriptionDetail);
boolean isRenewApplicable = mintSubscriptionDetail != null ? mintSubscriptionDetail.isRenewApplicable() : false;
MintPlanWithZSPlan mintPlanWithZSPlan = this.D;
if (mintPlanWithZSPlan == null || mintPlanWithZSPlan.getSubsPlans() == null || TextUtils.isEmpty(this.D.getSubsPlans().getPlanCode()) || !isRenewApplicable) {
this.a.q.b.setVisibility(8);
} else {
SubsPlans subsPlans = this.D.getSubsPlans();
boolean isCouponApplied = this.D.isCouponApplied();
double recurringPrice = subsPlans.getRecurringPrice();
double discountPrice = this.D.getDiscountPrice();
String currencySymbol = subsPlans.getCurrencySymbol();
NumberFormat numberInstance = NumberFormat.getNumberInstance(new Locale("en"));
numberInstance.setRoundingMode(RoundingMode.CEILING);
numberInstance.setMaximumFractionDigits(0);
StringBuilder sb2 = new StringBuilder();
sb2.append(currencySymbol);
sb2.append(isCouponApplied ? numberInstance.format(discountPrice) : numberInstance.format(recurringPrice));
String sb3 = sb2.toString();
subsPlans.getInterval();
subsPlans.getIntervalUnit().equalsIgnoreCase("years");
StringBuilder sb4 = new StringBuilder();
sb4.append(currencySymbol);
if (subsPlans.getPlanDiscount() != null) {
str = numberInstance.format(subsPlans.getPlanDiscount().getActualPrice()) + BuildConfig.FLAVOR;
} else {
str = "0";
}
sb4.append(str);
String str2 = "<strike>" + sb4.toString() + "</strike>";
this.a.q.g.setText(Html.fromHtml("<b>Renew at " + sb3 + " </b>" + str2));
this.a.q.b.setVisibility(0);
}
} else {
this.a.q.b.setVisibility(8);
}
T0();
}
private void k0() {
List<String> list = this.N;
if (list == null || list.size() <= 0 || this.M != null) {
return;
}
int size = this.N.size();
this.P = size;
this.M = new View[size];
for (int i2 = 0; i2 < size; i2++) {
View inflate = ((LayoutInflater) getSystemService("layout_inflater")).inflate(2131624563, (ViewGroup) null);
this.M[i2] = inflate.findViewById(2131429061);
this.a.r.a.addView(inflate);
}
v7.f.a(this, 0, this.M);
}
private void k1() {
k0();
this.a.r.b.addOnPageChangeListener(new a());
}
private void l1(boolean z) {
Config config = this.o;
List<String> arrayList = (config == null || config.getManageSubscription() == null || this.o.getManageSubscription().getBannerImages() == null) ? new ArrayList<>() : this.o.getManageSubscription().getBannerImages();
this.N = arrayList;
if (!z || arrayList == null || arrayList.size() <= 0) {
this.a.D.setVisibility(8);
return;
}
this.a.D.setVisibility(0);
e6 e6Var = new e6(this, this.N);
this.L = e6Var;
this.a.r.b.setAdapter(e6Var);
this.a.r.b.setNestedScrollingEnabled(false);
k1();
this.a.r.b.setClipToPadding(false);
this.a.r.b.setPadding(36, 0, 192, 0);
this.a.r.b.setPageMargin(24);
}
private void m0() {
if (this.e != null) {
SubscriptionConverter.PLAN_CATEGORY plan_category = SubscriptionConverter.PLAN_CATEGORY.MINT;
String planCategory = plan_category.getPlanCategory();
SubscriptionConverter.PLAN_CATEGORY plan_category2 = SubscriptionConverter.PLAN_CATEGORY.WSJ;
String planCategory2 = plan_category2.getPlanCategory();
SubscriptionConverter.PLAN_CATEGORY plan_category3 = SubscriptionConverter.PLAN_CATEGORY.ECO;
String planCategory3 = plan_category3.getPlanCategory();
SubscriptionConverter.PLAN_CATEGORY plan_category4 = SubscriptionConverter.PLAN_CATEGORY.MINT_LITE;
String planCategory4 = plan_category4.getPlanCategory();
SubscriptionConverter.PLAN_CATEGORY plan_category5 = SubscriptionConverter.PLAN_CATEGORY.BARRONS;
String planCategory5 = plan_category5.getPlanCategory();
SubscriptionConverter.PLAN_CATEGORY plan_category6 = SubscriptionConverter.PLAN_CATEGORY.WSJ_BARRONS;
String planCategory6 = plan_category6.getPlanCategory();
if (E0(planCategory)) {
ListItemAllPlanManageSubscription listItemAllPlanManageSubscription = new ListItemAllPlanManageSubscription();
listItemAllPlanManageSubscription.setViewType(1);
listItemAllPlanManageSubscription.setPlanCategory(plan_category);
listItemAllPlanManageSubscription.setExpand(false);
this.h.add(listItemAllPlanManageSubscription);
}
if (E0(planCategory4)) {
ListItemAllPlanManageSubscription listItemAllPlanManageSubscription2 = new ListItemAllPlanManageSubscription();
listItemAllPlanManageSubscription2.setViewType(1);
listItemAllPlanManageSubscription2.setPlanCategory(plan_category4);
listItemAllPlanManageSubscription2.setExpand(false);
this.h.add(listItemAllPlanManageSubscription2);
}
if (E0(planCategory2)) {
ListItemAllPlanManageSubscription listItemAllPlanManageSubscription3 = new ListItemAllPlanManageSubscription();
listItemAllPlanManageSubscription3.setViewType(1);
listItemAllPlanManageSubscription3.setPlanCategory(plan_category2);
listItemAllPlanManageSubscription3.setExpand(false);
this.h.add(listItemAllPlanManageSubscription3);
}
if (E0(planCategory3)) {
ListItemAllPlanManageSubscription listItemAllPlanManageSubscription4 = new ListItemAllPlanManageSubscription();
listItemAllPlanManageSubscription4.setViewType(1);
listItemAllPlanManageSubscription4.setPlanCategory(plan_category3);
listItemAllPlanManageSubscription4.setExpand(false);
this.h.add(listItemAllPlanManageSubscription4);
}
if (E0(planCategory5)) {
ListItemAllPlanManageSubscription listItemAllPlanManageSubscription5 = new ListItemAllPlanManageSubscription();
listItemAllPlanManageSubscription5.setViewType(1);
listItemAllPlanManageSubscription5.setPlanCategory(plan_category5);
listItemAllPlanManageSubscription5.setExpand(false);
this.h.add(listItemAllPlanManageSubscription5);
}
if (E0(planCategory6)) {
ListItemAllPlanManageSubscription listItemAllPlanManageSubscription6 = new ListItemAllPlanManageSubscription();
listItemAllPlanManageSubscription6.setViewType(1);
listItemAllPlanManageSubscription6.setPlanCategory(plan_category6);
listItemAllPlanManageSubscription6.setExpand(false);
this.h.add(listItemAllPlanManageSubscription6);
}
ArrayList<ListItemAllPlanManageSubscription> arrayList = this.h;
if (arrayList == null || arrayList.size() <= 0) {
return;
}
U0(0, 0, this.h.get(0), this.h);
}
}
private void m1() {
this.a.g.setVisibility(8);
this.a.d.setVisibility(0);
this.a.f.setVisibility(8);
this.a.A.setVisibility(8);
this.a.w.setVisibility(8);
i0(this.c);
HashMap<String, ArrayList<MintPlanWithZSPlan>> hashMap = this.e;
if (hashMap == null || hashMap.isEmpty()) {
this.a.G.setVisibility(8);
} else {
this.a.G.setVisibility(0);
n0();
}
}
private void n0() {
Bundle extras = getIntent().getExtras();
if (extras != null && extras.containsKey("urlkey") && extras.containsKey("FromDeeplink")) {
String string = extras.getString("urlkey", BuildConfig.FLAVOR);
if (TextUtils.isEmpty(string)) {
return;
}
String path = Uri.parse(string).getPath();
if (!TextUtils.isEmpty(path) && path.startsWith(com.htmedia.mint.utils.s0.SEE_ALL_MANAGE_SUBSCRPTTON.b()) && this.a.H.getVisibility() == 0) {
l1(false);
this.a.H.setVisibility(8);
this.a.w.setVisibility(0);
s0();
this.F = true;
A0(true);
this.a.e0.scrollTo(0, 0);
}
}
}
private void n1(MintSubscriptionDetail mintSubscriptionDetail) {
if (mintSubscriptionDetail != null ? mintSubscriptionDetail.isRenewApplicable() : false) {
this.a.E.setVisibility(8);
return;
}
PartnersOfferPresenter partnersOfferPresenter = new PartnersOfferPresenter(this, new h());
Config config = this.o;
partnersOfferPresenter.fetchPartnersOffers(0, "FetchPartnersOffer", (config == null || config.getManageSubscription() == null) ? BuildConfig.FLAVOR : this.o.getManageSubscription().getPartneroffer(), null, null, false, false);
}
private void o1() {
if (this.g == null) {
this.a.f.setVisibility(8);
return;
}
l0();
if (this.g.isEmpty()) {
this.a.f.setVisibility(8);
} else {
this.a.f.setVisibility(0);
}
k6 k6Var = new k6(this, this.g, new f(), this.H);
this.B = k6Var;
this.a.N.setAdapter(k6Var);
this.a.N.setLayoutManager(new LinearLayoutManager(this));
}
public void onFaqClick(int i2, int i3, FrequentlyQuestion frequentlyQuestion) {
int heightOfScreen = (getHeightOfScreen() * 3) / 4;
int height = this.a.K.getHeight();
int scrollY = this.a.e0.getScrollY();
int height2 = this.a.e0.getHeight();
int[] iArr = new int[2];
if (i2 == i3 - 1) {
final int i4 = scrollY + height2 + height;
this.a.e0.post(new Runnable() {
@Override
public final void run() {
RenewSubscriptionActivity.this.N0(i4);
}
});
return;
}
final View childAt = this.a.K.getChildAt(i2);
childAt.getLocationInWindow(iArr);
if (heightOfScreen <= iArr[1]) {
this.a.e0.post(new Runnable() {
@Override
public final void run() {
RenewSubscriptionActivity.this.M0(childAt);
}
});
} else {
this.a.K.scrollToPosition(i2);
}
}
private void p0(Plans plans, Map<String, PlanDiscountMS> map) {
ArrayList arrayList;
if (plans == null || (arrayList = (ArrayList) plans.getRecommendedPlans()) == null) {
return;
}
Iterator it = arrayList.iterator();
while (it.hasNext()) {
SubsPlans subsPlans = (SubsPlans) it.next();
if ("active".equalsIgnoreCase(subsPlans.getStatus())) {
MintPlanWithZSPlan mintPlanWithZSPlan = new MintPlanWithZSPlan();
mintPlanWithZSPlan.setSubsPlans(subsPlans);
PlanDiscount planDiscount = subsPlans.getPlanDiscount();
if (subsPlans.getAd_version() != null && !TextUtils.isEmpty(subsPlans.getAd_version().getLm_d()) && subsPlans.getAd_version().getLm_d().equals(this.j)) {
mintPlanWithZSPlan.setAdFreePlan(true);
}
String planCode = subsPlans.getPlanCode();
if (!TextUtils.isEmpty(planCode) && map != null && map.containsKey(planCode)) {
mintPlanWithZSPlan.setPlanDiscountMS(map.get(planCode));
}
if (planDiscount != null) {
double actualPrice = planDiscount.getActualPrice();
double discountValue = planDiscount.getDiscountValue();
mintPlanWithZSPlan.setActualPrice(actualPrice);
mintPlanWithZSPlan.setDiscountPercent(discountValue);
}
if (this.i != k.US || !I0(subsPlans.getPlanType())) {
if (this.i == k.India || !D0(subsPlans.getPlanType())) {
this.g.add(mintPlanWithZSPlan);
}
}
}
}
}
private void p1(MintSubscriptionDetail mintSubscriptionDetail) {
boolean z = mintSubscriptionDetail != null && mintSubscriptionDetail.isRenewApplicable();
if (mintSubscriptionDetail != null) {
if (z) {
l1(true);
} else {
l1(false);
}
if (mintSubscriptionDetail.isSubscriptionActive() || SubscriptionConverter.isSKUPlanActive(mintSubscriptionDetail)) {
SubscriptionSource source = mintSubscriptionDetail.getSource();
if (source == null || source != SubscriptionSource.app) {
goBack();
} else if (this.c.getUpComingPlan() != null) {
this.G = l.UPCOMING;
this.E = true;
} else if (this.c.isRecurring()) {
this.E = false;
this.G = l.RECURRING_USER;
} else if (mintSubscriptionDetail.getStatus() == SubscriptionStatus.Live || mintSubscriptionDetail.getStatus() == SubscriptionStatus.Non_Renewing) {
this.G = l.LIVE;
this.E = false;
}
} else {
if (mintSubscriptionDetail.getStatus() == SubscriptionStatus.Expired) {
this.G = l.CANCELED;
} else {
this.G = l.OTHERS;
goBack();
}
this.E = false;
}
} else {
goBack();
}
initCountryAndPlans();
}
private void q0() {
String wsjActivationStatus = (AppController.j().g() == null || AppController.j().g().getSubscription() == null) ? BuildConfig.FLAVOR : AppController.j().g().getSubscription().getWsjActivationStatus();
String G1 = com.htmedia.mint.utils.f0.G1(this, "userEmail");
if (TextUtils.isEmpty(wsjActivationStatus) || TextUtils.isEmpty(G1)) {
return;
}
Uri.Builder buildUpon = Uri.parse(wsjActivationStatus).buildUpon();
buildUpon.appendQueryParameter("email", G1);
String uri = buildUpon.build().toString();
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("ProductId", getResources().getString(2131952728));
this.s = uri;
new k6.w1(this, this).a(0, "wsjStatusTAG", uri, null, hashMap, false, true);
}
private void q1(l lVar) {
if (lVar == null || lVar == l.OTHERS) {
goBack();
return;
}
int i2 = i.a[lVar.ordinal()];
if (i2 == 1 || i2 == 2) {
m1();
j1(this.c, false);
o1();
h0(true);
x1();
return;
}
if (i2 == 3) {
s1();
r1();
j1(this.c, true);
h0(true);
x1();
return;
}
if (i2 != 4) {
goBack();
return;
}
m1();
j1(this.c, false);
this.a.f.setVisibility(8);
h0(false);
}
private int r0(List<ListItemAllPlanManageSubscription> list) {
if (list == null || list.isEmpty()) {
return -1;
}
int size = list.size();
for (int i2 = 0; i2 < size; i2++) {
ListItemAllPlanManageSubscription listItemAllPlanManageSubscription = list.get(i2);
MintPlanWithZSPlan mintPlanWithZSPlan = listItemAllPlanManageSubscription != null ? listItemAllPlanManageSubscription.getMintPlanWithZSPlan() : null;
SubsPlans subsPlans = mintPlanWithZSPlan != null ? mintPlanWithZSPlan.getSubsPlans() : null;
if (subsPlans != null) {
String planCode = subsPlans.getPlanCode();
MintPlanWithZSPlan mintPlanWithZSPlan2 = this.D;
String planCode2 = (mintPlanWithZSPlan2 == null || mintPlanWithZSPlan2.getSubsPlans() == null) ? BuildConfig.FLAVOR : this.D.getSubsPlans().getPlanCode();
if (!TextUtils.isEmpty(planCode) && planCode.equalsIgnoreCase(planCode2)) {
return i2;
}
}
}
return -1;
}
private void r1() {
SubscriptionUserPlan upComingPlan = this.c.getUpComingPlan();
if (upComingPlan == null) {
this.a.g.setVisibility(8);
return;
}
this.a.u.b.setVisibility(8);
this.a.u.j.setVisibility(8);
String planType = upComingPlan.getPlanType();
boolean E = AppController.j().E();
if (I0(planType)) {
if (E) {
this.a.u.c.setImageResource(2131232587);
this.a.u.a.setBackgroundResource(2131234161);
} else {
this.a.u.c.setImageResource(2131232636);
this.a.u.a.setBackgroundResource(2131234169);
}
} else if (E) {
this.a.u.c.setImageResource(2131232595);
this.a.u.a.setBackgroundResource(2131234161);
} else {
this.a.u.c.setImageResource(2131232595);
this.a.u.a.setBackgroundResource(2131234169);
}
String name = upComingPlan.getName();
if (!TextUtils.isEmpty(name)) {
this.a.u.p.setText(name.toUpperCase());
}
int recurringPrice = (int) upComingPlan.getRecurringPrice();
this.a.u.h.setText(upComingPlan.getCurrencySymbol());
this.a.u.i.setText(recurringPrice + BuildConfig.FLAVOR);
this.a.u.o.setText(BuildConfig.FLAVOR);
this.a.u.g.setText(BuildConfig.FLAVOR);
}
private void s0() {
MintPlanWithZSPlan mintPlanWithZSPlan = null;
if (this.a.H.getVisibility() == 0) {
if (this.H == -1) {
this.D = x0(this.c);
return;
}
k6 k6Var = this.B;
if (k6Var != null && k6Var.i() != null && !this.B.i().isEmpty() && this.B.i().size() > this.H) {
mintPlanWithZSPlan = this.B.i().get(this.H);
}
this.D = mintPlanWithZSPlan;
return;
}
if (this.a.w.getVisibility() == 0) {
h6 h6Var = this.A;
int j2 = h6Var != null ? h6Var.j() : 0;
if (j2 > 0) {
ArrayList<ListItemAllPlanManageSubscription> arrayList = this.h;
if (arrayList != null && arrayList.size() > j2 && this.h.get(j2) != null && this.h.get(j2).getMintPlanWithZSPlan() != null) {
mintPlanWithZSPlan = this.h.get(j2).getMintPlanWithZSPlan();
}
this.D = mintPlanWithZSPlan;
}
}
}
private void s1() {
this.a.g.setVisibility(0);
this.a.d.setVisibility(0);
this.a.f.setVisibility(8);
this.a.G.setVisibility(8);
this.a.A.setVisibility(8);
this.a.w.setVisibility(8);
}
private void setSubscriptionIntent() {
if (GetSubscriptionIntent.getSubscriptionIntent() != null) {
setResult(-1, GetSubscriptionIntent.getSubscriptionIntent());
} else {
setResult(-1);
}
}
private void setToolbar() {
Toolbar findViewById = findViewById(2131430942);
findViewById.setContentInsetStartWithNavigation(0);
findViewById.setTitle("Back");
findViewById.setTitleTextColor(ResourcesCompat.getColor(getResources(), 2131101008, (Resources.Theme) null));
findViewById.setNavigationIcon(2131231330);
setSupportActionBar(findViewById);
getSupportActionBar().setDisplayShowTitleEnabled(true);
if (findViewById.getTitle() != null) {
String charSequence = findViewById.getTitle().toString();
for (int i2 = 0; i2 < findViewById.getChildCount(); i2++) {
AppCompatTextView childAt = findViewById.getChildAt(i2);
if ("androidx.appcompat.widget.AppCompatTextView".equals(childAt.getClass().getName())) {
AppCompatTextView appCompatTextView = childAt;
if (appCompatTextView.getText().equals(charSequence)) {
appCompatTextView.setTypeface(ResourcesCompat.getFont(this, 2131296270));
childAt.setOnClickListener(new b());
}
}
}
}
}
private void setUpAppLogo() {
try {
com.htmedia.mint.utils.m1.b(this, CheckSubscriptionFromLocal.isSubscribedUser(this), this.a.i, this.o);
} catch (Exception unused) {
}
}
private ArrayList<MintPlanWithZSPlan> t0(ArrayList<SubsPlans> arrayList, Map<String, PlanDiscountMS> map) {
ArrayList<MintPlanWithZSPlan> arrayList2 = new ArrayList<>();
if (arrayList != null && !arrayList.isEmpty()) {
Iterator<SubsPlans> it = arrayList.iterator();
while (it.hasNext()) {
SubsPlans next = it.next();
if (next != null && "active".equalsIgnoreCase(next.getStatus())) {
MintPlanWithZSPlan mintPlanWithZSPlan = new MintPlanWithZSPlan();
mintPlanWithZSPlan.setSubsPlans(next);
PlanDiscount planDiscount = next.getPlanDiscount();
if (next.getAd_version() != null && !TextUtils.isEmpty(next.getAd_version().getLm_d()) && next.getAd_version().getLm_d().equals(this.j)) {
mintPlanWithZSPlan.setAdFreePlan(true);
}
if (planDiscount != null) {
double actualPrice = planDiscount.getActualPrice();
double discountValue = planDiscount.getDiscountValue();
mintPlanWithZSPlan.setActualPrice(actualPrice);
mintPlanWithZSPlan.setDiscountPercent(discountValue);
}
String planCode = next.getPlanCode();
if (!TextUtils.isEmpty(planCode) && map != null && map.containsKey(planCode)) {
mintPlanWithZSPlan.setPlanDiscountMS(map.get(planCode));
}
MintSubscriptionDetail mintSubscriptionDetail = this.c;
if (mintSubscriptionDetail != null && mintSubscriptionDetail.isSubscriptionActive()) {
if (H0(next.getPlanCode())) {
MintSubscriptionDetail mintSubscriptionDetail2 = this.c;
if (mintSubscriptionDetail2 != null ? mintSubscriptionDetail2.isRenewApplicable() : false) {
arrayList2.add(mintPlanWithZSPlan);
}
} else if (F0(next.getPlanCode())) {
arrayList2.add(mintPlanWithZSPlan);
}
} else if (F0(next.getPlanCode())) {
arrayList2.add(mintPlanWithZSPlan);
}
}
}
}
return arrayList2;
}
private void t1(MintSubscriptionDetail mintSubscriptionDetail) {
if (mintSubscriptionDetail != null) {
if (mintSubscriptionDetail.getStatus() != null && mintSubscriptionDetail.getStatus() == SubscriptionStatus.Expired) {
this.a.q.e.setText("Subscription Expired");
this.a.q.e.setTextColor(Color.parseColor("#ff0000"));
} else if (mintSubscriptionDetail.isRenewApplicable()) {
String expiresAt = mintSubscriptionDetail.getExpiresAt();
if (TextUtils.isEmpty(expiresAt)) {
expiresAt = mintSubscriptionDetail.getCurrentTermEndsAtDate();
}
if (TextUtils.isEmpty(expiresAt)) {
this.a.q.e.setText(BuildConfig.FLAVOR);
} else {
this.a.q.e.setText(String.format("Expiring in %1$s days", SubscriptionUtils.expiryDateRemainingDays("yyyy-MM-dd", expiresAt)));
this.a.q.e.setTextColor(Color.parseColor("#ff0000"));
}
} else if (TextUtils.isEmpty(mintSubscriptionDetail.getNextBillingDate())) {
String expiresAt2 = mintSubscriptionDetail.getExpiresAt();
if (TextUtils.isEmpty(expiresAt2)) {
expiresAt2 = mintSubscriptionDetail.getCurrentTermEndsAtDate();
}
String G0 = com.htmedia.mint.utils.f0.G0(expiresAt2, "yyyy-MM-dd", "dd/MM/yyyy");
if (TextUtils.isEmpty(G0)) {
this.a.q.e.setText(BuildConfig.FLAVOR);
} else {
this.a.q.e.setText("Expiry date - " + G0);
}
} else {
String G02 = com.htmedia.mint.utils.f0.G0(mintSubscriptionDetail.getNextBillingDate(), "yyyy-MM-dd", "dd/MM/yyyy");
if (TextUtils.isEmpty(G02)) {
this.a.q.e.setText(BuildConfig.FLAVOR);
} else {
this.a.q.e.setText("Renews On - " + G02);
}
}
this.a.q.e.setVisibility(0);
}
}
private MintPlanWithZSPlan v0(String str, ArrayList<MintPlanWithZSPlan> arrayList) {
Iterator<MintPlanWithZSPlan> it = arrayList.iterator();
while (it.hasNext()) {
MintPlanWithZSPlan next = it.next();
SubsPlans subsPlans = next.getSubsPlans();
if (str.equalsIgnoreCase(subsPlans != null ? subsPlans.getPlanCode() : BuildConfig.FLAVOR)) {
return next;
}
}
return null;
}
private void v1() {
Spannable newSpannable = Spannable.Factory.getInstance().newSpannable(Html.fromHtml("You have not used your The Wall Street Journal access yet. <a href=\"" + this.z + "\">Activate now</a> "));
newSpannable.setSpan(new ImageSpan((Context) this, 2131232077, 2), newSpannable.length() - 2, newSpannable.length() - 1, 33);
this.a.t.c.setText(u7.q.p0(newSpannable));
Drawable wrap = DrawableCompat.wrap(getResources().getDrawable(2131232042));
if (AppController.j().E()) {
DrawableCompat.setTint(wrap, getResources().getColor(2131100500));
} else {
DrawableCompat.setTint(wrap, getResources().getColor(2131100499));
}
this.a.t.a.setImageDrawable(wrap);
int i2 = i.b[this.y.ordinal()];
if (i2 == 1 || i2 == 2) {
this.a.t.b.setVisibility(8);
} else if (i2 != 3) {
this.a.t.b.setVisibility(8);
} else {
this.a.t.b.setVisibility(0);
}
if (this.a.t.b.getVisibility() == 0) {
this.a.t.c.setMovementMethod(new d());
}
}
public void w1(boolean z) {
if (!this.o.getSubscription().isShowCancelCTA()) {
this.a.z.setVisibility(8);
return;
}
if (!z) {
this.a.z.setVisibility(8);
return;
}
MintSubscriptionDetail mintSubscriptionDetail = this.c;
SubscriptionStatus status = mintSubscriptionDetail != null ? mintSubscriptionDetail.getStatus() : null;
MintSubscriptionDetail mintSubscriptionDetail2 = this.c;
SubscriptionSource source = mintSubscriptionDetail2 != null ? mintSubscriptionDetail2.getSource() : SubscriptionSource.unknown;
if (status != null && ((status == SubscriptionStatus.Live && G0(this.c)) || status == SubscriptionStatus.Trial)) {
if ((source != null && source == SubscriptionSource.app) & this.p) {
this.a.z.setVisibility(0);
return;
}
}
this.a.z.setVisibility(8);
}
private MintPlanWithZSPlan x0(MintSubscriptionDetail mintSubscriptionDetail) {
String planCode = mintSubscriptionDetail != null ? mintSubscriptionDetail.getPlanCode() : BuildConfig.FLAVOR;
if (mintSubscriptionDetail != null) {
mintSubscriptionDetail.getPlanType();
}
HashMap<String, ArrayList<MintPlanWithZSPlan>> hashMap = this.e;
MintPlanWithZSPlan mintPlanWithZSPlan = null;
if (hashMap != null && !hashMap.isEmpty()) {
Iterator<String> it = this.e.keySet().iterator();
while (it.hasNext()) {
ArrayList<MintPlanWithZSPlan> arrayList = this.e.get(it.next());
if (arrayList != null && !arrayList.isEmpty() && (mintPlanWithZSPlan = v0(planCode, arrayList)) != null) {
break;
}
}
}
return mintPlanWithZSPlan;
}
private void x1() {
MintSubscriptionDetail mintSubscriptionDetail = this.c;
if (SubscriptionConverter.isEcoPlan(mintSubscriptionDetail != null ? mintSubscriptionDetail.getPlanType() : BuildConfig.FLAVOR)) {
this.a.W.setVisibility(8);
this.a.f.setVisibility(8);
this.a.G.setVisibility(8);
this.a.A.setVisibility(8);
this.a.E.setVisibility(8);
}
}
private q.k0 y0(String str) {
if (!TextUtils.isEmpty(str)) {
int length = q.k0.values().length;
for (int i2 = 0; i2 < length; i2++) {
if (q.k0.values()[i2].name().equalsIgnoreCase(str)) {
return q.k0.values()[i2];
}
}
}
return q.k0.EXPIRED;
}
private void z0() {
Bundle extras = getIntent().getExtras();
if (extras == null || !extras.containsKey("urlkey") || !extras.containsKey("FromDeeplink")) {
initPianoExp();
return;
}
String string = extras.getString("urlkey", BuildConfig.FLAVOR);
if (TextUtils.isEmpty(string)) {
goBack();
return;
}
Uri parse = Uri.parse(string);
String path = parse.getPath();
if (TextUtils.isEmpty(path) || !(path.startsWith(com.htmedia.mint.utils.s0.MANAGE_SUBSCRPTTON.b()) || path.startsWith(com.htmedia.mint.utils.s0.SEE_ALL_MANAGE_SUBSCRPTTON.b()) || path.equalsIgnoreCase(com.htmedia.mint.utils.s0.AUTO_APPLY_COUPON.b()) || path.equalsIgnoreCase(com.htmedia.mint.utils.s0.CHOOSE_PLAN.b()))) {
goBack();
return;
}
Set<String> queryParameterNames = parse.getQueryParameterNames();
if (queryParameterNames != null && !queryParameterNames.isEmpty()) {
this.q = parse.getQueryParameter("coupon");
}
initPianoExp();
}
public void R0(int i2, ListItemAllPlanManageSubscription listItemAllPlanManageSubscription) {
h6 h6Var = this.A;
if (h6Var != null) {
h6Var.notifyDataSetChanged();
}
MintPlanWithZSPlan mintPlanWithZSPlan = listItemAllPlanManageSubscription != null ? listItemAllPlanManageSubscription.getMintPlanWithZSPlan() : null;
this.D = mintPlanWithZSPlan;
if (mintPlanWithZSPlan == null || mintPlanWithZSPlan.getPlanDiscountMS() == null) {
this.a.J.setVisibility(8);
this.a.s.g.setVisibility(8);
} else {
this.a.J.setVisibility(0);
this.a.s.g.setVisibility(0);
i1(this.c, mintPlanWithZSPlan);
}
}
public void S0(int i2, int i3, ListItemAllPlanManageSubscription listItemAllPlanManageSubscription, List<ListItemAllPlanManageSubscription> list) {
listItemAllPlanManageSubscription.setExpand(false);
d1(i2 + 1, list);
if (this.A != null) {
this.A.m(r0(list));
this.A.notifyDataSetChanged();
}
}
public void U0(int i2, int i3, ListItemAllPlanManageSubscription listItemAllPlanManageSubscription, List<ListItemAllPlanManageSubscription> list) {
listItemAllPlanManageSubscription.setExpand(true);
HashMap<String, ArrayList<MintPlanWithZSPlan>> hashMap = this.e;
if (hashMap != null && !hashMap.isEmpty()) {
HashMap<String, ArrayList<MintPlanWithZSPlan>> hashMap2 = this.e;
SubscriptionConverter.PLAN_CATEGORY planCategory = listItemAllPlanManageSubscription.getPlanCategory();
String str = BuildConfig.FLAVOR;
if (hashMap2.containsKey(planCategory != null ? listItemAllPlanManageSubscription.getPlanCategory().getPlanCategory() : BuildConfig.FLAVOR)) {
HashMap<String, ArrayList<MintPlanWithZSPlan>> hashMap3 = this.e;
if (listItemAllPlanManageSubscription.getPlanCategory() != null) {
str = listItemAllPlanManageSubscription.getPlanCategory().getPlanCategory();
}
for (MintPlanWithZSPlan mintPlanWithZSPlan : hashMap3.get(str)) {
ListItemAllPlanManageSubscription listItemAllPlanManageSubscription2 = new ListItemAllPlanManageSubscription();
listItemAllPlanManageSubscription2.setViewType(2);
listItemAllPlanManageSubscription2.setMintPlanWithZSPlan(mintPlanWithZSPlan);
i2++;
list.add(i2, listItemAllPlanManageSubscription2);
}
}
}
if (this.A != null) {
this.A.m(r0(list));
this.A.notifyDataSetChanged();
}
}
public void b1() {
h6 h6Var = this.A;
if (h6Var != null) {
h6Var.notifyDataSetChanged();
}
k6 k6Var = this.B;
if (k6Var != null) {
k6Var.notifyDataSetChanged();
}
c1();
j1(this.c, false);
s0();
}
public void dismissProgressDialog() {
try {
ProgressDialog progressDialog = this.C;
if (progressDialog != null && progressDialog.isShowing()) {
this.C.dismiss();
}
} catch (IllegalArgumentException unused) {
} catch (Throwable th) {
this.C = null;
throw th;
}
this.C = null;
}
@Override
public void getMintPlan(MintPlan mintPlan) {
dismissProgressDialog();
e0(mintPlan);
}
@Override
public void getMintServerPlan(MintServerPlan mintServerPlan) {
}
public void getPianoResponse(String str, ForyouPojo foryouPojo, PianoResponse pianoResponse) {
dismissProgressDialog();
if (pianoResponse != null && pianoResponse.getPlanPageExperience() != null && pianoResponse.getPlanPageExperience().getPlanUI() != null) {
String androidCouponCode = pianoResponse.getPlanPageExperience().getPlanUI().getAndroidCouponCode();
if (!TextUtils.isEmpty(androidCouponCode)) {
this.q = androidCouponCode;
}
}
if (pianoResponse != null) {
this.r = pianoResponse.getPlanPageExperience();
}
C0();
}
@Override
public void getPremiumPlan(SubscribeNowPerant subscribeNowPerant) {
}
@Override
public void getResponse(JSONObject jSONObject, String str) {
if ("wsjStatusTAG".equalsIgnoreCase(str)) {
Z0(jSONObject);
}
}
public void getUserSubscriptionDetail(MintSubscriptionDetail mintSubscriptionDetail) {
this.c = mintSubscriptionDetail;
p1(mintSubscriptionDetail);
}
public void l0() {
ArrayList<MintPlanWithZSPlan> arrayList = new ArrayList<>();
ArrayList<MintPlanWithZSPlan> arrayList2 = this.g;
if (arrayList2 == null || arrayList2.size() <= 0) {
return;
}
Iterator<MintPlanWithZSPlan> it = this.g.iterator();
while (it.hasNext()) {
MintPlanWithZSPlan u0 = u0(it.next());
if (u0 != null) {
arrayList.add(u0);
}
}
this.g = arrayList;
k6 k6Var = this.B;
if (k6Var != null) {
k6Var.setPlansList(arrayList);
}
}
public void o0() {
Config g2 = AppController.j().g();
String planFetch = g2.getSso() != null ? g2.getSso().getPlanFetch() : BuildConfig.FLAVOR;
String str = planFetch + "?device=android&country=IN&customerId=" + com.htmedia.mint.utils.f0.G1(this, "userClient");
this.Q = str;
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("ProductId", getResources().getString(2131952728));
new k6.c1(this, this).a(0, "FetchPlan", str, hashMap, null, false, false, false, BuildConfig.FLAVOR);
}
protected void onActivityResult(int i2, int i3, @Nullable Intent intent) {
super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(i2, i3, intent);
boolean z = false;
if (i2 == 1001 && i3 == -1) {
if (intent != null && intent.hasExtra("isSignUp")) {
boolean booleanExtra = intent.getBooleanExtra("isSignUp", false);
getIntent().putExtra("needSetPassword", booleanExtra);
SubscriptionPlanSingleton.getInstance().setmNeedToSetPassword(booleanExtra);
}
HashMap hashMap = new HashMap();
String F1 = com.htmedia.mint.utils.f0.F1(this);
if (F1 != null) {
hashMap.put("userEmail", F1);
}
if (com.htmedia.mint.utils.f0.G1(this, "userName") != null) {
hashMap.put("userName", com.htmedia.mint.utils.f0.G1(this, "userName"));
}
if (hashMap.isEmpty()) {
goBack();
return;
} else {
com.htmedia.mint.utils.o0.i(hashMap);
checkUserSubscriptionDetail();
return;
}
}
if (i2 == 1090 && i3 == -1) {
q0();
return;
}
if (i2 == 9003 && i3 == -1) {
setSubscriptionIntent();
goBack();
return;
}
if (i2 != 1003 || i3 != -1) {
if (i2 == 1002 && i3 == -1) {
SubscriptionTrigger.openOnBoardJourneyVideo(this);
return;
} else {
if (i2 == 1004 && i3 == -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, 1002);
return;
}
if (com.htmedia.mint.utils.f0.R0(this) == q.n.BOTH) {
SubscriptionTrigger.openOnBoardJourneyVideo(this);
return;
}
Intent intent4 = new Intent((Context) this, (Class<?>) LoginRegisterActivity.class);
intent4.putExtra("origin", "Linking");
intent4.putExtra("linkingType", com.htmedia.mint.utils.f0.R0(this).ordinal());
intent4.setFlags(603979776);
startActivityForResult(intent4, 1002);
}
public void onBackPressed() {
JuspayCheckout juspayCheckout = this.O;
if (juspayCheckout == null || !(juspayCheckout == null || juspayCheckout.r())) {
goBack();
}
}
@Override
public void onClick(View view) {
if (view.getId() == 2131427752) {
if (this.D != null) {
X0();
} else {
Toast.makeText((Context) this, (CharSequence) "Please select plan", 0).show();
}
}
}
public void onConfigurationChanged(@NonNull Configuration configuration) {
super.onConfigurationChanged(configuration);
AppController.e(getIntent(), this);
}
protected void onCreate(@Nullable Bundle bundle) {
super/*androidx.fragment.app.FragmentActivity*/.onCreate(bundle);
x4.u2 contentView = DataBindingUtil.setContentView(this, 2131624023);
this.a = contentView;
contentView.c(Boolean.valueOf(AppController.j().E()));
setToolbar();
this.u = AppController.j().E();
NumberFormat numberInstance = NumberFormat.getNumberInstance(new Locale("en"));
this.t = numberInstance;
numberInstance.setRoundingMode(RoundingMode.CEILING);
init();
initJuspay();
}
@Override
public void onError(String str, String str2) {
dismissProgressDialog();
Toast.makeText((Context) this, (CharSequence) str2, 0).show();
if (!TextUtils.isEmpty(this.s) && this.s.equalsIgnoreCase(str)) {
g1();
}
if (TextUtils.isEmpty(this.Q) || !this.Q.equalsIgnoreCase(str)) {
return;
}
x1();
}
protected void onResume() {
super/*androidx.fragment.app.FragmentActivity*/.onResume();
if (AppController.j().E()) {
getWindow().setStatusBarColor(-16777216);
getWindow().getDecorView().setSystemUiVisibility(0);
this.a.Q.setBackgroundColor(getResources().getColor(2131100008));
this.a.Q.setTitleTextColor(ResourcesCompat.getColor(getResources(), 2131101009, (Resources.Theme) null));
this.a.Q.setNavigationIcon(2131231333);
return;
}
getWindow().setStatusBarColor(-1);
getWindow().getDecorView().setSystemUiVisibility(8192);
this.a.Q.setBackgroundColor(getResources().getColor(2131101002));
this.a.Q.setTitleTextColor(ResourcesCompat.getColor(getResources(), 2131101008, (Resources.Theme) null));
this.a.Q.setNavigationIcon(2131231330);
}
protected void onStart() {
super.onStart();
setUpAppLogo();
}
public void onSubscriptionError(SubscriptionError subscriptionError) {
dismissProgressDialog();
Toast.makeText((Context) this, (CharSequence) getResources().getString(2131952559), 0).show();
goBack();
}
public void openLoginPage() {
Intent intent = new Intent((Context) this, (Class<?>) LoginRegisterActivity.class);
intent.putExtra("origin", "Renew Funnel");
intent.putExtra("isDiscountCoupon", true);
intent.setFlags(603979776);
startActivityForResult(intent, 1001);
}
public void pianoError(String str, ForyouPojo foryouPojo, PianoResponse pianoResponse) {
dismissProgressDialog();
C0();
}
public MintPlanWithZSPlan u0(MintPlanWithZSPlan mintPlanWithZSPlan) {
HashMap<String, ArrayList<MintPlanWithZSPlan>> hashMap;
if (mintPlanWithZSPlan != null && mintPlanWithZSPlan.getSubsPlans() != null && (hashMap = this.e) != null && !hashMap.isEmpty()) {
String planCode = mintPlanWithZSPlan.getSubsPlans().getPlanCode();
Iterator<String> it = this.e.keySet().iterator();
while (it.hasNext()) {
ArrayList<MintPlanWithZSPlan> arrayList = this.e.get(it.next());
if (arrayList != null && !arrayList.isEmpty() && (mintPlanWithZSPlan = v0(planCode, arrayList)) != null) {
break;
}
}
}
return mintPlanWithZSPlan;
}
public void u1() {
if (this.F) {
this.a.H.setVisibility(8);
this.a.w.setVisibility(0);
} else {
this.a.H.setVisibility(0);
this.a.w.setVisibility(8);
}
}
public HashMap<String, ArrayList<MintPlanWithZSPlan>> w0() {
return this.e;
}
}