what-the-bank/sources/com/scb/phone/view/fragment/calendarlanding/CalendarFragment.java

297 lines
10 KiB
Java

package com.scb.phone.view.fragment.calendarlanding;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.prolificinteractive.materialcalendarview.CalendarDay;
import com.prolificinteractive.materialcalendarview.CalendarMode;
import com.prolificinteractive.materialcalendarview.MaterialCalendarView;
import com.prolificinteractive.materialcalendarview.OnDateSelectedListener;
import com.prolificinteractive.materialcalendarview.OnMonthChangedListener;
import com.scb.phone.R;
import com.scb.phone.view.activity.calendar.CalendarLandingActivity;
import com.scb.phone.view.fragment.calendarlanding.CalendarFragment;
import java.util.List;
import java.util.NoSuchElementException;
import o.AbstractC15502gsH;
import o.C12476eyt;
import o.C12478eyv;
import o.C12480eyx;
import o.C15517gsm;
import o.C17745zRk;
import o.C2790alJ;
import o.C2792alL;
import o.C2794alN;
import o.C2799alS;
import o.C5952cEN;
import o.GEP;
import o.InterfaceC1244Ytw;
import o.InterfaceC13391fZD;
import o.InterfaceC6639cYq;
import o.InterfaceC6641cYs;
import o.Jel;
import o.VP;
import o.VS;
import o.YKU;
import o.cEK;
import o.xNZ;
import o.zEQ;
import org.threeten.bp.OffsetDateTime;
/* loaded from: classes5.dex */
public class CalendarFragment extends Hilt_CalendarFragment implements InterfaceC6641cYs, InterfaceC6639cYq.IeS {
public OffsetDateTime c;
@InterfaceC13391fZD
public cEK calendarDialogPresenter;
@InterfaceC13391fZD
public C2794alN calendarPresenter;
@BindView
protected MaterialCalendarView calendarView;
public VP d;
private InterfaceC6639cYq i;
@BindView
protected ImageView leftArrowImageView;
@BindView
protected TextView monthYear;
@BindView
protected ImageView rightArrowImageView;
@Override // o.InterfaceC6641cYs
public final void c(String str) {
}
@Override // o.InterfaceC6641cYs
public final void d(String str) {
}
@Override // o.InterfaceC6641cYs
public final void d(OffsetDateTime offsetDateTime) {
}
@Override // androidx.fragment.app.Fragment
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
View inflate = layoutInflater.inflate(R.layout.2131559478, viewGroup, false);
ButterKnife.c(this, inflate);
if (getActivity() != null && getActivity().getIntent() != null) {
this.d = (VP) getActivity().getIntent().getParcelableExtra("SCHEDULE_DATA");
}
VP vp = this.d;
if (vp != null && vp.c != null) {
d();
}
this.calendarPresenter.e((C2794alN) this);
this.i = (InterfaceC6639cYq) getActivity();
return inflate;
}
public static /* synthetic */ boolean d(OffsetDateTime offsetDateTime, CalendarDay calendarDay) {
return calendarDay.getMonth() + 1 == offsetDateTime.getMonthValue() && calendarDay.getYear() == offsetDateTime.getYear();
}
@Override // o.InterfaceC6641cYs
public final void c(VS vs) {
C12480eyx c12480eyx = new C12480eyx(getResources(), this.d.c);
this.calendarView.state().edit().setFirstDayOfWeek(vs.i).setMinimumDate(vs.j).setMaximumDate(vs.h).setCalendarDisplayMode(CalendarMode.MONTHS).commit();
this.calendarView.setDynamicHeightEnabled(true);
this.calendarView.setTopbarVisible(false);
this.calendarView.setOnMonthChangedListener(new OnMonthChangedListener(this) { // from class: o.eIx
private CalendarFragment b;
@Override // com.prolificinteractive.materialcalendarview.OnMonthChangedListener
public final void onMonthChanged(MaterialCalendarView materialCalendarView, CalendarDay calendarDay) {
CalendarFragment.b(this.b, calendarDay);
}
{
this.b = this;
}
});
this.calendarView.setOnDateChangedListener(new OnDateSelectedListener(this) { // from class: o.eIy
private CalendarFragment b;
@Override // com.prolificinteractive.materialcalendarview.OnDateSelectedListener
public final void onDateSelected(MaterialCalendarView materialCalendarView, CalendarDay calendarDay, boolean z) {
CalendarFragment.e(this.b, calendarDay);
}
{
this.b = this;
}
});
this.calendarView.clearSelection();
this.calendarView.removeDecorators();
this.calendarView.addDecorator(new C12476eyt(vs.c, vs.g));
this.calendarView.addDecorator(new C12478eyv(getResources(), vs.k, false));
this.calendarView.addDecorator(c12480eyx);
this.calendarView.setCurrentDate(vs.f8415o);
this.calendarView.setDateSelected(vs.f8415o, true);
}
@Override // o.InterfaceC6641cYs
public final void b(String str) {
this.monthYear.setText(str);
}
@Override // o.InterfaceC6641cYs
public final void d(boolean z) {
this.leftArrowImageView.setVisibility(z ? 0 : 4);
}
@Override // o.InterfaceC6641cYs
public final void a(boolean z) {
this.rightArrowImageView.setVisibility(z ? 0 : 4);
}
@OnClick
public void onPreviousMonthArrowClicked() {
this.calendarView.goToPrevious();
}
@OnClick
public void onNextMonthArrowClicked() {
this.calendarView.goToNext();
}
@Override // o.InterfaceC6639cYq.IeS
public final void c(VP vp) {
this.d = vp;
if (getActivity() == null) {
return;
}
if (vp != null && vp.c != null && !vp.c.isEmpty()) {
d();
CalendarLandingActivity calendarLandingActivity = (CalendarLandingActivity) getActivity();
List<CalendarDay> list = vp.c;
C2799alS c2799alS = calendarLandingActivity.k.scheduleListPresenter;
c2799alS.b.clear();
c2799alS.b.addAll(list);
CalendarFragment calendarFragment = calendarLandingActivity.b;
C2794alN c2794alN = calendarFragment.calendarPresenter;
OffsetDateTime offsetDateTime = calendarFragment.c;
if (calendarFragment.d.c != null) {
C2790alJ c2790alJ = new C2790alJ(c2794alN, offsetDateTime);
if (c2794alN.f != 0) {
c2790alJ.e(c2794alN.f);
return;
}
return;
}
C2792alL c2792alL = new C2792alL();
if (c2794alN.f != 0) {
c2792alL.e(c2794alN.f);
return;
}
return;
}
CalendarLandingActivity calendarLandingActivity2 = (CalendarLandingActivity) getActivity();
calendarLandingActivity2.emptyScheduleMessageContainer.setVisibility(0);
calendarLandingActivity2.fragmentContainer.setVisibility(8);
}
@Override // o.InterfaceC6639cYq.IeS
public final void b() {
if (getActivity() == null) {
return;
}
getActivity().finish();
}
@Override // o.InterfaceC6639cYq.IeS
public final void b(CalendarDay calendarDay) {
this.i.e(calendarDay);
}
@Override // o.InterfaceC6639cYq.IeS
public final void a() {
this.i.e();
}
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public void onDestroy() {
this.calendarPresenter.a();
super.onDestroy();
}
public static /* synthetic */ void e(CalendarFragment calendarFragment, CalendarDay calendarDay) {
calendarFragment.calendarDialogPresenter.d(calendarDay);
calendarFragment.i.e(calendarDay);
}
public static /* synthetic */ void b(CalendarFragment calendarFragment, CalendarDay calendarDay) {
cEK cek = calendarFragment.calendarDialogPresenter;
C5952cEN c5952cEN = new C5952cEN(cek, calendarDay);
if (cek.f != 0) {
c5952cEN.e(cek.f);
}
}
/* JADX WARN: Multi-variable type inference failed */
private void d() {
zEQ d;
CalendarDay calendarDay;
final OffsetDateTime offsetDateTime = this.d.d;
OffsetDateTime offsetDateTime2 = null;
if (offsetDateTime != null) {
YKU yku = new YKU(this.d.c);
YKU yku2 = new YKU(yku.a, new GEP(yku.b, new Jel(offsetDateTime) { // from class: o.eIE
private OffsetDateTime c;
@Override // o.Jel
public final boolean e(Object obj) {
return CalendarFragment.d(this.c, (CalendarDay) obj);
}
{
this.c = offsetDateTime;
}
}));
YKU yku3 = new YKU(yku2.a, new C17745zRk(yku2.b, xNZ.a(new InterfaceC1244Ytw() { // from class: o.eIG
@Override // o.InterfaceC1244Ytw
public final Object d(Object obj) {
int day;
day = ((CalendarDay) obj).getDay();
return Integer.valueOf(day);
}
})));
if (yku3.b.hasNext()) {
d = zEQ.a(yku3.b.next());
} else {
d = zEQ.d();
}
if (d.d != 0) {
T t = d.d;
if (t != 0) {
calendarDay = (CalendarDay) t;
} else {
throw new NoSuchElementException("No value present");
}
} else {
calendarDay = null;
}
if (calendarDay != null) {
offsetDateTime2 = OffsetDateTime.ofInstant(C15517gsm.toInstant(calendarDay.getCalendar()), AbstractC15502gsH.of("Asia/Bangkok"));
}
}
if (offsetDateTime2 == null) {
offsetDateTime2 = offsetDateTime;
}
this.c = offsetDateTime2;
OffsetDateTime offsetDateTime3 = this.d.i;
OffsetDateTime offsetDateTime4 = this.d.a;
this.calendarDialogPresenter.e((cEK) this);
this.calendarDialogPresenter.e(2, offsetDateTime, this.c, offsetDateTime3, offsetDateTime4, false, null, true);
}
}