package com.scb.phone.view.fragment.scheduledtransaction; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.Spinner; import android.widget.SpinnerAdapter; 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.fragment.BaseFragment; import com.scb.phone.view.fragment.scheduledtransaction.CalendarDialogFragment; import o.C12295evX; import o.C12436eyF; import o.C12476eyt; import o.C12478eyv; import o.C12481eyy; import o.C12482eyz; import o.C5952cEN; import o.InterfaceC13391fZD; import o.InterfaceC6641cYs; import o.VS; import o.ZI; import o.cEK; import o.kVs; import org.threeten.bp.OffsetDateTime; /* loaded from: classes5.dex */ public class CalendarDialogFragment extends Hilt_CalendarDialogFragment implements InterfaceC6641cYs { @BindView protected Button btOk; @BindView protected MaterialCalendarView calendar; @InterfaceC13391fZD public cEK calendarDialogPresenter; @BindView protected View divider; @BindView protected TextView endDate; @BindView protected ImageView leftArrow; @BindView protected LinearLayout llCalendarPageSelector; @BindView protected TextView monthYear; @BindView protected ImageView rightArrow; @BindView protected Spinner spnMonth; @BindView protected Spinner spnYear; @BindView protected TextView startDate; @BindView protected LinearLayout startEndHeader; @BindView protected TextView tvTitleDialog; public static CalendarDialogFragment b(int i, OffsetDateTime offsetDateTime, OffsetDateTime offsetDateTime2, OffsetDateTime offsetDateTime3, OffsetDateTime offsetDateTime4, boolean z, OffsetDateTime offsetDateTime5, boolean z2) { Bundle bundle = new Bundle(); CalendarDialogFragment calendarDialogFragment = new CalendarDialogFragment(); bundle.putInt("com.scb.phone.EXTRA_MODE", i); bundle.putSerializable("com.scb.phone.EXTRA_DATE", offsetDateTime); bundle.putSerializable("com.scb.phone.EXTRA_SELECT_DATE", offsetDateTime2); bundle.putSerializable("com.scb.phone.EXTRA_STARTDATE", offsetDateTime3); bundle.putSerializable("com.scb.phone.EXTRA_ENDDATE", offsetDateTime4); bundle.putSerializable("com.scb.phone.EXTRA_DISABLED_WEEKENDS", Boolean.valueOf(z)); bundle.putSerializable("com.scb.phone.EXTRA_CURRENTDATE", offsetDateTime5); bundle.putSerializable("com.scb.phone.EXTRA_DISABLE_CURRENTDATE", Boolean.valueOf(z2)); calendarDialogFragment.setArguments(bundle); return calendarDialogFragment; } @Override // androidx.fragment.app.Fragment public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { View inflate = layoutInflater.inflate(R.layout.2131559477, viewGroup, false); ((BaseFragment) this).a = ButterKnife.c(this, inflate); int i = getArguments() != null ? getArguments().getInt("com.scb.phone.EXTRA_MODE", 0) : 0; OffsetDateTime offsetDateTime = getArguments() != null ? (OffsetDateTime) getArguments().getSerializable("com.scb.phone.EXTRA_DATE") : null; OffsetDateTime offsetDateTime2 = getArguments() != null ? (OffsetDateTime) getArguments().getSerializable("com.scb.phone.EXTRA_SELECT_DATE") : null; OffsetDateTime offsetDateTime3 = getArguments() != null ? (OffsetDateTime) getArguments().getSerializable("com.scb.phone.EXTRA_STARTDATE") : null; OffsetDateTime offsetDateTime4 = getArguments() != null ? (OffsetDateTime) getArguments().getSerializable("com.scb.phone.EXTRA_ENDDATE") : null; boolean z = getArguments() != null && getArguments().getBoolean("com.scb.phone.EXTRA_DISABLED_WEEKENDS"); OffsetDateTime offsetDateTime5 = getArguments() != null ? (OffsetDateTime) getArguments().getSerializable("com.scb.phone.EXTRA_CURRENTDATE") : null; boolean z2 = getArguments() != null && getArguments().getBoolean("com.scb.phone.EXTRA_DISABLE_CURRENTDATE"); this.calendarDialogPresenter.e((cEK) this); this.calendarDialogPresenter.e(i, offsetDateTime, offsetDateTime2, offsetDateTime3, offsetDateTime4, z, offsetDateTime5, z2); return inflate; } @Override // o.InterfaceC6641cYs public final void d(VS vs) { if (getContext() != null) { this.monthYear.setVisibility(8); this.llCalendarPageSelector.setVisibility(0); this.spnMonth.setAdapter((SpinnerAdapter) new C12482eyz(getContext())); this.spnYear.setAdapter((SpinnerAdapter) new C12436eyF(getContext(), vs.n)); this.spnMonth.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(this) { // from class: com.scb.phone.view.fragment.scheduledtransaction.CalendarDialogFragment.2 private CalendarDialogFragment d; @Override // android.widget.AdapterView.OnItemSelectedListener public final void onNothingSelected(AdapterView adapterView) { } { this.d = this; } @Override // android.widget.AdapterView.OnItemSelectedListener public final void onItemSelected(AdapterView adapterView, View view, int i, long j) { CalendarDay calendarDay; CalendarDay calendarDay2; CalendarDay calendarDay3; cEK cek = this.d.calendarDialogPresenter; if (cek.a.f8415o != null) { calendarDay = cek.a.f8415o; } else { calendarDay = cek.a.b; } int year = calendarDay.getYear(); if (cek.a.f8415o != null) { calendarDay2 = cek.a.f8415o; } else { calendarDay2 = cek.a.b; } CalendarDay a = cek.a(CalendarDay.from(year, i, calendarDay2.getDay())); if (cek.a.f8415o != null) { calendarDay3 = cek.a.f8415o; } else { calendarDay3 = cek.a.b; } if (calendarDay3.getMonth() != i) { cek.a.f8415o = a; C5952cEN c5952cEN = new C5952cEN(cek, cek.a.f8415o); if (cek.f != 0) { c5952cEN.e(cek.f); } } } }); this.spnYear.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(this) { // from class: com.scb.phone.view.fragment.scheduledtransaction.CalendarDialogFragment.1 private CalendarDialogFragment c; @Override // android.widget.AdapterView.OnItemSelectedListener public final void onNothingSelected(AdapterView adapterView) { } { this.c = this; } @Override // android.widget.AdapterView.OnItemSelectedListener public final void onItemSelected(AdapterView adapterView, View view, int i, long j) { CalendarDay calendarDay; CalendarDay calendarDay2; CalendarDay calendarDay3; cEK cek = this.c.calendarDialogPresenter; int intValue = cek.a.n.get(i).intValue(); if (cek.a.f8415o != null) { calendarDay = cek.a.f8415o; } else { calendarDay = cek.a.b; } int month = calendarDay.getMonth(); if (cek.a.f8415o != null) { calendarDay2 = cek.a.f8415o; } else { calendarDay2 = cek.a.b; } CalendarDay a = cek.a(CalendarDay.from(intValue, month, calendarDay2.getDay())); if (cek.a.f8415o != null) { calendarDay3 = cek.a.f8415o; } else { calendarDay3 = cek.a.b; } if (calendarDay3.getYear() != a.getYear()) { cek.a.f8415o = a; C5952cEN c5952cEN = new C5952cEN(cek, cek.a.f8415o); if (cek.f != 0) { c5952cEN.e(cek.f); } } } }); this.spnMonth.setSelection(vs.b.getMonth()); this.spnYear.setSelection(vs.n.indexOf(Integer.valueOf(vs.b.getYear()))); } } @Override // o.InterfaceC6641cYs public final void d(CalendarDay calendarDay, int i, int i2) { this.spnMonth.setSelection(i); this.spnYear.setSelection(i2); this.calendar.setCurrentDate(CalendarDay.from(calendarDay.getYear(), calendarDay.getMonth(), calendarDay.getDay())); } @Override // o.InterfaceC6641cYs public final void b(String str) { this.monthYear.setText(str); } @Override // o.InterfaceC6641cYs public final void c(String str) { this.startDate.setText(str); } @Override // o.InterfaceC6641cYs public final void d(String str) { this.endDate.setTextColor(kVs.nX_(getResources(), R.color.f2982131099805, null)); this.endDate.setText(str); } @Override // o.InterfaceC6641cYs public final void d(boolean z) { this.leftArrow.setVisibility(z ? 0 : 4); } @Override // o.InterfaceC6641cYs public final void a(boolean z) { this.rightArrow.setVisibility(z ? 0 : 4); } @Override // o.InterfaceC6641cYs public final void d(OffsetDateTime offsetDateTime) { Intent intent = new Intent(); intent.putExtra("com.scb.phone.EXTRA_DATE", offsetDateTime); requireActivity().setResult(-1, intent); requireActivity().finish(); } /* JADX INFO: Access modifiers changed from: package-private */ @OnClick public void onPreviousMonthArrowClicked() { CalendarDay calendarDay; CalendarDay calendarDay2; CalendarDay calendarDay3; cEK cek = this.calendarDialogPresenter; if (3 == cek.d) { if (cek.a.f8415o != null) { calendarDay = cek.a.f8415o; } else { calendarDay = cek.a.b; } calendarDay.getCalendar().add(2, -1); VS vs = cek.a; if (cek.a.f8415o != null) { calendarDay2 = cek.a.f8415o; } else { calendarDay2 = cek.a.b; } vs.f8415o = CalendarDay.from(calendarDay2.getCalendar()); if (cek.a.f8415o != null) { calendarDay3 = cek.a.f8415o; } else { calendarDay3 = cek.a.b; } C5952cEN c5952cEN = new C5952cEN(cek, calendarDay3); if (cek.f != 0) { c5952cEN.e(cek.f); return; } return; } ZI.IeS ieS = new ZI.IeS() { // from class: o.cEQ @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC6641cYs) obj).c(); } }; if (cek.f != 0) { ieS.e(cek.f); } } @Override // o.InterfaceC6641cYs public final void c() { this.calendar.goToPrevious(); } /* JADX INFO: Access modifiers changed from: package-private */ @OnClick public void onNextMonthArrowClicked() { CalendarDay calendarDay; CalendarDay calendarDay2; CalendarDay calendarDay3; cEK cek = this.calendarDialogPresenter; if (3 != cek.d) { ZI.IeS ieS = new ZI.IeS() { // from class: o.cEY @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC6641cYs) obj).e(); } }; if (cek.f != 0) { ieS.e(cek.f); return; } return; } if (cek.a.f8415o != null) { calendarDay = cek.a.f8415o; } else { calendarDay = cek.a.b; } calendarDay.getCalendar().add(2, 1); VS vs = cek.a; if (cek.a.f8415o != null) { calendarDay2 = cek.a.f8415o; } else { calendarDay2 = cek.a.b; } vs.f8415o = CalendarDay.from(calendarDay2.getCalendar()); if (cek.a.f8415o != null) { calendarDay3 = cek.a.f8415o; } else { calendarDay3 = cek.a.b; } C5952cEN c5952cEN = new C5952cEN(cek, calendarDay3); if (cek.f != 0) { c5952cEN.e(cek.f); } } @Override // o.InterfaceC6641cYs public final void e() { this.calendar.goToNext(); } @OnClick public void onCloseClicked() { requireActivity().setResult(0); requireActivity().finish(); } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public void onDestroy() { super.onDestroy(); this.calendarDialogPresenter.w_(); } /* JADX INFO: Access modifiers changed from: package-private */ @OnClick public void onOkButtonClicked() { final cEK cek = this.calendarDialogPresenter; final CalendarDay selectedDate = this.calendar.getSelectedDate(); ZI.IeS ieS = new ZI.IeS(cek, selectedDate) { // from class: o.cER private CalendarDay c; private cEK d; @Override // o.ZI.IeS public final void e(Object obj) { cEK.e(this.d, this.c, (InterfaceC6641cYs) obj); } { this.d = cek; this.c = selectedDate; } }; if (cek.f != 0) { ieS.e(cek.f); } } public static /* synthetic */ void d(CalendarDialogFragment calendarDialogFragment, VS vs, CalendarDay calendarDay) { if (vs.d && vs.b.equals(calendarDay)) { return; } calendarDialogFragment.calendarDialogPresenter.d(calendarDay); calendarDialogFragment.btOk.setEnabled(true); } public static /* synthetic */ void d(CalendarDialogFragment calendarDialogFragment, CalendarDay calendarDay) { cEK cek = calendarDialogFragment.calendarDialogPresenter; C5952cEN c5952cEN = new C5952cEN(cek, calendarDay); if (cek.f != 0) { c5952cEN.e(cek.f); } } @Override // o.InterfaceC6641cYs public final void c(final VS vs) { this.tvTitleDialog.setText(vs.p); this.startEndHeader.setVisibility(vs.l ? 0 : 8); this.startDate.setText(vs.m); this.endDate.setText(vs.f); this.endDate.setTextColor(kVs.nX_(getResources(), vs.r, null)); this.divider.setVisibility(vs.l ? 0 : 8); this.calendar.state().edit().setFirstDayOfWeek(vs.i).setMinimumDate(vs.j).setMaximumDate(vs.h).setCalendarDisplayMode(CalendarMode.MONTHS).commit(); this.calendar.clearSelection(); this.calendar.removeDecorators(); this.calendar.setTopbarVisible(false); this.calendar.setOnMonthChangedListener(new OnMonthChangedListener(this) { // from class: o.fzK private CalendarDialogFragment d; @Override // com.prolificinteractive.materialcalendarview.OnMonthChangedListener public final void onMonthChanged(MaterialCalendarView materialCalendarView, CalendarDay calendarDay) { CalendarDialogFragment.d(this.d, calendarDay); } { this.d = this; } }); this.calendar.setOnDateChangedListener(new OnDateSelectedListener(this, vs) { // from class: o.fzJ private CalendarDialogFragment a; private VS e; @Override // com.prolificinteractive.materialcalendarview.OnDateSelectedListener public final void onDateSelected(MaterialCalendarView materialCalendarView, CalendarDay calendarDay, boolean z) { CalendarDialogFragment.d(this.a, this.e, calendarDay); } { this.a = this; this.e = vs; } }); this.calendar.addDecorator(new C12476eyt(vs.c, vs.g)); this.calendar.addDecorator(new C12478eyv(getResources(), vs.b, vs.d)); if (vs.a) { this.calendar.addDecorator(new C12295evX()); } if (vs.k != null) { this.calendar.addDecorator(new C12481eyy(getResources(), vs.k)); } if (vs.f8415o != null) { this.calendar.setCurrentDate(vs.f8415o); this.calendar.setDateSelected(vs.f8415o, true); this.btOk.setEnabled(true); return; } this.btOk.setEnabled(false); } }