Money Lover v8.14.0.6版本的 MD5 值为:48b9d922212c7ccfd438cdcc183ff396
以下内容为反编译后的 MoneyInsiderActivity.java 源代码,内容仅作参考
package com.zoostudio.moneylover.main.moneyInsider;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.activity.result.ActivityResult;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.o0;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.bookmark.money.R;
import com.google.android.material.card.MaterialCardView;
import com.google.android.material.datepicker.CalendarConstraints;
import com.google.android.material.datepicker.DateValidatorPointBackward;
import com.google.android.material.datepicker.MaterialDatePicker;
import com.google.android.material.datepicker.MaterialPickerOnPositiveButtonClickListener;
import com.google.firebase.sessions.settings.RemoteSettings;
import com.whiteelephant.monthpicker.a;
import com.zoostudio.moneylover.MoneyApplication;
import com.zoostudio.moneylover.adapter.item.d0;
import com.zoostudio.moneylover.adapter.item.e0;
import com.zoostudio.moneylover.globalcate.budget.detail.ui.ActivityAddBudget;
import com.zoostudio.moneylover.goalWallet.view.GoalWalletProgress;
import com.zoostudio.moneylover.main.moneyInsider.MoneyInsiderActivity;
import com.zoostudio.moneylover.main.moneyInsider.a;
import com.zoostudio.moneylover.main.moneyInsider.store.MoneyInsiderStoreActivity;
import com.zoostudio.moneylover.ui.switcherWallet.ActivityWalletSwitcher;
import com.zoostudio.moneylover.ui.view.AmountColorTextView;
import com.zoostudio.moneylover.utils.WrapContentViewPager;
import com.zoostudio.moneylover.utils.d1;
import com.zoostudio.moneylover.utils.m0;
import h3.x1;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import jg.g;
import kn.v;
import kotlin.jvm.internal.j0;
import kotlin.jvm.internal.r;
import kotlin.jvm.internal.t;
public final class MoneyInsiderActivity extends androidx.appcompat.app.d {
public static final a f12662k1 = new a(null);
private final Calendar K0;
private boolean L;
private final androidx.activity.result.b<Intent> R;
private final f T;
private final e Y;
private final h Z;
private x1 f12663c;
private ag.n f12664d;
private fg.b f12665e;
private gg.b f12666f;
private ig.a f12667g;
private hg.b f12668i;
private jg.g f12669j;
private final g f12670k0;
private ArrayList<ng.f> f12671o = new ArrayList<>();
private ArrayList<Object> f12672p = new ArrayList<>();
private final SimpleDateFormat f12673q = new SimpleDateFormat("yyyy-MM-dd");
private final SimpleDateFormat B = new SimpleDateFormat("dd/MM/yyyy");
private final SimpleDateFormat C = new SimpleDateFormat("dd/MM");
private final String H = "https://docs.google.com/forms/d/e/1FAIpQLSeGIljPrp8k-74p4j1KO2myq_qvXUFlvddgh7ZkrPQIGtHs1w/viewform";
private int M = 2;
private ng.d Q = new ng.d(null, null, 3, null);
public static final class a {
private a() {
}
public a(kotlin.jvm.internal.j jVar) {
this();
}
}
public static final class b extends t implements wn.l<Long, v> {
b() {
super(1);
}
public final void a(Long l10) {
ag.n nVar = MoneyInsiderActivity.this.f12664d;
ag.n nVar2 = null;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
nVar.z(l10);
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
r.g(calendar, "getInstance(...)");
r.e(l10);
calendar.setTime(new Date(l10.longValue()));
if (zi.f.a().Z() > calendar.get(5)) {
calendar.add(2, -1);
}
long time = new Date(rt.c.m(zi.f.a().a0(), calendar.getTime().getTime())).getTime();
long time2 = new Date(rt.c.d(zi.f.a().a0(), calendar.getTime().getTime())).getTime();
ag.n nVar3 = MoneyInsiderActivity.this.f12664d;
if (nVar3 == null) {
r.z("mViewModel");
nVar3 = null;
}
nVar3.y(MoneyInsiderActivity.this.y1(zi.f.a().a0(), time, time2));
x1 x1Var = MoneyInsiderActivity.this.f12663c;
if (x1Var == null) {
r.z("binding");
x1Var = null;
}
x1Var.K1.f19550e.f20086f.setText(MoneyInsiderActivity.this.getString(R.string.money_insider_week));
x1 x1Var2 = MoneyInsiderActivity.this.f12663c;
if (x1Var2 == null) {
r.z("binding");
x1Var2 = null;
}
x1Var2.K1.f19550e.f20085e.setText(MoneyInsiderActivity.this.x1(zi.f.a().a0(), time, time2));
ag.n nVar4 = MoneyInsiderActivity.this.f12664d;
if (nVar4 == null) {
r.z("mViewModel");
nVar4 = null;
}
String i10 = nVar4.i();
if (i10 != null) {
MoneyInsiderActivity moneyInsiderActivity = MoneyInsiderActivity.this;
ag.n nVar5 = moneyInsiderActivity.f12664d;
if (nVar5 == null) {
r.z("mViewModel");
nVar5 = null;
}
ng.f r10 = nVar5.r();
r.e(r10);
Integer a10 = r10.a();
r.e(a10);
moneyInsiderActivity.b2(a10.intValue(), i10);
ag.n nVar6 = moneyInsiderActivity.f12664d;
if (nVar6 == null) {
r.z("mViewModel");
nVar6 = null;
}
ng.f r11 = nVar6.r();
r.e(r11);
Integer a11 = r11.a();
r.e(a11);
moneyInsiderActivity.W1(a11.intValue(), i10);
ag.n nVar7 = moneyInsiderActivity.f12664d;
if (nVar7 == null) {
r.z("mViewModel");
nVar7 = null;
}
ng.f r12 = nVar7.r();
r.e(r12);
Integer a12 = r12.a();
r.e(a12);
moneyInsiderActivity.R1(a12.intValue(), i10);
ag.n nVar8 = moneyInsiderActivity.f12664d;
if (nVar8 == null) {
r.z("mViewModel");
} else {
nVar2 = nVar8;
}
ng.f r13 = nVar2.r();
r.e(r13);
Integer a13 = r13.a();
r.e(a13);
moneyInsiderActivity.Y1(a13.intValue(), i10);
}
}
@Override
public v invoke(Long l10) {
a(l10);
return v.f26314a;
}
}
public static final class c extends t implements wn.l<e0, v> {
final e0 f12676b;
final ArrayList<ng.d> f12677c;
final j0<String> f12678d;
final j0<String> f12679e;
final j0<String> f12680f;
c(e0 e0Var, ArrayList<ng.d> arrayList, j0<String> j0Var, j0<String> j0Var2, j0<String> j0Var3) {
super(1);
this.f12676b = e0Var;
this.f12677c = arrayList;
this.f12678d = j0Var;
this.f12679e = j0Var2;
this.f12680f = j0Var3;
}
public final void a(e0 e0Var) {
boolean z10;
boolean z11;
x1 x1Var = null;
if (e0Var == null) {
x1 x1Var2 = MoneyInsiderActivity.this.f12663c;
if (x1Var2 == null) {
r.z("binding");
x1Var2 = null;
}
ConstraintLayout layoutCompare = x1Var2.V1.f20762d;
r.g(layoutCompare, "layoutCompare");
el.d.d(layoutCompare);
x1 x1Var3 = MoneyInsiderActivity.this.f12663c;
if (x1Var3 == null) {
r.z("binding");
} else {
x1Var = x1Var3;
}
ConstraintLayout layoutPreviousExpendEmpty = x1Var.V1.f20764f;
r.g(layoutPreviousExpendEmpty, "layoutPreviousExpendEmpty");
el.d.k(layoutPreviousExpendEmpty);
return;
}
x1 x1Var4 = MoneyInsiderActivity.this.f12663c;
if (x1Var4 == null) {
r.z("binding");
x1Var4 = null;
}
ConstraintLayout layoutCompare2 = x1Var4.V1.f20762d;
r.g(layoutCompare2, "layoutCompare");
el.d.k(layoutCompare2);
x1 x1Var5 = MoneyInsiderActivity.this.f12663c;
if (x1Var5 == null) {
r.z("binding");
x1Var5 = null;
}
ConstraintLayout layoutPreviousExpendEmpty2 = x1Var5.V1.f20764f;
r.g(layoutPreviousExpendEmpty2, "layoutPreviousExpendEmpty");
el.d.d(layoutPreviousExpendEmpty2);
if (e0Var.getTotalExpense() == 0.0d) {
z10 = true;
} else {
z10 = false;
}
if (!z10) {
if (this.f12676b.getTotalExpense() == 0.0d) {
z11 = true;
} else {
z11 = false;
}
if (!z11) {
double totalExpense = e0Var.getTotalExpense();
MoneyInsiderActivity moneyInsiderActivity = MoneyInsiderActivity.this;
r.g(this.f12677c.get(0), "get(...)");
double s12 = totalExpense / moneyInsiderActivity.s1(r6);
double totalExpense2 = this.f12676b.getTotalExpense();
MoneyInsiderActivity moneyInsiderActivity2 = MoneyInsiderActivity.this;
r.g(this.f12677c.get(1), "get(...)");
double s13 = totalExpense2 / moneyInsiderActivity2.s1(r6);
int rint = (int) Math.rint(Math.abs((100 * (s13 - s12)) / s12));
x1 x1Var6 = MoneyInsiderActivity.this.f12663c;
if (x1Var6 == null) {
r.z("binding");
x1Var6 = null;
}
x1Var6.V1.f20770q.setText(MoneyInsiderActivity.this.getString(R.string.percent, String.valueOf(rint)));
if (s13 > s12) {
x1 x1Var7 = MoneyInsiderActivity.this.f12663c;
if (x1Var7 == null) {
r.z("binding");
x1Var7 = null;
}
x1Var7.V1.f20761c.setImageDrawable(androidx.core.content.a.getDrawable(MoneyInsiderActivity.this, R.drawable.icon_arrow_up_red));
x1 x1Var8 = MoneyInsiderActivity.this.f12663c;
if (x1Var8 == null) {
r.z("binding");
x1Var8 = null;
}
x1Var8.V1.B.setText(this.f12678d.f26370a);
x1 x1Var9 = MoneyInsiderActivity.this.f12663c;
if (x1Var9 == null) {
r.z("binding");
x1Var9 = null;
}
x1Var9.V1.B.setTextColor(MoneyInsiderActivity.this.getColor(R.color.r_500));
x1 x1Var10 = MoneyInsiderActivity.this.f12663c;
if (x1Var10 == null) {
r.z("binding");
} else {
x1Var = x1Var10;
}
x1Var.V1.f20770q.setTextColor(MoneyInsiderActivity.this.getColor(R.color.r_500));
return;
}
x1 x1Var11 = MoneyInsiderActivity.this.f12663c;
if (x1Var11 == null) {
r.z("binding");
x1Var11 = null;
}
x1Var11.V1.f20761c.setImageDrawable(androidx.core.content.a.getDrawable(MoneyInsiderActivity.this, R.drawable.icon_arrow_down_green));
if (rint == 0) {
x1 x1Var12 = MoneyInsiderActivity.this.f12663c;
if (x1Var12 == null) {
r.z("binding");
x1Var12 = null;
}
x1Var12.V1.B.setText(this.f12679e.f26370a);
} else {
x1 x1Var13 = MoneyInsiderActivity.this.f12663c;
if (x1Var13 == null) {
r.z("binding");
x1Var13 = null;
}
x1Var13.V1.B.setText(this.f12680f.f26370a);
}
x1 x1Var14 = MoneyInsiderActivity.this.f12663c;
if (x1Var14 == null) {
r.z("binding");
x1Var14 = null;
}
x1Var14.V1.B.setTextColor(MoneyInsiderActivity.this.getColor(R.color.p_500));
x1 x1Var15 = MoneyInsiderActivity.this.f12663c;
if (x1Var15 == null) {
r.z("binding");
} else {
x1Var = x1Var15;
}
x1Var.V1.f20770q.setTextColor(MoneyInsiderActivity.this.getColor(R.color.p_500));
return;
}
}
x1 x1Var16 = MoneyInsiderActivity.this.f12663c;
if (x1Var16 == null) {
r.z("binding");
} else {
x1Var = x1Var16;
}
ConstraintLayout layoutPreviousExpendEmpty3 = x1Var.V1.f20764f;
r.g(layoutPreviousExpendEmpty3, "layoutPreviousExpendEmpty");
el.d.k(layoutPreviousExpendEmpty3);
}
@Override
public v invoke(e0 e0Var) {
a(e0Var);
return v.f26314a;
}
}
public static final class d extends t implements wn.l<e0, v> {
final ng.d f12682b;
final int f12683c;
final String f12684d;
d(ng.d dVar, int i10, String str) {
super(1);
this.f12682b = dVar;
this.f12683c = i10;
this.f12684d = str;
}
public final void a(e0 e0Var) {
String string;
double s12;
List z02;
String sb2;
boolean z10;
ag.n nVar;
ag.n nVar2;
ag.n nVar3;
if (e0Var != null) {
x1 x1Var = MoneyInsiderActivity.this.f12663c;
if (x1Var == null) {
r.z("binding");
x1Var = null;
}
TextView textView = x1Var.f22341me.f20380g;
if (MoneyInsiderActivity.this.L) {
string = MoneyInsiderActivity.this.getString(R.string.cashbook_spending);
} else {
string = MoneyInsiderActivity.this.getString(R.string.budget_detail_projected_spending);
}
textView.setText(string);
if (MoneyInsiderActivity.this.L) {
s12 = e0Var.getTotalExpense();
} else {
double totalExpense = e0Var.getTotalExpense() / MoneyInsiderActivity.this.t1(this.f12682b);
MoneyInsiderActivity moneyInsiderActivity = MoneyInsiderActivity.this;
s12 = totalExpense * moneyInsiderActivity.s1(moneyInsiderActivity.Q);
}
x1 x1Var2 = MoneyInsiderActivity.this.f12663c;
if (x1Var2 == null) {
r.z("binding");
x1Var2 = null;
}
AmountColorTextView amountColorTextView = x1Var2.f22341me.f20379f;
ag.n nVar4 = MoneyInsiderActivity.this.f12664d;
if (nVar4 == null) {
r.z("mViewModel");
nVar4 = null;
}
com.zoostudio.moneylover.adapter.item.a p10 = nVar4.p();
r.e(p10);
amountColorTextView.d(s12, p10.getCurrency());
if (this.f12683c == 1) {
sb2 = this.f12684d;
} else {
StringBuilder sb3 = new StringBuilder();
sb3.append(MoneyInsiderActivity.this.getString(R.string.month));
sb3.append(' ');
z02 = pq.v.z0(this.f12684d, new String[]{RemoteSettings.FORWARD_SLASH_STRING}, false, 0, 6, null);
sb3.append((String) z02.get(0));
sb2 = sb3.toString();
}
MoneyInsiderActivity.this.X1(this.f12683c, this.f12682b, e0Var);
if (e0Var.getTotalExpense() == 0.0d) {
z10 = true;
} else {
z10 = false;
}
if (z10) {
x1 x1Var3 = MoneyInsiderActivity.this.f12663c;
if (x1Var3 == null) {
r.z("binding");
x1Var3 = null;
}
x1Var3.f22341me.f20380g.setText(MoneyInsiderActivity.this.getString(R.string.cashbook_spending));
x1 x1Var4 = MoneyInsiderActivity.this.f12663c;
if (x1Var4 == null) {
r.z("binding");
x1Var4 = null;
}
TextView textView2 = x1Var4.f22341me.f20378e;
MoneyInsiderActivity moneyInsiderActivity2 = MoneyInsiderActivity.this;
Object[] objArr = new Object[4];
x1 x1Var5 = moneyInsiderActivity2.f12663c;
if (x1Var5 == null) {
r.z("binding");
x1Var5 = null;
}
objArr[0] = x1Var5.f22341me.f20379f.getText();
objArr[1] = "";
ag.n nVar5 = MoneyInsiderActivity.this.f12664d;
if (nVar5 == null) {
r.z("mViewModel");
nVar3 = null;
} else {
nVar3 = nVar5;
}
nc.a k10 = nVar3.k();
r.e(k10);
String r10 = k10.r();
r.e(r10);
objArr[2] = r10;
objArr[3] = sb2;
textView2.setText(moneyInsiderActivity2.getString(R.string.projected_spending_desciption_money_insider_2, objArr));
return;
}
if (MoneyInsiderActivity.this.L) {
x1 x1Var6 = MoneyInsiderActivity.this.f12663c;
if (x1Var6 == null) {
r.z("binding");
x1Var6 = null;
}
TextView textView3 = x1Var6.f22341me.f20378e;
MoneyInsiderActivity moneyInsiderActivity3 = MoneyInsiderActivity.this;
Object[] objArr2 = new Object[4];
x1 x1Var7 = moneyInsiderActivity3.f12663c;
if (x1Var7 == null) {
r.z("binding");
x1Var7 = null;
}
objArr2[0] = x1Var7.f22341me.f20379f.getText();
objArr2[1] = "";
ag.n nVar6 = MoneyInsiderActivity.this.f12664d;
if (nVar6 == null) {
r.z("mViewModel");
nVar2 = null;
} else {
nVar2 = nVar6;
}
nc.a k11 = nVar2.k();
r.e(k11);
String r11 = k11.r();
r.e(r11);
objArr2[2] = r11;
objArr2[3] = sb2;
textView3.setText(moneyInsiderActivity3.getString(R.string.projected_spending_desciption_money_insider_2, objArr2));
return;
}
x1 x1Var8 = MoneyInsiderActivity.this.f12663c;
if (x1Var8 == null) {
r.z("binding");
x1Var8 = null;
}
CharSequence text = x1Var8.f22341me.f20379f.getText();
x1 x1Var9 = MoneyInsiderActivity.this.f12663c;
if (x1Var9 == null) {
r.z("binding");
x1Var9 = null;
}
TextView textView4 = x1Var9.f22341me.f20378e;
Resources resources = MoneyInsiderActivity.this.getResources();
Object[] objArr3 = new Object[4];
MoneyInsiderActivity moneyInsiderActivity4 = MoneyInsiderActivity.this;
objArr3[0] = Integer.valueOf(moneyInsiderActivity4.r1(moneyInsiderActivity4.w1(this.f12683c, this.f12684d)));
objArr3[1] = sb2;
objArr3[2] = text;
ag.n nVar7 = MoneyInsiderActivity.this.f12664d;
if (nVar7 == null) {
r.z("mViewModel");
nVar = null;
} else {
nVar = nVar7;
}
nc.a k12 = nVar.k();
r.e(k12);
String r12 = k12.r();
r.e(r12);
objArr3[3] = r12;
textView4.setText(resources.getQuantityString(R.plurals.projected_spending_desciption_money_insider, 4, objArr3));
}
}
@Override
public v invoke(e0 e0Var) {
a(e0Var);
return v.f26314a;
}
}
public static final class e extends BroadcastReceiver {
e() {
}
@Override
public void onReceive(Context context, Intent intent) {
ag.n nVar = MoneyInsiderActivity.this.f12664d;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
nVar.w(true);
}
}
public static final class f extends BroadcastReceiver {
f() {
}
@Override
public void onReceive(Context context, Intent intent) {
MoneyInsiderActivity.this.Z1(false, false);
MoneyInsiderActivity.this.j2();
}
}
public static final class g extends BroadcastReceiver {
g() {
}
@Override
public void onReceive(Context context, Intent intent) {
MoneyInsiderActivity.this.M1();
}
}
public static final class h extends BroadcastReceiver {
h() {
}
@Override
public void onReceive(Context context, Intent intent) {
ag.n nVar = MoneyInsiderActivity.this.f12664d;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
nVar.E(true);
}
}
public static final class i extends t implements wn.l<mc.b, v> {
i() {
super(1);
}
public final void a(mc.b bVar) {
x1 x1Var = null;
ag.n nVar = null;
if (bVar == null) {
x1 x1Var2 = MoneyInsiderActivity.this.f12663c;
if (x1Var2 == null) {
r.z("binding");
x1Var2 = null;
}
MaterialCardView layoutSpendingLimit = x1Var2.f22342th.f20891d;
r.g(layoutSpendingLimit, "layoutSpendingLimit");
el.d.d(layoutSpendingLimit);
x1 x1Var3 = MoneyInsiderActivity.this.f12663c;
if (x1Var3 == null) {
r.z("binding");
x1Var3 = null;
}
MaterialCardView layoutBudgetEmpty = x1Var3.f22342th.f20890c;
r.g(layoutBudgetEmpty, "layoutBudgetEmpty");
el.d.k(layoutBudgetEmpty);
x1 x1Var4 = MoneyInsiderActivity.this.f12663c;
if (x1Var4 == null) {
r.z("binding");
x1Var4 = null;
}
TextView btnAddBudget = x1Var4.f22342th.f20889b;
r.g(btnAddBudget, "btnAddBudget");
el.d.k(btnAddBudget);
x1 x1Var5 = MoneyInsiderActivity.this.f12663c;
if (x1Var5 == null) {
r.z("binding");
x1Var5 = null;
}
TextView textView = x1Var5.f22342th.f20895i;
MoneyInsiderActivity moneyInsiderActivity = MoneyInsiderActivity.this;
Object[] objArr = new Object[1];
ag.n nVar2 = moneyInsiderActivity.f12664d;
if (nVar2 == null) {
r.z("mViewModel");
nVar2 = null;
}
nc.a k10 = nVar2.k();
r.e(k10);
String r10 = k10.r();
r.e(r10);
objArr[0] = r10;
textView.setText(moneyInsiderActivity.getString(R.string.nobudget_noti_money_insider, objArr));
if (MoneyInsiderActivity.this.L) {
x1 x1Var6 = MoneyInsiderActivity.this.f12663c;
if (x1Var6 == null) {
r.z("binding");
x1Var6 = null;
}
TextView btnAddBudget2 = x1Var6.f22342th.f20889b;
r.g(btnAddBudget2, "btnAddBudget");
el.d.d(btnAddBudget2);
x1 x1Var7 = MoneyInsiderActivity.this.f12663c;
if (x1Var7 == null) {
r.z("binding");
x1Var7 = null;
}
TextView textView2 = x1Var7.f22342th.f20895i;
MoneyInsiderActivity moneyInsiderActivity2 = MoneyInsiderActivity.this;
Object[] objArr2 = new Object[1];
ag.n nVar3 = moneyInsiderActivity2.f12664d;
if (nVar3 == null) {
r.z("mViewModel");
} else {
nVar = nVar3;
}
nc.a k11 = nVar.k();
r.e(k11);
String r11 = k11.r();
r.e(r11);
objArr2[0] = r11;
textView2.setText(moneyInsiderActivity2.getString(R.string.nobudget_noti_money_insider_past, objArr2));
return;
}
return;
}
x1 x1Var8 = MoneyInsiderActivity.this.f12663c;
if (x1Var8 == null) {
r.z("binding");
x1Var8 = null;
}
MaterialCardView layoutSpendingLimit2 = x1Var8.f22342th.f20891d;
r.g(layoutSpendingLimit2, "layoutSpendingLimit");
el.d.k(layoutSpendingLimit2);
x1 x1Var9 = MoneyInsiderActivity.this.f12663c;
if (x1Var9 == null) {
r.z("binding");
} else {
x1Var = x1Var9;
}
MaterialCardView layoutBudgetEmpty2 = x1Var.f22342th.f20890c;
r.g(layoutBudgetEmpty2, "layoutBudgetEmpty");
el.d.d(layoutBudgetEmpty2);
MoneyInsiderActivity.this.S1(bVar);
}
@Override
public v invoke(mc.b bVar) {
a(bVar);
return v.f26314a;
}
}
public static final class j extends t implements wn.l<ArrayList<d0>, v> {
j() {
super(1);
}
public final void a(ArrayList<d0> it) {
r.h(it, "it");
hg.b bVar = null;
x1 x1Var = null;
if (it.isEmpty()) {
x1 x1Var2 = MoneyInsiderActivity.this.f12663c;
if (x1Var2 == null) {
r.z("binding");
x1Var2 = null;
}
RecyclerView rcvTopSpending = x1Var2.f22344uk.f21395b;
r.g(rcvTopSpending, "rcvTopSpending");
el.d.d(rcvTopSpending);
x1 x1Var3 = MoneyInsiderActivity.this.f12663c;
if (x1Var3 == null) {
r.z("binding");
} else {
x1Var = x1Var3;
}
TextView txtEmpty = x1Var.f22344uk.f21396c;
r.g(txtEmpty, "txtEmpty");
el.d.k(txtEmpty);
return;
}
x1 x1Var4 = MoneyInsiderActivity.this.f12663c;
if (x1Var4 == null) {
r.z("binding");
x1Var4 = null;
}
RecyclerView rcvTopSpending2 = x1Var4.f22344uk.f21395b;
r.g(rcvTopSpending2, "rcvTopSpending");
el.d.k(rcvTopSpending2);
x1 x1Var5 = MoneyInsiderActivity.this.f12663c;
if (x1Var5 == null) {
r.z("binding");
x1Var5 = null;
}
TextView txtEmpty2 = x1Var5.f22344uk.f21396c;
r.g(txtEmpty2, "txtEmpty");
el.d.d(txtEmpty2);
MoneyInsiderActivity.this.f12668i = new hg.b(it);
x1 x1Var6 = MoneyInsiderActivity.this.f12663c;
if (x1Var6 == null) {
r.z("binding");
x1Var6 = null;
}
RecyclerView recyclerView = x1Var6.f22344uk.f21395b;
hg.b bVar2 = MoneyInsiderActivity.this.f12668i;
if (bVar2 == null) {
r.z("adapterTopSpending");
bVar2 = null;
}
recyclerView.setAdapter(bVar2);
hg.b bVar3 = MoneyInsiderActivity.this.f12668i;
if (bVar3 == null) {
r.z("adapterTopSpending");
} else {
bVar = bVar3;
}
bVar.k(it);
}
@Override
public v invoke(ArrayList<d0> arrayList) {
a(arrayList);
return v.f26314a;
}
}
public static final class k implements kg.d {
public static final class a implements kg.b {
final MoneyInsiderActivity f12692a;
a(MoneyInsiderActivity moneyInsiderActivity) {
this.f12692a = moneyInsiderActivity;
}
@Override
public void a(nc.a item) {
Object obj;
r.h(item, "item");
ag.n nVar = this.f12692a.f12664d;
gg.b bVar = null;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
nVar.A(item);
Context baseContext = this.f12692a.getBaseContext();
r.g(baseContext, "getBaseContext(...)");
HashMap hashMap = new HashMap();
String q10 = item.q();
r.e(q10);
hashMap.put("category_type", q10);
v vVar = v.f26314a;
qe.a.k(baseContext, "money_insider_select_category", hashMap);
ag.n nVar2 = this.f12692a.f12664d;
if (nVar2 == null) {
r.z("mViewModel");
nVar2 = null;
}
Iterator<T> it = nVar2.l().iterator();
while (true) {
if (it.hasNext()) {
obj = it.next();
if (r.c(((nc.a) obj).m(), item.m())) {
break;
}
} else {
obj = null;
break;
}
}
nc.a aVar = (nc.a) obj;
if (aVar == null) {
this.f12692a.i2(item);
} else {
ag.n nVar3 = this.f12692a.f12664d;
if (nVar3 == null) {
r.z("mViewModel");
nVar3 = null;
}
for (nc.a aVar2 : nVar3.l()) {
aVar2.V(r.c(aVar2.m(), aVar.m()));
}
gg.b bVar2 = this.f12692a.f12666f;
if (bVar2 == null) {
r.z("adapterTabLabel");
} else {
bVar = bVar2;
}
bVar.notifyDataSetChanged();
}
this.f12692a.a2();
}
}
k() {
}
@Override
public void a(nc.a item) {
jg.g gVar;
r.h(item, "item");
Long m10 = item.m();
gg.b bVar = null;
String str = null;
if (m10 != null && m10.longValue() == -11) {
MoneyInsiderActivity moneyInsiderActivity = MoneyInsiderActivity.this;
g.a aVar = jg.g.f25454j;
ag.n nVar = moneyInsiderActivity.f12664d;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
nc.a k10 = nVar.k();
r.e(k10);
Long m11 = k10.m();
ag.n nVar2 = MoneyInsiderActivity.this.f12664d;
if (nVar2 == null) {
r.z("mViewModel");
nVar2 = null;
}
moneyInsiderActivity.f12669j = aVar.a(moneyInsiderActivity, m11, nVar2.p(), new a(MoneyInsiderActivity.this));
jg.g gVar2 = MoneyInsiderActivity.this.f12669j;
boolean z10 = false;
if (gVar2 != null && !gVar2.isAdded()) {
z10 = true;
}
if (z10 && (gVar = MoneyInsiderActivity.this.f12669j) != null) {
FragmentManager supportFragmentManager = MoneyInsiderActivity.this.getSupportFragmentManager();
jg.g gVar3 = MoneyInsiderActivity.this.f12669j;
if (gVar3 != null) {
str = gVar3.getTag();
}
gVar.show(supportFragmentManager, str);
return;
}
return;
}
Long m12 = item.m();
if (m12 != null && m12.longValue() == 0) {
ag.n nVar3 = MoneyInsiderActivity.this.f12664d;
if (nVar3 == null) {
r.z("mViewModel");
nVar3 = null;
}
String string = MoneyInsiderActivity.this.getString(R.string.search_all);
r.g(string, "getString(...)");
nVar3.A(new nc.a(0L, string, false, false));
} else {
Context baseContext = MoneyInsiderActivity.this.getBaseContext();
r.g(baseContext, "getBaseContext(...)");
HashMap hashMap = new HashMap();
String q10 = item.q();
r.e(q10);
hashMap.put("category_type", q10);
v vVar = v.f26314a;
qe.a.k(baseContext, "money_insider_select_category", hashMap);
ag.n nVar4 = MoneyInsiderActivity.this.f12664d;
if (nVar4 == null) {
r.z("mViewModel");
nVar4 = null;
}
nVar4.A(item);
}
ag.n nVar5 = MoneyInsiderActivity.this.f12664d;
if (nVar5 == null) {
r.z("mViewModel");
nVar5 = null;
}
for (nc.a aVar2 : nVar5.l()) {
aVar2.V(r.c(aVar2.m(), item.m()));
}
gg.b bVar2 = MoneyInsiderActivity.this.f12666f;
if (bVar2 == null) {
r.z("adapterTabLabel");
} else {
bVar = bVar2;
}
bVar.notifyDataSetChanged();
MoneyInsiderActivity.this.a2();
}
}
public static final class l extends t implements wn.l<ArrayList<nc.a>, v> {
final boolean f12694b;
l(boolean z10) {
super(1);
this.f12694b = z10;
}
public final void a(ArrayList<nc.a> it) {
Object obj;
Long l10;
r.h(it, "it");
if (it.isEmpty()) {
MoneyInsiderActivity.this.h2();
}
ag.n nVar = MoneyInsiderActivity.this.f12664d;
ag.n nVar2 = null;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
ArrayList<nc.a> l11 = nVar.l();
String string = MoneyInsiderActivity.this.getString(R.string.search_all);
r.g(string, "getString(...)");
l11.add(new nc.a(0L, string, false, false));
ag.n nVar3 = MoneyInsiderActivity.this.f12664d;
if (nVar3 == null) {
r.z("mViewModel");
nVar3 = null;
}
nVar3.l().addAll(it);
ag.n nVar4 = MoneyInsiderActivity.this.f12664d;
if (nVar4 == null) {
r.z("mViewModel");
nVar4 = null;
}
ArrayList<nc.a> l12 = nVar4.l();
String string2 = MoneyInsiderActivity.this.getString(R.string.money_insider_cate_more);
r.g(string2, "getString(...)");
l12.add(new nc.a(-11L, string2, false, true));
ag.n nVar5 = MoneyInsiderActivity.this.f12664d;
if (nVar5 == null) {
r.z("mViewModel");
nVar5 = null;
}
if (nVar5.k() == null || this.f12694b) {
ag.n nVar6 = MoneyInsiderActivity.this.f12664d;
if (nVar6 == null) {
r.z("mViewModel");
nVar6 = null;
}
String string3 = MoneyInsiderActivity.this.getString(R.string.search_all);
r.g(string3, "getString(...)");
nVar6.A(new nc.a(0L, string3, false, false));
}
ag.n nVar7 = MoneyInsiderActivity.this.f12664d;
if (nVar7 == null) {
r.z("mViewModel");
nVar7 = null;
}
ArrayList<nc.a> l13 = nVar7.l();
MoneyInsiderActivity moneyInsiderActivity = MoneyInsiderActivity.this;
Iterator<T> it2 = l13.iterator();
while (true) {
if (it2.hasNext()) {
obj = it2.next();
Long m10 = ((nc.a) obj).m();
ag.n nVar8 = moneyInsiderActivity.f12664d;
if (nVar8 == null) {
r.z("mViewModel");
nVar8 = null;
}
nc.a k10 = nVar8.k();
if (k10 != null) {
l10 = k10.m();
} else {
l10 = null;
}
if (r.c(m10, l10)) {
break;
}
} else {
obj = null;
break;
}
}
nc.a aVar = (nc.a) obj;
if (aVar != null) {
aVar.V(true);
}
gg.b bVar = MoneyInsiderActivity.this.f12666f;
if (bVar == null) {
r.z("adapterTabLabel");
bVar = null;
}
ag.n nVar9 = MoneyInsiderActivity.this.f12664d;
if (nVar9 == null) {
r.z("mViewModel");
} else {
nVar2 = nVar9;
}
bVar.k(nVar2.l());
MoneyInsiderActivity.this.a2();
}
@Override
public v invoke(ArrayList<nc.a> arrayList) {
a(arrayList);
return v.f26314a;
}
}
public static final class m implements kg.c {
m() {
}
@Override
public void a(ng.f item) {
r.h(item, "item");
ag.n nVar = MoneyInsiderActivity.this.f12664d;
ag.n nVar2 = null;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
nVar.C(item);
for (ng.f fVar : MoneyInsiderActivity.this.f12671o) {
fVar.d(Boolean.valueOf(r.c(fVar.a(), item.a())));
}
fg.b bVar = MoneyInsiderActivity.this.f12665e;
if (bVar == null) {
r.z("adapterSwitcher");
bVar = null;
}
bVar.notifyDataSetChanged();
Integer a10 = item.a();
if (a10 != null) {
MoneyInsiderActivity moneyInsiderActivity = MoneyInsiderActivity.this;
int intValue = a10.intValue();
ag.n nVar3 = moneyInsiderActivity.f12664d;
if (nVar3 == null) {
r.z("mViewModel");
nVar3 = null;
}
nVar3.y(null);
if (intValue == 1) {
x1 x1Var = moneyInsiderActivity.f12663c;
if (x1Var == null) {
r.z("binding");
x1Var = null;
}
x1Var.f22344uk.f21397d.setText(moneyInsiderActivity.getString(R.string.top_expenses_of_the_week));
moneyInsiderActivity.O1();
} else {
x1 x1Var2 = moneyInsiderActivity.f12663c;
if (x1Var2 == null) {
r.z("binding");
x1Var2 = null;
}
x1Var2.f22344uk.f21397d.setText(moneyInsiderActivity.getString(R.string.top_expenses_of_the_month));
moneyInsiderActivity.N1();
}
ag.n nVar4 = moneyInsiderActivity.f12664d;
if (nVar4 == null) {
r.z("mViewModel");
} else {
nVar2 = nVar4;
}
String i10 = nVar2.i();
if (i10 != null) {
moneyInsiderActivity.b2(intValue, i10);
moneyInsiderActivity.W1(intValue, i10);
moneyInsiderActivity.R1(intValue, i10);
moneyInsiderActivity.Y1(intValue, i10);
}
}
}
}
public static final class n extends t implements wn.a<v> {
final j0<AlertDialog> f12697b;
n(j0<AlertDialog> j0Var) {
super(0);
this.f12697b = j0Var;
}
@Override
public v invoke() {
invoke2();
return v.f26314a;
}
public final void invoke2() {
c9.b.f7270d.a(true).show(MoneyInsiderActivity.this.getSupportFragmentManager(), "");
AlertDialog alertDialog = this.f12697b.f26370a;
if (alertDialog != null) {
alertDialog.dismiss();
}
}
}
public static final class o extends t implements wn.a<v> {
final j0<AlertDialog> f12698a;
o(j0<AlertDialog> j0Var) {
super(0);
this.f12698a = j0Var;
}
@Override
public v invoke() {
invoke2();
return v.f26314a;
}
public final void invoke2() {
AlertDialog alertDialog = this.f12698a.f26370a;
if (alertDialog != null) {
alertDialog.dismiss();
}
}
}
public static final class p extends t implements wn.a<v> {
final j0<AlertDialog> f12699a;
p(j0<AlertDialog> j0Var) {
super(0);
this.f12699a = j0Var;
}
@Override
public v invoke() {
invoke2();
return v.f26314a;
}
public final void invoke2() {
AlertDialog alertDialog = this.f12699a.f26370a;
if (alertDialog != null) {
alertDialog.dismiss();
}
}
}
public MoneyInsiderActivity() {
androidx.activity.result.b<Intent> registerForActivityResult = registerForActivityResult(new c.c(), new androidx.activity.result.a() {
@Override
public final void a(Object obj) {
MoneyInsiderActivity.T1(MoneyInsiderActivity.this, (ActivityResult) obj);
}
});
r.g(registerForActivityResult, "registerForActivityResult(...)");
this.R = registerForActivityResult;
this.T = new f();
this.Y = new e();
this.Z = new h();
this.f12670k0 = new g();
this.K0 = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
}
public static final void A1(MoneyInsiderActivity this$0, View view) {
r.h(this$0, "this$0");
if (!rt.e.b(this$0)) {
return;
}
this$0.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(this$0.H)));
}
public static final void B1(MoneyInsiderActivity this$0, View view) {
r.h(this$0, "this$0");
x1 x1Var = this$0.f12663c;
if (x1Var == null) {
r.z("binding");
x1Var = null;
}
x1Var.f22338id.M(0, 0);
}
public static final void C1(MoneyInsiderActivity this$0, View view) {
r.h(this$0, "this$0");
this$0.finish();
}
public static final void D1(MoneyInsiderActivity this$0, View view) {
r.h(this$0, "this$0");
androidx.activity.result.b<Intent> bVar = this$0.R;
Intent intent = new Intent(this$0, (Class<?>) ActivityWalletSwitcher.class);
ag.n nVar = this$0.f12664d;
ag.n nVar2 = null;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
if (nVar.p() != null) {
ag.n nVar3 = this$0.f12664d;
if (nVar3 == null) {
r.z("mViewModel");
} else {
nVar2 = nVar3;
}
com.zoostudio.moneylover.adapter.item.a p10 = nVar2.p();
r.e(p10);
intent.putExtra("EXTRA_WALLET_ID", p10.getId());
}
intent.putExtra("EXTRA_SOURCE", "MoneyInsiderActivity");
bVar.b(intent);
}
public static final void E1(final MoneyInsiderActivity this$0, View view) {
long longValue;
List z02;
int parseInt;
List z03;
int parseInt2;
r.h(this$0, "this$0");
Context baseContext = this$0.getBaseContext();
r.g(baseContext, "getBaseContext(...)");
HashMap hashMap = new HashMap();
hashMap.put("element", "select_time");
v vVar = v.f26314a;
qe.a.k(baseContext, "money_insider_customize_chart", hashMap);
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
DateValidatorPointBackward before = DateValidatorPointBackward.before(calendar.getTimeInMillis());
r.g(before, "before(...)");
ag.n nVar = this$0.f12664d;
ag.n nVar2 = null;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
if (nVar.j() == null) {
longValue = MaterialDatePicker.todayInUtcMilliseconds();
} else {
ag.n nVar3 = this$0.f12664d;
if (nVar3 == null) {
r.z("mViewModel");
nVar3 = null;
}
Long j10 = nVar3.j();
r.e(j10);
longValue = j10.longValue();
}
ag.n nVar4 = this$0.f12664d;
if (nVar4 == null) {
r.z("mViewModel");
nVar4 = null;
}
if (nVar4.r() != null) {
ag.n nVar5 = this$0.f12664d;
if (nVar5 == null) {
r.z("mViewModel");
nVar5 = null;
}
ng.f r10 = nVar5.r();
r.e(r10);
Integer a10 = r10.a();
if (a10 != null && a10.intValue() == 1) {
MaterialDatePicker<Long> build = MaterialDatePicker.Builder.datePicker().setCalendarConstraints(new CalendarConstraints.Builder().setValidator(before).build()).setTitleText(R.string.select_time).setSelection(Long.valueOf(longValue)).build();
r.g(build, "build(...)");
build.show(this$0.getSupportFragmentManager(), "datePicker");
final b bVar = new b();
build.addOnPositiveButtonClickListener(new MaterialPickerOnPositiveButtonClickListener() {
@Override
public final void onPositiveButtonClick(Object obj) {
MoneyInsiderActivity.F1(wn.l.this, obj);
}
});
return;
}
a.f fVar = new a.f() {
@Override
public final void a(int i10, int i11) {
MoneyInsiderActivity.G1(MoneyInsiderActivity.this, i10, i11);
}
};
ag.n nVar6 = this$0.f12664d;
if (nVar6 == null) {
r.z("mViewModel");
nVar6 = null;
}
if (nVar6.i() == null) {
parseInt = calendar.get(1);
} else {
ag.n nVar7 = this$0.f12664d;
if (nVar7 == null) {
r.z("mViewModel");
nVar7 = null;
}
String i10 = nVar7.i();
r.e(i10);
z02 = pq.v.z0(i10, new String[]{RemoteSettings.FORWARD_SLASH_STRING}, false, 0, 6, null);
parseInt = Integer.parseInt((String) z02.get(1));
}
ag.n nVar8 = this$0.f12664d;
if (nVar8 == null) {
r.z("mViewModel");
nVar8 = null;
}
if (nVar8.i() == null) {
parseInt2 = calendar.get(2);
} else {
ag.n nVar9 = this$0.f12664d;
if (nVar9 == null) {
r.z("mViewModel");
} else {
nVar2 = nVar9;
}
String i11 = nVar2.i();
r.e(i11);
z03 = pq.v.z0(i11, new String[]{RemoteSettings.FORWARD_SLASH_STRING}, false, 0, 6, null);
parseInt2 = Integer.parseInt((String) z03.get(0)) - 1;
}
new a.d(this$0, fVar, parseInt, parseInt2).a().show();
}
}
public static final void F1(wn.l tmp0, Object obj) {
r.h(tmp0, "$tmp0");
tmp0.invoke(obj);
}
public static final void G1(MoneyInsiderActivity this$0, int i10, int i11) {
r.h(this$0, "this$0");
ag.n nVar = this$0.f12664d;
ag.n nVar2 = null;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
StringBuilder sb2 = new StringBuilder();
sb2.append(i10 + 1);
sb2.append('/');
sb2.append(i11);
nVar.y(sb2.toString());
x1 x1Var = this$0.f12663c;
if (x1Var == null) {
r.z("binding");
x1Var = null;
}
x1Var.K1.f19550e.f20086f.setText(this$0.getString(R.string.money_insider_month));
x1 x1Var2 = this$0.f12663c;
if (x1Var2 == null) {
r.z("binding");
x1Var2 = null;
}
TextView textView = x1Var2.K1.f19550e.f20085e;
ag.n nVar3 = this$0.f12664d;
if (nVar3 == null) {
r.z("mViewModel");
nVar3 = null;
}
textView.setText(nVar3.i());
ag.n nVar4 = this$0.f12664d;
if (nVar4 == null) {
r.z("mViewModel");
nVar4 = null;
}
String i12 = nVar4.i();
if (i12 != null) {
ag.n nVar5 = this$0.f12664d;
if (nVar5 == null) {
r.z("mViewModel");
nVar5 = null;
}
ng.f r10 = nVar5.r();
r.e(r10);
Integer a10 = r10.a();
r.e(a10);
this$0.b2(a10.intValue(), i12);
ag.n nVar6 = this$0.f12664d;
if (nVar6 == null) {
r.z("mViewModel");
nVar6 = null;
}
ng.f r11 = nVar6.r();
r.e(r11);
Integer a11 = r11.a();
r.e(a11);
this$0.W1(a11.intValue(), i12);
ag.n nVar7 = this$0.f12664d;
if (nVar7 == null) {
r.z("mViewModel");
nVar7 = null;
}
ng.f r12 = nVar7.r();
r.e(r12);
Integer a12 = r12.a();
r.e(a12);
this$0.R1(a12.intValue(), i12);
ag.n nVar8 = this$0.f12664d;
if (nVar8 == null) {
r.z("mViewModel");
} else {
nVar2 = nVar8;
}
ng.f r13 = nVar2.r();
r.e(r13);
Integer a13 = r13.a();
r.e(a13);
this$0.Y1(a13.intValue(), i12);
}
}
public static final void H1(MoneyInsiderActivity this$0, View view) {
boolean z10;
boolean z11;
Object obj;
boolean z12;
ArrayList f10;
Integer a10;
Integer num;
boolean z13;
boolean z14;
r.h(this$0, "this$0");
String uuid = MoneyApplication.f11023j.o(this$0).getUUID();
ag.n nVar = this$0.f12664d;
ag.n nVar2 = null;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
com.zoostudio.moneylover.adapter.item.a p10 = nVar.p();
if (p10 != null && p10.isArchived()) {
z10 = true;
} else {
z10 = false;
}
if (!z10) {
ag.n nVar3 = this$0.f12664d;
if (nVar3 == null) {
r.z("mViewModel");
nVar3 = null;
}
com.zoostudio.moneylover.adapter.item.a p11 = nVar3.p();
if (p11 != null && !p11.isOwner(uuid)) {
z13 = true;
} else {
z13 = false;
}
if (!z13) {
ag.n nVar4 = this$0.f12664d;
if (nVar4 == null) {
r.z("mViewModel");
nVar4 = null;
}
com.zoostudio.moneylover.adapter.item.a p12 = nVar4.p();
if (p12 != null && p12.isGoalWallet()) {
z14 = true;
} else {
z14 = false;
}
}
}
ag.n nVar5 = this$0.f12664d;
if (nVar5 == null) {
r.z("mViewModel");
nVar5 = null;
}
com.zoostudio.moneylover.adapter.item.a p13 = nVar5.p();
if (p13 != null && p13.isTotalAccount()) {
z11 = true;
} else {
z11 = false;
}
if (!z11) {
this$0.g2();
return;
}
nc.a aVar = new nc.a();
ag.n nVar6 = this$0.f12664d;
if (nVar6 == null) {
r.z("mViewModel");
nVar6 = null;
}
if (nVar6.k() != null) {
ag.n nVar7 = this$0.f12664d;
if (nVar7 == null) {
r.z("mViewModel");
nVar7 = null;
}
nc.a k10 = nVar7.k();
r.e(k10);
Long m10 = k10.m();
if (m10 != null && m10.longValue() == 0) {
aVar.N(0L);
aVar.R(this$0.getResources().getString(R.string.budget_all_category));
aVar.M("ic_category_all");
} else {
ag.n nVar8 = this$0.f12664d;
if (nVar8 == null) {
r.z("mViewModel");
nVar8 = null;
}
aVar = nVar8.k();
r.e(aVar);
}
Iterator<T> it = this$0.f12671o.iterator();
while (true) {
if (it.hasNext()) {
obj = it.next();
Integer a11 = ((ng.f) obj).a();
ag.n nVar9 = this$0.f12664d;
if (nVar9 == null) {
r.z("mViewModel");
nVar9 = null;
}
ng.f r10 = nVar9.r();
if (r10 != null) {
num = r10.a();
} else {
num = null;
}
if (r.c(a11, num)) {
break;
}
} else {
obj = null;
break;
}
}
ng.f fVar = (ng.f) obj;
Intent intent = new Intent(this$0, (Class<?>) ActivityAddBudget.class);
ag.n nVar10 = this$0.f12664d;
if (nVar10 == null) {
r.z("mViewModel");
} else {
nVar2 = nVar10;
}
intent.putExtra("wallet", nVar2.p());
if (fVar != null && (a10 = fVar.a()) != null && a10.intValue() == 1) {
z12 = true;
} else {
z12 = false;
}
if (z12) {
intent.putExtra("budget_type", 1);
} else {
intent.putExtra("budget_type", 2);
}
intent.putExtra("START_DATE", rt.c.b(this$0.Q.c()));
intent.putExtra("END_DATE", rt.c.b(this$0.Q.d()));
f10 = ln.r.f(aVar);
intent.putExtra("label_item", f10);
this$0.startActivity(intent);
}
}
public static final void I1(MoneyInsiderActivity this$0, View view) {
r.h(this$0, "this$0");
Context baseContext = this$0.getBaseContext();
r.g(baseContext, "getBaseContext(...)");
HashMap hashMap = new HashMap();
hashMap.put("start_screen", "money_insider_screen_banner");
v vVar = v.f26314a;
qe.a.k(baseContext, "money_insider_show_money_insider_store", hashMap);
this$0.startActivity(new Intent(this$0, (Class<?>) MoneyInsiderStoreActivity.class));
}
public static final void J1(MoneyInsiderActivity this$0, View view) {
r.h(this$0, "this$0");
Context baseContext = this$0.getBaseContext();
r.g(baseContext, "getBaseContext(...)");
HashMap hashMap = new HashMap();
hashMap.put("start_screen", "money_insider_screen");
v vVar = v.f26314a;
qe.a.k(baseContext, "money_insider_show_money_insider_store", hashMap);
this$0.startActivity(new Intent(this$0, (Class<?>) MoneyInsiderStoreActivity.class));
}
public static final void K1(MoneyInsiderActivity this$0, View view) {
r.h(this$0, "this$0");
HashMap hashMap = new HashMap();
hashMap.put("element", "switch_type_chart");
v vVar = v.f26314a;
qe.a.k(this$0, "money_insider_customize_chart", hashMap);
ag.n nVar = this$0.f12664d;
ag.n nVar2 = null;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
Integer s10 = nVar.s();
if (s10 == null || s10.intValue() != 1) {
ag.n nVar3 = this$0.f12664d;
if (nVar3 == null) {
r.z("mViewModel");
nVar3 = null;
}
nVar3.D(1);
ag.n nVar4 = this$0.f12664d;
if (nVar4 == null) {
r.z("mViewModel");
nVar4 = null;
}
ng.f r10 = nVar4.r();
r.e(r10);
Integer a10 = r10.a();
r.e(a10);
int intValue = a10.intValue();
ag.n nVar5 = this$0.f12664d;
if (nVar5 == null) {
r.z("mViewModel");
} else {
nVar2 = nVar5;
}
String i10 = nVar2.i();
r.e(i10);
this$0.b2(intValue, i10);
}
}
public static final void L1(MoneyInsiderActivity this$0, View view) {
r.h(this$0, "this$0");
ag.n nVar = this$0.f12664d;
ag.n nVar2 = null;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
Integer s10 = nVar.s();
if (s10 == null || s10.intValue() != 2) {
ag.n nVar3 = this$0.f12664d;
if (nVar3 == null) {
r.z("mViewModel");
nVar3 = null;
}
nVar3.D(2);
ag.n nVar4 = this$0.f12664d;
if (nVar4 == null) {
r.z("mViewModel");
nVar4 = null;
}
ng.f r10 = nVar4.r();
r.e(r10);
Integer a10 = r10.a();
r.e(a10);
int intValue = a10.intValue();
ag.n nVar5 = this$0.f12664d;
if (nVar5 == null) {
r.z("mViewModel");
} else {
nVar2 = nVar5;
}
String i10 = nVar2.i();
r.e(i10);
this$0.b2(intValue, i10);
}
}
public final void M1() {
ag.n nVar = this.f12664d;
ag.n nVar2 = null;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
if (nVar.p() == null) {
ag.n nVar3 = this.f12664d;
if (nVar3 == null) {
r.z("mViewModel");
} else {
nVar2 = nVar3;
}
nVar2.B(m0.q(this));
Z1(false, false);
j2();
return;
}
ag.n nVar4 = this.f12664d;
if (nVar4 == null) {
r.z("mViewModel");
nVar4 = null;
}
if (nVar4.u()) {
ag.n nVar5 = this.f12664d;
if (nVar5 == null) {
r.z("mViewModel");
nVar5 = null;
}
if (nVar5.v()) {
Z1(true, false);
ag.n nVar6 = this.f12664d;
if (nVar6 == null) {
r.z("mViewModel");
nVar6 = null;
}
nVar6.E(false);
ag.n nVar7 = this.f12664d;
if (nVar7 == null) {
r.z("mViewModel");
} else {
nVar2 = nVar7;
}
nVar2.F(false);
j2();
return;
}
}
ag.n nVar8 = this.f12664d;
if (nVar8 == null) {
r.z("mViewModel");
nVar8 = null;
}
if (nVar8.t()) {
ag.n nVar9 = this.f12664d;
if (nVar9 == null) {
r.z("mViewModel");
nVar9 = null;
}
Z1(false, nVar9.t());
ag.n nVar10 = this.f12664d;
if (nVar10 == null) {
r.z("mViewModel");
} else {
nVar2 = nVar10;
}
nVar2.w(false);
j2();
return;
}
Z1(false, false);
j2();
}
public final void N1() {
this.M = 2;
ag.n nVar = this.f12664d;
ag.n nVar2 = null;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
if (nVar.i() == null) {
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
r.g(calendar, "getInstance(...)");
if (zi.f.a().Z() > calendar.get(5)) {
calendar.add(2, -1);
}
int i10 = calendar.get(2) + 1;
int i11 = calendar.get(1);
ag.n nVar3 = this.f12664d;
if (nVar3 == null) {
r.z("mViewModel");
nVar3 = null;
}
StringBuilder sb2 = new StringBuilder();
sb2.append(i10);
sb2.append('/');
sb2.append(i11);
nVar3.y(sb2.toString());
}
x1 x1Var = this.f12663c;
if (x1Var == null) {
r.z("binding");
x1Var = null;
}
x1Var.K1.f19550e.f20086f.setText(getString(R.string.money_insider_month));
x1 x1Var2 = this.f12663c;
if (x1Var2 == null) {
r.z("binding");
x1Var2 = null;
}
TextView textView = x1Var2.K1.f19550e.f20085e;
ag.n nVar4 = this.f12664d;
if (nVar4 == null) {
r.z("mViewModel");
} else {
nVar2 = nVar4;
}
textView.setText(nVar2.i());
}
public final void O1() {
this.M = 1;
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
r.g(calendar, "getInstance(...)");
if (zi.f.a().Z() > calendar.get(5)) {
calendar.add(2, -1);
}
long time = new Date(rt.c.m(zi.f.a().a0(), calendar.getTime().getTime())).getTime();
long time2 = new Date(rt.c.d(zi.f.a().a0(), calendar.getTime().getTime())).getTime();
ag.n nVar = this.f12664d;
x1 x1Var = null;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
if (nVar.i() == null) {
ag.n nVar2 = this.f12664d;
if (nVar2 == null) {
r.z("mViewModel");
nVar2 = null;
}
nVar2.y(y1(zi.f.a().a0(), time, time2));
}
x1 x1Var2 = this.f12663c;
if (x1Var2 == null) {
r.z("binding");
x1Var2 = null;
}
x1Var2.K1.f19550e.f20086f.setText(getString(R.string.money_insider_week));
x1 x1Var3 = this.f12663c;
if (x1Var3 == null) {
r.z("binding");
} else {
x1Var = x1Var3;
}
x1Var.K1.f19550e.f20085e.setText(x1(zi.f.a().a0(), time, time2));
}
private final void P1() {
x1 F = x1.F(getLayoutInflater());
r.g(F, "inflate(...)");
this.f12663c = F;
if (F == null) {
r.z("binding");
F = null;
}
setContentView(F.getRoot());
}
private final void Q1(int i10, e0 e0Var, ng.d dVar) {
ag.n nVar;
j0 j0Var = new j0();
j0Var.f26370a = "";
j0 j0Var2 = new j0();
j0Var2.f26370a = "";
j0 j0Var3 = new j0();
j0Var3.f26370a = "";
if (i10 == 1) {
?? string = getString(R.string.higher_than_last_week);
r.g(string, "getString(...)");
j0Var.f26370a = string;
?? string2 = getString(R.string.lower_than_last_week);
r.g(string2, "getString(...)");
j0Var2.f26370a = string2;
?? string3 = getString(R.string.equals_last_week);
r.g(string3, "getString(...)");
j0Var3.f26370a = string3;
} else {
?? string4 = getString(R.string.higher_than_last_month);
r.g(string4, "getString(...)");
j0Var.f26370a = string4;
?? string5 = getString(R.string.lower_than_last_month);
r.g(string5, "getString(...)");
j0Var2.f26370a = string5;
?? string6 = getString(R.string.equals_last_month);
r.g(string6, "getString(...)");
j0Var3.f26370a = string6;
}
ArrayList<ng.d> v12 = v1(dVar, i10);
if (!this.L) {
v12.get(1).f(this.f12673q.format(this.K0.getTime()));
}
ag.n nVar2 = this.f12664d;
ag.n nVar3 = null;
if (nVar2 == null) {
r.z("mViewModel");
nVar = null;
} else {
nVar = nVar2;
}
ag.n nVar4 = this.f12664d;
if (nVar4 == null) {
r.z("mViewModel");
nVar4 = null;
}
com.zoostudio.moneylover.adapter.item.a p10 = nVar4.p();
r.e(p10);
ag.n nVar5 = this.f12664d;
if (nVar5 == null) {
r.z("mViewModel");
} else {
nVar3 = nVar5;
}
nc.a k10 = nVar3.k();
r.e(k10);
Long m10 = k10.m();
r.e(m10);
nVar.q(this, p10, m10.longValue(), new ng.d(v12.get(0).c(), v12.get(0).d()), new c(e0Var, v12, j0Var, j0Var3, j0Var2));
}
public final void R1(int i10, String str) {
ng.d w12 = w1(i10, str);
if (!this.L) {
w12.f(this.f12673q.format(Long.valueOf(System.currentTimeMillis())));
}
ag.n nVar = this.f12664d;
ag.n nVar2 = null;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
ag.n nVar3 = this.f12664d;
if (nVar3 == null) {
r.z("mViewModel");
nVar3 = null;
}
com.zoostudio.moneylover.adapter.item.a p10 = nVar3.p();
r.e(p10);
ag.n nVar4 = this.f12664d;
if (nVar4 == null) {
r.z("mViewModel");
} else {
nVar2 = nVar4;
}
nc.a k10 = nVar2.k();
r.e(k10);
Long m10 = k10.m();
r.e(m10);
nVar.q(this, p10, m10.longValue(), w12, new d(w12, i10, str));
}
public final void S1(mc.b bVar) {
l9.b bVar2;
l9.b bVar3;
p1(bVar);
Double c10 = bVar.c();
x1 x1Var = null;
if (c10 != null) {
double doubleValue = c10.doubleValue();
x1 x1Var2 = this.f12663c;
if (x1Var2 == null) {
r.z("binding");
x1Var2 = null;
}
AmountColorTextView amountColorTextView = x1Var2.f22342th.f20894g;
ag.n nVar = this.f12664d;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
com.zoostudio.moneylover.adapter.item.a p10 = nVar.p();
if (p10 != null) {
bVar3 = p10.getCurrency();
} else {
bVar3 = null;
}
amountColorTextView.d(doubleValue, bVar3);
}
x1 x1Var3 = this.f12663c;
if (x1Var3 == null) {
r.z("binding");
x1Var3 = null;
}
AmountColorTextView amountColorTextView2 = x1Var3.f22342th.f20896j;
double p11 = bVar.p();
ag.n nVar2 = this.f12664d;
if (nVar2 == null) {
r.z("mViewModel");
nVar2 = null;
}
com.zoostudio.moneylover.adapter.item.a p12 = nVar2.p();
if (p12 != null) {
bVar2 = p12.getCurrency();
} else {
bVar2 = null;
}
amountColorTextView2.d(p11, bVar2);
if (!ab.a.r(bVar)) {
x1 x1Var4 = this.f12663c;
if (x1Var4 == null) {
r.z("binding");
x1Var4 = null;
}
x1Var4.f22342th.f20897o.setText(getString(R.string.safe));
x1 x1Var5 = this.f12663c;
if (x1Var5 == null) {
r.z("binding");
} else {
x1Var = x1Var5;
}
x1Var.f22342th.f20897o.setTextColor(getColor(R.color.p_500));
return;
}
double p13 = bVar.p();
Double c11 = bVar.c();
r.e(c11);
double doubleValue2 = p13 - c11.doubleValue();
Double c12 = bVar.c();
r.e(c12);
int rint = (int) Math.rint(Math.abs(doubleValue2 / c12.doubleValue()) * 100);
x1 x1Var6 = this.f12663c;
if (x1Var6 == null) {
r.z("binding");
x1Var6 = null;
}
x1Var6.f22342th.f20897o.setText(getString(R.string.money_insider_over, Integer.valueOf(rint)));
x1 x1Var7 = this.f12663c;
if (x1Var7 == null) {
r.z("binding");
} else {
x1Var = x1Var7;
}
x1Var.f22342th.f20897o.setTextColor(getColor(R.color.r_500));
}
public static final void T1(MoneyInsiderActivity this$0, ActivityResult activityResult) {
r.h(this$0, "this$0");
if (activityResult.b() == -1) {
try {
Intent a10 = activityResult.a();
r.e(a10);
Serializable serializableExtra = a10.getSerializableExtra("EXTRA_SELECTED_ACCOUNT_ITEM");
r.f(serializableExtra, "null cannot be cast to non-null type com.zoostudio.moneylover.adapter.item.AccountItem");
com.zoostudio.moneylover.adapter.item.a aVar = (com.zoostudio.moneylover.adapter.item.a) serializableExtra;
ag.n nVar = this$0.f12664d;
ag.n nVar2 = null;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
if (aVar.getName() == null) {
aVar = m0.q(this$0);
}
nVar.B(aVar);
ag.n nVar3 = this$0.f12664d;
if (nVar3 == null) {
r.z("mViewModel");
} else {
nVar2 = nVar3;
}
nVar2.F(true);
} catch (Exception e10) {
e10.printStackTrace();
}
}
}
private final void U1() {
x1 x1Var = this.f12663c;
x1 x1Var2 = null;
if (x1Var == null) {
r.z("binding");
x1Var = null;
}
x1Var.K1.f19551f.setBackgroundResource(R.drawable.bg_dot__money_insider_check);
x1 x1Var3 = this.f12663c;
if (x1Var3 == null) {
r.z("binding");
x1Var3 = null;
}
x1Var3.K1.f19552g.setBackgroundResource(R.drawable.bg_dot__money_insider_uncheck);
x1 x1Var4 = this.f12663c;
if (x1Var4 == null) {
r.z("binding");
} else {
x1Var2 = x1Var4;
}
x1Var2.K1.C.setText(getString(R.string.expense_chart));
}
private final void V1() {
x1 x1Var = this.f12663c;
x1 x1Var2 = null;
if (x1Var == null) {
r.z("binding");
x1Var = null;
}
x1Var.K1.f19551f.setBackgroundResource(R.drawable.bg_dot__money_insider_uncheck);
x1 x1Var3 = this.f12663c;
if (x1Var3 == null) {
r.z("binding");
x1Var3 = null;
}
x1Var3.K1.f19552g.setBackgroundResource(R.drawable.bg_dot__money_insider_check);
x1 x1Var4 = this.f12663c;
if (x1Var4 == null) {
r.z("binding");
} else {
x1Var2 = x1Var4;
}
x1Var2.K1.C.setText(getString(R.string.compared_to_income));
}
public final void W1(int i10, String str) {
ag.n nVar;
w1(i10, str);
ag.n nVar2 = this.f12664d;
ag.n nVar3 = null;
if (nVar2 == null) {
r.z("mViewModel");
nVar = null;
} else {
nVar = nVar2;
}
ag.n nVar4 = this.f12664d;
if (nVar4 == null) {
r.z("mViewModel");
nVar4 = null;
}
com.zoostudio.moneylover.adapter.item.a p10 = nVar4.p();
r.e(p10);
ag.n nVar5 = this.f12664d;
if (nVar5 == null) {
r.z("mViewModel");
} else {
nVar3 = nVar5;
}
nc.a k10 = nVar3.k();
r.e(k10);
Long m10 = k10.m();
r.e(m10);
nVar.g(this, p10, m10.longValue(), this.Q, new i());
}
public final void X1(int i10, ng.d dVar, e0 e0Var) {
String string;
double totalExpense;
double totalExpense2;
float t12;
String S = zi.f.a().S();
x1 x1Var = this.f12663c;
x1 x1Var2 = null;
if (x1Var == null) {
r.z("binding");
x1Var = null;
}
TextView textView = x1Var.V1.H;
Object[] objArr = new Object[2];
objArr[0] = d1.H(rt.c.z(dVar.c()), S);
if (this.L) {
string = d1.H(rt.c.z(dVar.d()), S);
} else {
string = getString(R.string.today);
}
objArr[1] = string;
textView.setText(getString(R.string.trend_criteria_collapsed_time, objArr));
x1 x1Var3 = this.f12663c;
if (x1Var3 == null) {
r.z("binding");
x1Var3 = null;
}
TextView textView2 = x1Var3.V1.L;
Object[] objArr2 = new Object[1];
ag.n nVar = this.f12664d;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
nc.a k10 = nVar.k();
r.e(k10);
String r10 = k10.r();
r.e(r10);
objArr2[0] = r10;
textView2.setText(getString(R.string.average_transaction, objArr2));
x1 x1Var4 = this.f12663c;
if (x1Var4 == null) {
r.z("binding");
x1Var4 = null;
}
x1Var4.V1.R.setText(String.valueOf(e0Var.getCountTransactionExpense()));
if (e0Var.getCountTransactionExpense() == 0) {
totalExpense = 0.0d;
} else {
totalExpense = e0Var.getTotalExpense() / e0Var.getCountTransactionExpense();
}
x1 x1Var5 = this.f12663c;
if (x1Var5 == null) {
r.z("binding");
x1Var5 = null;
}
AmountColorTextView amountColorTextView = x1Var5.V1.f20768o;
ag.n nVar2 = this.f12664d;
if (nVar2 == null) {
r.z("mViewModel");
nVar2 = null;
}
com.zoostudio.moneylover.adapter.item.a p10 = nVar2.p();
r.e(p10);
amountColorTextView.d(totalExpense, p10.getCurrency());
if (this.L) {
totalExpense2 = e0Var.getTotalExpense();
t12 = s1(dVar);
} else {
totalExpense2 = e0Var.getTotalExpense();
t12 = t1(dVar);
}
double d10 = totalExpense2 / t12;
x1 x1Var6 = this.f12663c;
if (x1Var6 == null) {
r.z("binding");
x1Var6 = null;
}
AmountColorTextView amountColorTextView2 = x1Var6.V1.f20767j;
ag.n nVar3 = this.f12664d;
if (nVar3 == null) {
r.z("mViewModel");
nVar3 = null;
}
com.zoostudio.moneylover.adapter.item.a p11 = nVar3.p();
r.e(p11);
amountColorTextView2.d(d10, p11.getCurrency());
x1 x1Var7 = this.f12663c;
if (x1Var7 == null) {
r.z("binding");
x1Var7 = null;
}
x1Var7.V1.f20769p.setText('/' + getString(R.string.day));
if (i10 == 1) {
x1 x1Var8 = this.f12663c;
if (x1Var8 == null) {
r.z("binding");
x1Var8 = null;
}
TextView textView3 = x1Var8.V1.L;
Object[] objArr3 = new Object[1];
ag.n nVar4 = this.f12664d;
if (nVar4 == null) {
r.z("mViewModel");
nVar4 = null;
}
nc.a k11 = nVar4.k();
r.e(k11);
String r11 = k11.r();
r.e(r11);
objArr3[0] = r11;
textView3.setText(getString(R.string.average_transaction, objArr3));
x1 x1Var9 = this.f12663c;
if (x1Var9 == null) {
r.z("binding");
} else {
x1Var2 = x1Var9;
}
x1Var2.V1.M.setText(getString(R.string.average_expenses_this_week));
} else {
x1 x1Var10 = this.f12663c;
if (x1Var10 == null) {
r.z("binding");
x1Var10 = null;
}
TextView textView4 = x1Var10.V1.L;
Object[] objArr4 = new Object[1];
ag.n nVar5 = this.f12664d;
if (nVar5 == null) {
r.z("mViewModel");
nVar5 = null;
}
nc.a k12 = nVar5.k();
r.e(k12);
String r12 = k12.r();
r.e(r12);
objArr4[0] = r12;
textView4.setText(getString(R.string.average_transaction, objArr4));
x1 x1Var11 = this.f12663c;
if (x1Var11 == null) {
r.z("binding");
} else {
x1Var2 = x1Var11;
}
x1Var2.V1.M.setText(getString(R.string.average_expenses_this_month));
}
Q1(i10, e0Var, dVar);
}
public final void Y1(int i10, String str) {
ng.d w12 = w1(i10, str);
if (!this.L) {
w12.f(this.f12673q.format(Long.valueOf(System.currentTimeMillis())));
}
ag.n nVar = this.f12664d;
ag.n nVar2 = null;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
ag.n nVar3 = this.f12664d;
if (nVar3 == null) {
r.z("mViewModel");
nVar3 = null;
}
com.zoostudio.moneylover.adapter.item.a p10 = nVar3.p();
r.e(p10);
ag.n nVar4 = this.f12664d;
if (nVar4 == null) {
r.z("mViewModel");
} else {
nVar2 = nVar4;
}
nc.a k10 = nVar2.k();
r.e(k10);
Long m10 = k10.m();
r.e(m10);
nVar.o(this, p10, m10, 2, w12, 5, new j());
}
public final void Z1(boolean z10, boolean z11) {
ag.n nVar;
Object obj;
Long l10;
ag.n nVar2 = this.f12664d;
ag.n nVar3 = null;
if (nVar2 == null) {
r.z("mViewModel");
nVar2 = null;
}
this.f12666f = new gg.b(this, nVar2.l(), new k());
x1 x1Var = this.f12663c;
if (x1Var == null) {
r.z("binding");
x1Var = null;
}
RecyclerView recyclerView = x1Var.K1.f19557q;
gg.b bVar = this.f12666f;
if (bVar == null) {
r.z("adapterTabLabel");
bVar = null;
}
recyclerView.setAdapter(bVar);
if (z11) {
ag.n nVar4 = this.f12664d;
if (nVar4 == null) {
r.z("mViewModel");
nVar4 = null;
}
Iterator<T> it = nVar4.l().iterator();
while (true) {
if (it.hasNext()) {
obj = it.next();
Long m10 = ((nc.a) obj).m();
ag.n nVar5 = this.f12664d;
if (nVar5 == null) {
r.z("mViewModel");
nVar5 = null;
}
nc.a k10 = nVar5.k();
if (k10 != null) {
l10 = k10.m();
} else {
l10 = null;
}
if (r.c(m10, l10)) {
break;
}
} else {
obj = null;
break;
}
}
nc.a aVar = (nc.a) obj;
if (aVar != null) {
aVar.V(true);
}
gg.b bVar2 = this.f12666f;
if (bVar2 == null) {
r.z("adapterTabLabel");
bVar2 = null;
}
ag.n nVar6 = this.f12664d;
if (nVar6 == null) {
r.z("mViewModel");
nVar6 = null;
}
bVar2.k(nVar6.l());
a2();
ag.n nVar7 = this.f12664d;
if (nVar7 == null) {
r.z("mViewModel");
} else {
nVar3 = nVar7;
}
if (nVar3.l().size() <= 2) {
h2();
return;
}
return;
}
ag.n nVar8 = this.f12664d;
if (nVar8 == null) {
r.z("mViewModel");
nVar8 = null;
}
nVar8.l().clear();
ag.n nVar9 = this.f12664d;
if (nVar9 == null) {
r.z("mViewModel");
nVar = null;
} else {
nVar = nVar9;
}
ag.n nVar10 = this.f12664d;
if (nVar10 == null) {
r.z("mViewModel");
} else {
nVar3 = nVar10;
}
com.zoostudio.moneylover.adapter.item.a p10 = nVar3.p();
r.e(p10);
nVar.n(this, p10, 2, null, 3, new l(z10));
}
public final void a2() {
Object obj;
Integer a10;
Integer num;
String[] stringArray = getResources().getStringArray(R.array.cashbook_set_timerange_items);
r.g(stringArray, "getStringArray(...)");
this.f12671o.clear();
ArrayList<ng.f> arrayList = this.f12671o;
String str = stringArray[1];
Boolean bool = Boolean.FALSE;
arrayList.add(new ng.f(1, str, bool));
arrayList.add(new ng.f(2, stringArray[2], bool));
ag.n nVar = this.f12664d;
fg.b bVar = null;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
if (nVar.r() == null) {
ag.n nVar2 = this.f12664d;
if (nVar2 == null) {
r.z("mViewModel");
nVar2 = null;
}
nVar2.C(new ng.f(2, stringArray[2], bool));
}
Iterator<T> it = this.f12671o.iterator();
while (true) {
if (it.hasNext()) {
obj = it.next();
Integer a11 = ((ng.f) obj).a();
ag.n nVar3 = this.f12664d;
if (nVar3 == null) {
r.z("mViewModel");
nVar3 = null;
}
ng.f r10 = nVar3.r();
if (r10 != null) {
num = r10.a();
} else {
num = null;
}
if (r.c(a11, num)) {
break;
}
} else {
obj = null;
break;
}
}
ng.f fVar = (ng.f) obj;
if (fVar != null) {
fVar.d(Boolean.TRUE);
}
if (fVar != null) {
Integer a12 = fVar.a();
if (a12 != null && a12.intValue() == 1) {
Context baseContext = getBaseContext();
r.g(baseContext, "getBaseContext(...)");
HashMap hashMap = new HashMap();
hashMap.put("time_range", "week");
v vVar = v.f26314a;
qe.a.k(baseContext, "money_insider_customize_chart", hashMap);
x1 x1Var = this.f12663c;
if (x1Var == null) {
r.z("binding");
x1Var = null;
}
x1Var.f22344uk.f21397d.setText(getString(R.string.top_expenses_of_the_week));
O1();
} else {
Context baseContext2 = getBaseContext();
r.g(baseContext2, "getBaseContext(...)");
HashMap hashMap2 = new HashMap();
hashMap2.put("time_range", "week");
v vVar2 = v.f26314a;
qe.a.k(baseContext2, "money_insider_customize_chart", hashMap2);
x1 x1Var2 = this.f12663c;
if (x1Var2 == null) {
r.z("binding");
x1Var2 = null;
}
x1Var2.f22344uk.f21397d.setText(getString(R.string.top_expenses_of_the_month));
N1();
}
ag.n nVar4 = this.f12664d;
if (nVar4 == null) {
r.z("mViewModel");
nVar4 = null;
}
String i10 = nVar4.i();
if (i10 != null && (a10 = fVar.a()) != null) {
int intValue = a10.intValue();
b2(intValue, i10);
W1(intValue, i10);
R1(intValue, i10);
Y1(intValue, i10);
}
}
this.f12665e = new fg.b(this.f12671o, new m());
x1 x1Var3 = this.f12663c;
if (x1Var3 == null) {
r.z("binding");
x1Var3 = null;
}
RecyclerView recyclerView = x1Var3.K1.B;
fg.b bVar2 = this.f12665e;
if (bVar2 == null) {
r.z("adapterSwitcher");
bVar2 = null;
}
recyclerView.setAdapter(bVar2);
recyclerView.setLayoutManager(new GridLayoutManager((Context) this, 2, 1, false));
fg.b bVar3 = this.f12665e;
if (bVar3 == null) {
r.z("adapterSwitcher");
} else {
bVar = bVar3;
}
bVar.k(this.f12671o);
}
public final void b2(int i10, String str) {
w1(i10, str);
ag.n nVar = this.f12664d;
ag.n nVar2 = null;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
if (nVar.s() == null) {
ag.n nVar3 = this.f12664d;
if (nVar3 == null) {
r.z("mViewModel");
nVar3 = null;
}
nVar3.D(1);
}
ag.n nVar4 = this.f12664d;
if (nVar4 == null) {
r.z("mViewModel");
nVar4 = null;
}
Integer s10 = nVar4.s();
if (s10 != null && s10.intValue() == 1) {
U1();
} else {
V1();
}
ag.n nVar5 = this.f12664d;
if (nVar5 == null) {
r.z("mViewModel");
} else {
nVar2 = nVar5;
}
Integer s11 = nVar2.s();
r.e(s11);
f2(i10, s11.intValue(), str, this.L);
}
private final void c2() {
x1 x1Var = this.f12663c;
x1 x1Var2 = null;
if (x1Var == null) {
r.z("binding");
x1Var = null;
}
RelativeLayout root = x1Var.K0.getRoot();
r.g(root, "getRoot(...)");
el.d.d(root);
x1 x1Var3 = this.f12663c;
if (x1Var3 == null) {
r.z("binding");
x1Var3 = null;
}
ConstraintLayout root2 = x1Var3.K3.getRoot();
r.g(root2, "getRoot(...)");
el.d.k(root2);
x1 x1Var4 = this.f12663c;
if (x1Var4 == null) {
r.z("binding");
x1Var4 = null;
}
ImageView layoutChartFree = x1Var4.K1.f19553i;
r.g(layoutChartFree, "layoutChartFree");
el.d.k(layoutChartFree);
x1 x1Var5 = this.f12663c;
if (x1Var5 == null) {
r.z("binding");
x1Var5 = null;
}
LinearLayout layoutChartSubscribed = x1Var5.K1.f19554j;
r.g(layoutChartSubscribed, "layoutChartSubscribed");
el.d.d(layoutChartSubscribed);
x1 x1Var6 = this.f12663c;
if (x1Var6 == null) {
r.z("binding");
x1Var6 = null;
}
ConstraintLayout layoutTitle = x1Var6.K1.f19556p;
r.g(layoutTitle, "layoutTitle");
el.d.d(layoutTitle);
x1 x1Var7 = this.f12663c;
if (x1Var7 == null) {
r.z("binding");
x1Var7 = null;
}
LinearLayout layoutDot = x1Var7.K1.f19555o;
r.g(layoutDot, "layoutDot");
el.d.d(layoutDot);
x1 x1Var8 = this.f12663c;
if (x1Var8 == null) {
r.z("binding");
x1Var8 = null;
}
TextView txtTitle = x1Var8.f22341me.f20380g;
r.g(txtTitle, "txtTitle");
el.d.d(txtTitle);
x1 x1Var9 = this.f12663c;
if (x1Var9 == null) {
r.z("binding");
x1Var9 = null;
}
AmountColorTextView txtSpending = x1Var9.f22341me.f20379f;
r.g(txtSpending, "txtSpending");
el.d.d(txtSpending);
x1 x1Var10 = this.f12663c;
if (x1Var10 == null) {
r.z("binding");
x1Var10 = null;
}
TextView txtDes = x1Var10.f22341me.f20378e;
r.g(txtDes, "txtDes");
el.d.d(txtDes);
x1 x1Var11 = this.f12663c;
if (x1Var11 == null) {
r.z("binding");
x1Var11 = null;
}
ImageView layoutFree = x1Var11.f22341me.f20377d;
r.g(layoutFree, "layoutFree");
el.d.k(layoutFree);
x1 x1Var12 = this.f12663c;
if (x1Var12 == null) {
r.z("binding");
x1Var12 = null;
}
ImageView layoutFree2 = x1Var12.V1.f20763e;
r.g(layoutFree2, "layoutFree");
el.d.k(layoutFree2);
x1 x1Var13 = this.f12663c;
if (x1Var13 == null) {
r.z("binding");
} else {
x1Var2 = x1Var13;
}
ConstraintLayout layoutSubscribed = x1Var2.V1.f20765g;
r.g(layoutSubscribed, "layoutSubscribed");
el.d.d(layoutSubscribed);
}
private final void d2() {
x1 x1Var = this.f12663c;
x1 x1Var2 = null;
if (x1Var == null) {
r.z("binding");
x1Var = null;
}
RelativeLayout root = x1Var.K0.getRoot();
r.g(root, "getRoot(...)");
el.d.k(root);
x1 x1Var3 = this.f12663c;
if (x1Var3 == null) {
r.z("binding");
x1Var3 = null;
}
ConstraintLayout root2 = x1Var3.K3.getRoot();
r.g(root2, "getRoot(...)");
el.d.k(root2);
x1 x1Var4 = this.f12663c;
if (x1Var4 == null) {
r.z("binding");
x1Var4 = null;
}
ImageView layoutChartFree = x1Var4.K1.f19553i;
r.g(layoutChartFree, "layoutChartFree");
el.d.k(layoutChartFree);
x1 x1Var5 = this.f12663c;
if (x1Var5 == null) {
r.z("binding");
x1Var5 = null;
}
LinearLayout layoutChartSubscribed = x1Var5.K1.f19554j;
r.g(layoutChartSubscribed, "layoutChartSubscribed");
el.d.d(layoutChartSubscribed);
x1 x1Var6 = this.f12663c;
if (x1Var6 == null) {
r.z("binding");
x1Var6 = null;
}
ConstraintLayout layoutTitle = x1Var6.K1.f19556p;
r.g(layoutTitle, "layoutTitle");
el.d.d(layoutTitle);
x1 x1Var7 = this.f12663c;
if (x1Var7 == null) {
r.z("binding");
x1Var7 = null;
}
LinearLayout layoutDot = x1Var7.K1.f19555o;
r.g(layoutDot, "layoutDot");
el.d.d(layoutDot);
x1 x1Var8 = this.f12663c;
if (x1Var8 == null) {
r.z("binding");
x1Var8 = null;
}
TextView txtTitle = x1Var8.f22341me.f20380g;
r.g(txtTitle, "txtTitle");
el.d.d(txtTitle);
x1 x1Var9 = this.f12663c;
if (x1Var9 == null) {
r.z("binding");
x1Var9 = null;
}
AmountColorTextView txtSpending = x1Var9.f22341me.f20379f;
r.g(txtSpending, "txtSpending");
el.d.d(txtSpending);
x1 x1Var10 = this.f12663c;
if (x1Var10 == null) {
r.z("binding");
x1Var10 = null;
}
TextView txtDes = x1Var10.f22341me.f20378e;
r.g(txtDes, "txtDes");
el.d.d(txtDes);
x1 x1Var11 = this.f12663c;
if (x1Var11 == null) {
r.z("binding");
x1Var11 = null;
}
ImageView layoutFree = x1Var11.f22341me.f20377d;
r.g(layoutFree, "layoutFree");
el.d.k(layoutFree);
x1 x1Var12 = this.f12663c;
if (x1Var12 == null) {
r.z("binding");
x1Var12 = null;
}
ImageView layoutFree2 = x1Var12.V1.f20763e;
r.g(layoutFree2, "layoutFree");
el.d.k(layoutFree2);
x1 x1Var13 = this.f12663c;
if (x1Var13 == null) {
r.z("binding");
} else {
x1Var2 = x1Var13;
}
ConstraintLayout layoutSubscribed = x1Var2.V1.f20765g;
r.g(layoutSubscribed, "layoutSubscribed");
el.d.d(layoutSubscribed);
}
private final void e2() {
x1 x1Var = this.f12663c;
x1 x1Var2 = null;
if (x1Var == null) {
r.z("binding");
x1Var = null;
}
RelativeLayout root = x1Var.K0.getRoot();
r.g(root, "getRoot(...)");
el.d.d(root);
x1 x1Var3 = this.f12663c;
if (x1Var3 == null) {
r.z("binding");
x1Var3 = null;
}
ConstraintLayout root2 = x1Var3.K3.getRoot();
r.g(root2, "getRoot(...)");
el.d.d(root2);
x1 x1Var4 = this.f12663c;
if (x1Var4 == null) {
r.z("binding");
x1Var4 = null;
}
ImageView layoutChartFree = x1Var4.K1.f19553i;
r.g(layoutChartFree, "layoutChartFree");
el.d.d(layoutChartFree);
x1 x1Var5 = this.f12663c;
if (x1Var5 == null) {
r.z("binding");
x1Var5 = null;
}
LinearLayout layoutChartSubscribed = x1Var5.K1.f19554j;
r.g(layoutChartSubscribed, "layoutChartSubscribed");
el.d.k(layoutChartSubscribed);
x1 x1Var6 = this.f12663c;
if (x1Var6 == null) {
r.z("binding");
x1Var6 = null;
}
ConstraintLayout layoutTitle = x1Var6.K1.f19556p;
r.g(layoutTitle, "layoutTitle");
el.d.k(layoutTitle);
x1 x1Var7 = this.f12663c;
if (x1Var7 == null) {
r.z("binding");
x1Var7 = null;
}
LinearLayout layoutDot = x1Var7.K1.f19555o;
r.g(layoutDot, "layoutDot");
el.d.k(layoutDot);
x1 x1Var8 = this.f12663c;
if (x1Var8 == null) {
r.z("binding");
x1Var8 = null;
}
TextView txtTitle = x1Var8.f22341me.f20380g;
r.g(txtTitle, "txtTitle");
el.d.k(txtTitle);
x1 x1Var9 = this.f12663c;
if (x1Var9 == null) {
r.z("binding");
x1Var9 = null;
}
AmountColorTextView txtSpending = x1Var9.f22341me.f20379f;
r.g(txtSpending, "txtSpending");
el.d.k(txtSpending);
x1 x1Var10 = this.f12663c;
if (x1Var10 == null) {
r.z("binding");
x1Var10 = null;
}
TextView txtDes = x1Var10.f22341me.f20378e;
r.g(txtDes, "txtDes");
el.d.k(txtDes);
x1 x1Var11 = this.f12663c;
if (x1Var11 == null) {
r.z("binding");
x1Var11 = null;
}
ImageView layoutFree = x1Var11.f22341me.f20377d;
r.g(layoutFree, "layoutFree");
el.d.d(layoutFree);
x1 x1Var12 = this.f12663c;
if (x1Var12 == null) {
r.z("binding");
x1Var12 = null;
}
ImageView layoutFree2 = x1Var12.V1.f20763e;
r.g(layoutFree2, "layoutFree");
el.d.d(layoutFree2);
x1 x1Var13 = this.f12663c;
if (x1Var13 == null) {
r.z("binding");
} else {
x1Var2 = x1Var13;
}
ConstraintLayout layoutSubscribed = x1Var2.V1.f20765g;
r.g(layoutSubscribed, "layoutSubscribed");
el.d.k(layoutSubscribed);
}
private final void f2(int i10, int i11, String str, boolean z10) {
x1 x1Var = this.f12663c;
x1 x1Var2 = null;
if (x1Var == null) {
r.z("binding");
x1Var = null;
}
x1Var.K1.H.requestDisallowInterceptTouchEvent(true);
FragmentManager supportFragmentManager = getSupportFragmentManager();
r.g(supportFragmentManager, "getSupportFragmentManager(...)");
this.f12667g = new ig.a(supportFragmentManager);
x1 x1Var3 = this.f12663c;
if (x1Var3 == null) {
r.z("binding");
x1Var3 = null;
}
WrapContentViewPager wrapContentViewPager = x1Var3.K1.H;
ig.a aVar = this.f12667g;
if (aVar == null) {
r.z("adapterViewPager");
aVar = null;
}
wrapContentViewPager.setAdapter(aVar);
x1 x1Var4 = this.f12663c;
if (x1Var4 == null) {
r.z("binding");
x1Var4 = null;
}
x1Var4.K1.H.setOffscreenPageLimit(2);
ig.a aVar2 = this.f12667g;
if (aVar2 == null) {
r.z("adapterViewPager");
aVar2 = null;
}
aVar2.v();
for (ng.f fVar : this.f12671o) {
Integer a10 = fVar.a();
if (a10 != null && a10.intValue() == i10) {
a.C0223a c0223a = com.zoostudio.moneylover.main.moneyInsider.a.f12700p;
Integer a11 = fVar.a();
r.e(a11);
int intValue = a11.intValue();
ag.n nVar = this.f12664d;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
com.zoostudio.moneylover.adapter.item.a p10 = nVar.p();
r.e(p10);
ag.n nVar2 = this.f12664d;
if (nVar2 == null) {
r.z("mViewModel");
nVar2 = null;
}
nc.a k10 = nVar2.k();
r.e(k10);
Long m10 = k10.m();
r.e(m10);
com.zoostudio.moneylover.main.moneyInsider.a a12 = c0223a.a(intValue, i11, p10, m10.longValue(), str, z10);
ig.a aVar3 = this.f12667g;
if (aVar3 == null) {
r.z("adapterViewPager");
aVar3 = null;
}
String b10 = fVar.b();
r.e(b10);
aVar3.u(a12, b10);
}
}
ig.a aVar4 = this.f12667g;
if (aVar4 == null) {
r.z("adapterViewPager");
aVar4 = null;
}
aVar4.j();
x1 x1Var5 = this.f12663c;
if (x1Var5 == null) {
r.z("binding");
} else {
x1Var2 = x1Var5;
}
x1Var2.K1.H.O(0, true);
}
private final void g2() {
j0 j0Var = new j0();
fc.a.d(this, "create_budget_tap_create_button", "", "Can not create a budget popup");
be.c n10 = new be.c(this).s().r(R.string.cannot_create_budget_title).k(R.string.cannot_create_budget_content).p(R.string.create_a_wallet_button, new n(j0Var)).i(R.color.p_500).n(R.string.close, new o(j0Var));
?? create = n10.setView(n10.e().getRoot()).create();
j0Var.f26370a = create;
if (create != 0) {
create.show();
}
}
public final void h2() {
j0 j0Var = new j0();
be.c i10 = new be.c(this).s().r(R.string.categories_not_combined).k(R.string.categories_not_combined_description).p(R.string.i_understand, new p(j0Var)).i(R.color.p_500);
?? create = i10.setView(i10.e().getRoot()).create();
j0Var.f26370a = create;
if (create != 0) {
create.show();
}
}
public final void i2(nc.a aVar) {
ag.n nVar = this.f12664d;
gg.b bVar = null;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
Iterator<T> it = nVar.l().iterator();
while (it.hasNext()) {
((nc.a) it.next()).V(false);
}
ag.n nVar2 = this.f12664d;
if (nVar2 == null) {
r.z("mViewModel");
nVar2 = null;
}
if (nVar2.l().size() == 5) {
ag.n nVar3 = this.f12664d;
if (nVar3 == null) {
r.z("mViewModel");
nVar3 = null;
}
nVar3.l().remove(1);
}
Long m10 = aVar.m();
r.e(m10);
long longValue = m10.longValue();
String r10 = aVar.r();
r.e(r10);
nc.a aVar2 = new nc.a(longValue, r10, true, false);
ag.n nVar4 = this.f12664d;
if (nVar4 == null) {
r.z("mViewModel");
nVar4 = null;
}
nVar4.l().add(1, aVar2);
gg.b bVar2 = this.f12666f;
if (bVar2 == null) {
r.z("adapterTabLabel");
} else {
bVar = bVar2;
}
bVar.notifyDataSetChanged();
}
public final void j2() {
String str;
String icon;
x1 x1Var = this.f12663c;
x1 x1Var2 = null;
if (x1Var == null) {
r.z("binding");
x1Var = null;
}
TextView textView = x1Var.f22345vk;
ag.n nVar = this.f12664d;
if (nVar == null) {
r.z("mViewModel");
nVar = null;
}
com.zoostudio.moneylover.adapter.item.a p10 = nVar.p();
if (p10 != null) {
str = p10.getName();
} else {
str = null;
}
textView.setText(str);
ag.n nVar2 = this.f12664d;
if (nVar2 == null) {
r.z("mViewModel");
nVar2 = null;
}
com.zoostudio.moneylover.adapter.item.a p11 = nVar2.p();
if (p11 != null && (icon = p11.getIcon()) != null) {
x1 x1Var3 = this.f12663c;
if (x1Var3 == null) {
r.z("binding");
} else {
x1Var2 = x1Var3;
}
x1Var2.V2.setIconByName(icon);
}
}
private final void p1(mc.b bVar) {
float f10;
x1 x1Var = this.f12663c;
x1 x1Var2 = null;
if (x1Var == null) {
r.z("binding");
x1Var = null;
}
x1Var.f22342th.f20892e.setShowToday(!ab.a.m(bVar));
x1 x1Var3 = this.f12663c;
if (x1Var3 == null) {
r.z("binding");
x1Var3 = null;
}
x1Var3.f22342th.f20892e.setModeProgress(2);
x1 x1Var4 = this.f12663c;
if (x1Var4 == null) {
r.z("binding");
x1Var4 = null;
}
GoalWalletProgress goalWalletProgress = x1Var4.f22342th.f20892e;
Double c10 = bVar.c();
if (c10 != null) {
f10 = (float) c10.doubleValue();
} else {
f10 = 0.0f;
}
goalWalletProgress.setMax(f10);
x1 x1Var5 = this.f12663c;
if (x1Var5 == null) {
r.z("binding");
x1Var5 = null;
}
x1Var5.f22342th.f20892e.setMaxDay(ab.a.e(bVar));
x1 x1Var6 = this.f12663c;
if (x1Var6 == null) {
r.z("binding");
x1Var6 = null;
}
x1Var6.f22342th.f20892e.setCurrentDay(ab.a.f(bVar));
x1 x1Var7 = this.f12663c;
if (x1Var7 == null) {
r.z("binding");
} else {
x1Var2 = x1Var7;
}
x1Var2.f22342th.f20892e.setCurrentValue((float) bVar.p());
}
private final void q1() {
ng.e a10 = MoneyInsiderStoreActivity.M.a();
if (!zi.f.a().z1().booleanValue() && a10 == null) {
d2();
return;
}
Boolean z12 = zi.f.a().z1();
r.g(z12, "getSubscribedMoneyInsider(...)");
if (z12.booleanValue()) {
if (a10 == null) {
c2();
return;
} else if (rt.c.r(a10.a()).getTime() < System.currentTimeMillis()) {
c2();
return;
} else {
e2();
return;
}
}
d2();
}
public final int r1(ng.d dVar) {
long time = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH).parse(dVar.d()).getTime();
Calendar calendar = Calendar.getInstance();
Calendar calendar2 = Calendar.getInstance();
calendar2.setTimeInMillis(time);
return (calendar2.get(6) - calendar.get(6)) + ((calendar2.get(1) - calendar.get(1)) * 365);
}
public final float s1(ng.d dVar) {
String c10 = dVar.c();
r.e(c10);
Date s10 = rt.c.s(c10);
String d10 = dVar.d();
r.e(d10);
return ((float) ((rt.c.s(d10).getTime() - s10.getTime()) / 86400000)) + 1.0f;
}
public final float t1(ng.d dVar) {
String c10 = dVar.c();
r.e(c10);
return ((float) ((System.currentTimeMillis() - rt.c.s(c10).getTime()) / 86400000)) + 1.0f;
}
private final ng.d u1(List<String> list) {
Calendar calendar = Calendar.getInstance();
calendar.set(1, Integer.parseInt(list.get(1)));
calendar.set(2, Integer.parseInt(list.get(0)) - 1);
calendar.set(5, zi.f.a().Z());
return new ng.d(this.f12673q.format(d1.S(calendar, zi.f.a().Z()).getTime()), this.f12673q.format(d1.z0(calendar, zi.f.a().Z()).getTime()));
}
private final ArrayList<ng.d> v1(ng.d dVar, int i10) {
Long l10;
int i11;
SimpleDateFormat simpleDateFormat = this.f12673q;
String c10 = dVar.c();
r.e(c10);
Date parse = simpleDateFormat.parse(c10);
if (parse != null) {
l10 = Long.valueOf(parse.getTime());
} else {
l10 = null;
}
SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd");
ArrayList<ng.d> arrayList = new ArrayList<>();
if (i10 == 1) {
i11 = 1;
} else {
i11 = 2;
}
for (int i12 = 0; i12 < 2; i12++) {
com.zoostudio.moneylover.adapter.item.a q10 = m0.q(this);
r.e(l10);
long[] U0 = d1.U0(q10, i11, l10.longValue(), 0 - i12);
String format = simpleDateFormat2.format(rt.c.o(new Date(U0[0])));
String format2 = simpleDateFormat2.format(rt.c.f(new Date(U0[1])));
if (i12 == 0) {
arrayList.add(new ng.d(format, format2));
} else {
arrayList.add(0, new ng.d(format, format2));
}
}
return arrayList;
}
public final ng.d w1(int i10, String str) {
List<String> z02;
ng.d u12;
List z03;
CharSequence U0;
List z04;
boolean z10;
Long l10;
Long l11;
boolean z11 = false;
if (i10 == 1) {
z03 = pq.v.z0(str, new String[]{"-"}, false, 0, 6, null);
U0 = pq.v.U0((String) z03.get(0));
z04 = pq.v.z0(U0.toString(), new String[]{RemoteSettings.FORWARD_SLASH_STRING}, false, 0, 6, null);
Calendar calendar = Calendar.getInstance();
calendar.set(1, Integer.parseInt((String) z04.get(2)));
calendar.set(2, Integer.parseInt((String) z04.get(1)) - 1);
calendar.set(5, Integer.parseInt((String) z04.get(0)));
if (this.K0.get(3) != calendar.get(3)) {
z10 = true;
} else {
z10 = false;
}
this.L = z10;
Date parse = this.B.parse((String) z03.get(0));
if (parse != null) {
l10 = Long.valueOf(parse.getTime());
} else {
l10 = null;
}
Date parse2 = this.B.parse((String) z03.get(1));
if (parse2 != null) {
l11 = Long.valueOf(parse2.getTime());
} else {
l11 = null;
}
SimpleDateFormat simpleDateFormat = this.f12673q;
r.e(l10);
String format = simpleDateFormat.format(l10);
SimpleDateFormat simpleDateFormat2 = this.f12673q;
r.e(l11);
u12 = new ng.d(format, simpleDateFormat2.format(l11));
} else {
z02 = pq.v.z0(str, new String[]{RemoteSettings.FORWARD_SLASH_STRING}, false, 0, 6, null);
if (this.K0.get(1) > Integer.parseInt(z02.get(1)) || Integer.parseInt(z02.get(0)) < this.K0.get(2) + 1) {
z11 = true;
}
this.L = z11;
u12 = u1(z02);
}
ng.d b10 = ng.d.b(u12, null, null, 3, null);
ng.d dVar = this.Q;
dVar.e(b10.c());
dVar.f(b10.d());
return u12;
}
public final String x1(int i10, long j10, long j11) {
Calendar.getInstance(TimeZone.getTimeZone("UTC")).setTimeInMillis(rt.c.m(i10, System.currentTimeMillis()));
return this.C.format(Long.valueOf(j10)) + " - " + this.C.format(Long.valueOf(j11));
}
public final String y1(int i10, long j10, long j11) {
Calendar.getInstance(TimeZone.getTimeZone("UTC")).setTimeInMillis(rt.c.m(i10, System.currentTimeMillis()));
return this.B.format(Long.valueOf(j10)) + " - " + this.B.format(Long.valueOf(j11));
}
private final void z1() {
x1 x1Var = this.f12663c;
x1 x1Var2 = null;
if (x1Var == null) {
r.z("binding");
x1Var = null;
}
x1Var.f22337df.f20635b.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MoneyInsiderActivity.A1(MoneyInsiderActivity.this, view);
}
});
x1 x1Var3 = this.f12663c;
if (x1Var3 == null) {
r.z("binding");
x1Var3 = null;
}
x1Var3.A1.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MoneyInsiderActivity.B1(MoneyInsiderActivity.this, view);
}
});
x1 x1Var4 = this.f12663c;
if (x1Var4 == null) {
r.z("binding");
x1Var4 = null;
}
x1Var4.f22340k1.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MoneyInsiderActivity.C1(MoneyInsiderActivity.this, view);
}
});
x1 x1Var5 = this.f12663c;
if (x1Var5 == null) {
r.z("binding");
x1Var5 = null;
}
x1Var5.C1.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MoneyInsiderActivity.D1(MoneyInsiderActivity.this, view);
}
});
x1 x1Var6 = this.f12663c;
if (x1Var6 == null) {
r.z("binding");
x1Var6 = null;
}
x1Var6.K1.f19550e.f20082b.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MoneyInsiderActivity.E1(MoneyInsiderActivity.this, view);
}
});
x1 x1Var7 = this.f12663c;
if (x1Var7 == null) {
r.z("binding");
x1Var7 = null;
}
x1Var7.f22342th.f20889b.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MoneyInsiderActivity.H1(MoneyInsiderActivity.this, view);
}
});
x1 x1Var8 = this.f12663c;
if (x1Var8 == null) {
r.z("binding");
x1Var8 = null;
}
x1Var8.K0.getRoot().setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MoneyInsiderActivity.I1(MoneyInsiderActivity.this, view);
}
});
x1 x1Var9 = this.f12663c;
if (x1Var9 == null) {
r.z("binding");
x1Var9 = null;
}
x1Var9.K3.f21192b.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MoneyInsiderActivity.J1(MoneyInsiderActivity.this, view);
}
});
x1 x1Var10 = this.f12663c;
if (x1Var10 == null) {
r.z("binding");
x1Var10 = null;
}
x1Var10.K1.f19548c.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MoneyInsiderActivity.K1(MoneyInsiderActivity.this, view);
}
});
x1 x1Var11 = this.f12663c;
if (x1Var11 == null) {
r.z("binding");
} else {
x1Var2 = x1Var11;
}
x1Var2.K1.f19547b.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MoneyInsiderActivity.L1(MoneyInsiderActivity.this, view);
}
});
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
this.f12664d = (ag.n) new o0(this).a(ag.n.class);
il.b.a(this.T, "com.zoostudio.moneylover.utils.BOUGHT_MONEY_INSIDER");
il.b.a(this.Y, "com.zoostudio.moneylover.utils.ADD_BUDGET_MONEY_INSIDER");
il.b.a(this.Z, "com.zoostudio.moneylover.utils.WALLET_SWITCHER_MONEY_INSIDER");
g gVar = this.f12670k0;
String jVar = com.zoostudio.moneylover.utils.j.TRANSACTION.toString();
r.g(jVar, "toString(...)");
il.b.a(gVar, jVar);
}
@Override
public void onDestroy() {
super.onDestroy();
il.b.b(this.T);
il.b.b(this.Y);
il.b.b(this.Z);
il.b.b(this.f12670k0);
}
@Override
public void onResume() {
super.onResume();
M1();
z1();
}
@Override
public void onStart() {
super.onStart();
P1();
q1();
}
}