package com.mexico.inloancash.utils;

import android.app.Dialog;
import android.content.Context;
import android.util.Log;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import com.facebook.appevents.AppEventsConstants;
import com.facebook.internal.security.CertificateUtil;
import com.indiaholacash.holacash.R;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Locale;
import ඓ.ඓ.K.䁗.C0723;
import ඓ.ඓ.K.䁗.C0724;
import ඓ.ඓ.K.䁗.C0728;
import ඓ.ඓ.K.䁗.C0731;
import ඓ.ඓ.K.䁗.C0735;
import ඓ.ඓ.K.䁗.RunnableC0708;
import ඓ.ඓ.K.䁗.View$OnClickListenerC0726;
import ඓ.ඓ.K.䁗.View$OnClickListenerC0732;
import ඓ.K.K.K.C1293;

public class IndiaCustom_DatePicker {

    /* renamed from: ʬ  reason: contains not printable characters */
    public Context f2821;

    /* renamed from: В  reason: contains not printable characters */
    public TextView f2822;

    /* renamed from: Ԕ  reason: contains not printable characters */
    public ArrayList<String> f2823;

    /* renamed from: Ԛ  reason: contains not printable characters */
    public int f2824;

    /* renamed from: ؿ  reason: contains not printable characters */
    public int f2825;

    /* renamed from: ݜ  reason: contains not printable characters */
    public int f2826;

    /* renamed from: ඓ  reason: contains not printable characters */
    public Dialog f2827;

    /* renamed from: ᆯ  reason: contains not printable characters */
    public Calendar f2828;

    /* renamed from: ሽ  reason: contains not printable characters */
    public Calendar f2829;

    /* renamed from: ᑓ  reason: contains not printable characters */
    public int f2830;

    /* renamed from: ᑾ  reason: contains not printable characters */
    public TextView f2831;

    /* renamed from: ᓆ  reason: contains not printable characters */
    public int f2832;

    /* renamed from: ᓣ  reason: contains not printable characters */
    public int f2833;

    /* renamed from: ᕣ  reason: contains not printable characters */
    public ArrayList<String> f2834;

    /* renamed from: ᝁ  reason: contains not printable characters */
    public boolean f2835;

    /* renamed from: ᨨ  reason: contains not printable characters */
    public India_DatePickerView f2836;

    /* renamed from: ῲ  reason: contains not printable characters */
    public AbstractC0529 f2837;

    /* renamed from: ⁱ  reason: contains not printable characters */
    public India_DatePickerView f2838;

    /* renamed from: K  reason: contains not printable characters */
    public int f2839 = (SCROLL_TYPE.HOUR.value + SCROLL_TYPE.MINUTE.value);

    /* renamed from: ⶍ  reason: contains not printable characters */
    public Calendar f2840;

    /* renamed from: ゎ  reason: contains not printable characters */
    public boolean f2841;

    /* renamed from: ト  reason: contains not printable characters */
    public boolean f2842;

    /* renamed from: 㑃  reason: contains not printable characters */
    public ArrayList<String> f2843;

    /* renamed from: 㗗  reason: contains not printable characters */
    public ArrayList<String> f2844;

    /* renamed from: 㗽  reason: contains not printable characters */
    public int f2845;

    /* renamed from: 㮔  reason: contains not printable characters */
    public boolean f2846;

    /* renamed from: 㳳  reason: contains not printable characters */
    public India_DatePickerView f2847;

    /* renamed from: 㴪  reason: contains not printable characters */
    public int f2848;

    /* renamed from: 㴹  reason: contains not printable characters */
    public India_DatePickerView f2849;

    /* renamed from: 㶋  reason: contains not printable characters */
    public int f2850;

    /* renamed from: 㸾  reason: contains not printable characters */
    public boolean f2851 = false;

    /* renamed from: 㿎  reason: contains not printable characters */
    public India_DatePickerView f2852;

    /* renamed from: 䀟  reason: contains not printable characters */
    public int f2853;

    /* renamed from: 䁗  reason: contains not printable characters */
    public ArrayList<String> f2854;

    /* renamed from: 䃖  reason: contains not printable characters */
    public boolean f2855;

    public enum SCROLL_TYPE {
        HOUR(1),
        MINUTE(2);
        
        public int value;

        /* access modifiers changed from: public */
        SCROLL_TYPE(int i) {
            this.value = i;
        }
    }

    /* renamed from: com.mexico.inloancash.utils.IndiaCustom_DatePicker$K  reason: contains not printable characters */
    public interface AbstractC0529 {
    }

    public IndiaCustom_DatePicker(Context context, AbstractC0529 k, String str, String str2) {
        if (m1633(str, "yyyy-MM-dd HH:mm") && m1633(str2, "yyyy-MM-dd HH:mm")) {
            this.f2851 = true;
            this.f2821 = context;
            this.f2837 = k;
            this.f2828 = Calendar.getInstance();
            this.f2840 = Calendar.getInstance();
            this.f2829 = Calendar.getInstance();
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.CHINA);
            try {
                this.f2840.setTime(simpleDateFormat.parse(str));
                this.f2829.setTime(simpleDateFormat.parse(str2));
            } catch (ParseException e) {
                e.printStackTrace();
            }
            if (this.f2827 == null) {
                this.f2827 = new Dialog(this.f2821, R.style.time_dialog);
                this.f2827.setCancelable(false);
                this.f2827.requestWindowFeature(1);
                this.f2827.setContentView(R.layout.india_activity_custom_view_layout_date_picker_item);
                Window window = this.f2827.getWindow();
                window.setGravity(80);
                WindowManager.LayoutParams attributes = window.getAttributes();
                attributes.width = -1;
                attributes.height = -2;
                window.setAttributes(attributes);
                this.f2827.setCanceledOnTouchOutside(false);
            }
            this.f2849 = (India_DatePickerView) this.f2827.findViewById(R.id.year_pv);
            this.f2838 = (India_DatePickerView) this.f2827.findViewById(R.id.month_pv);
            this.f2852 = (India_DatePickerView) this.f2827.findViewById(R.id.day_pv);
            this.f2836 = (India_DatePickerView) this.f2827.findViewById(R.id.hour_pv);
            this.f2847 = (India_DatePickerView) this.f2827.findViewById(R.id.minute_pv);
            this.f2831 = (TextView) this.f2827.findViewById(R.id.tv_cancle);
            this.f2822 = (TextView) this.f2827.findViewById(R.id.tv_select);
            this.f2831.setOnClickListener(new View$OnClickListenerC0732(this));
            this.f2822.setOnClickListener(new View$OnClickListenerC0726(this));
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public final String m1630(int i) {
        if (i >= 10) {
            return String.valueOf(i);
        }
        StringBuilder r0 = C1293.m3416(AppEventsConstants.EVENT_PARAM_VALUE_NO);
        r0.append(String.valueOf(i));
        return r0.toString();
    }

    /* renamed from: K  reason: contains not printable characters */
    public static /* synthetic */ void m1628(IndiaCustom_DatePicker indiaCustom_DatePicker) {
        indiaCustom_DatePicker.f2854.clear();
        int i = indiaCustom_DatePicker.f2828.get(1);
        int i2 = indiaCustom_DatePicker.f2828.get(2) + 1;
        if (i == indiaCustom_DatePicker.f2825 && i2 == indiaCustom_DatePicker.f2833) {
            int i3 = indiaCustom_DatePicker.f2845;
            while (i3 <= indiaCustom_DatePicker.f2828.getActualMaximum(5)) {
                i3 = C1293.m3405(indiaCustom_DatePicker, i3, new StringBuilder(), "", indiaCustom_DatePicker.f2854, i3, 1);
            }
        } else if (i == indiaCustom_DatePicker.f2824 && i2 == indiaCustom_DatePicker.f2850) {
            int i4 = 1;
            while (i4 <= indiaCustom_DatePicker.f2832) {
                i4 = C1293.m3405(indiaCustom_DatePicker, i4, new StringBuilder(), "", indiaCustom_DatePicker.f2854, i4, 1);
            }
        } else {
            int i5 = 1;
            while (i5 <= indiaCustom_DatePicker.f2828.getActualMaximum(5)) {
                i5 = C1293.m3405(indiaCustom_DatePicker, i5, new StringBuilder(), "", indiaCustom_DatePicker.f2854, i5, 1);
            }
        }
        indiaCustom_DatePicker.f2828.set(5, Integer.parseInt(indiaCustom_DatePicker.f2854.get(0)));
        indiaCustom_DatePicker.f2852.setData(indiaCustom_DatePicker.f2854);
        indiaCustom_DatePicker.f2852.setSelected(0);
        indiaCustom_DatePicker.f2852.postDelayed(new RunnableC0708(indiaCustom_DatePicker), 100);
    }

    /* JADX WARNING: Removed duplicated region for block: B:20:0x0055  */
    /* renamed from: K  reason: contains not printable characters */
    public final void m1631() {
        boolean z;
        boolean z2 = false;
        this.f2849.setCanScroll(this.f2834.size() > 1);
        this.f2838.setCanScroll(this.f2843.size() > 1);
        this.f2852.setCanScroll(this.f2854.size() > 1);
        India_DatePickerView india_DatePickerView = this.f2836;
        if (this.f2823.size() > 1) {
            int i = this.f2839;
            int i2 = SCROLL_TYPE.HOUR.value;
            if ((i & i2) == i2) {
                z = true;
                india_DatePickerView.setCanScroll(z);
                India_DatePickerView india_DatePickerView2 = this.f2847;
                if (this.f2844.size() > 1) {
                    int i3 = this.f2839;
                    int i4 = SCROLL_TYPE.MINUTE.value;
                    if ((i3 & i4) == i4) {
                        z2 = true;
                    }
                }
                india_DatePickerView2.setCanScroll(z2);
            }
        }
        z = false;
        india_DatePickerView.setCanScroll(z);
        India_DatePickerView india_DatePickerView22 = this.f2847;
        if (this.f2844.size() > 1) {
        }
        india_DatePickerView22.setCanScroll(z2);
    }

    /* renamed from: K  reason: contains not printable characters */
    public final int m1629(SCROLL_TYPE... scroll_typeArr) {
        if (scroll_typeArr == null || scroll_typeArr.length == 0) {
            this.f2839 = SCROLL_TYPE.HOUR.value + SCROLL_TYPE.MINUTE.value;
        } else {
            for (SCROLL_TYPE scroll_type : scroll_typeArr) {
                this.f2839 = scroll_type.value ^ this.f2839;
            }
        }
        return this.f2839;
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m1632(String str) {
        int i;
        if (!this.f2851) {
            return;
        }
        if (!m1633(str, "yyyy-MM-dd")) {
            this.f2851 = false;
        } else if (this.f2840.getTime().getTime() < this.f2829.getTime().getTime()) {
            this.f2851 = true;
            this.f2825 = this.f2840.get(1);
            this.f2833 = this.f2840.get(2) + 1;
            this.f2845 = this.f2840.get(5);
            this.f2826 = this.f2840.get(11);
            this.f2853 = this.f2840.get(12);
            this.f2824 = this.f2829.get(1);
            this.f2850 = this.f2829.get(2) + 1;
            this.f2832 = this.f2829.get(5);
            this.f2848 = this.f2829.get(11);
            this.f2830 = this.f2829.get(12);
            this.f2841 = this.f2825 != this.f2824;
            this.f2842 = !this.f2841 && this.f2833 != this.f2850;
            this.f2846 = !this.f2842 && this.f2845 != this.f2832;
            this.f2855 = !this.f2846 && this.f2826 != this.f2848;
            this.f2835 = !this.f2855 && this.f2853 != this.f2830;
            this.f2828.setTime(this.f2840.getTime());
            if (this.f2834 == null) {
                this.f2834 = new ArrayList<>();
            }
            if (this.f2843 == null) {
                this.f2843 = new ArrayList<>();
            }
            if (this.f2854 == null) {
                this.f2854 = new ArrayList<>();
            }
            if (this.f2823 == null) {
                this.f2823 = new ArrayList<>();
            }
            if (this.f2844 == null) {
                this.f2844 = new ArrayList<>();
            }
            this.f2834.clear();
            this.f2843.clear();
            this.f2854.clear();
            this.f2823.clear();
            this.f2844.clear();
            if (this.f2841) {
                for (int i2 = this.f2825; i2 <= this.f2824; i2++) {
                    ArrayList<String> arrayList = this.f2834;
                    arrayList.add(String.valueOf(i2) + "");
                }
                int i3 = this.f2833;
                while (i3 <= 12) {
                    i3 = C1293.m3406(this, i3, this.f2843, i3, 1);
                }
                int i4 = this.f2845;
                while (i4 <= this.f2840.getActualMaximum(5)) {
                    i4 = C1293.m3405(this, i4, new StringBuilder(), "", this.f2854, i4, 1);
                }
                int i5 = this.f2839;
                int i6 = SCROLL_TYPE.HOUR.value;
                if ((i5 & i6) != i6) {
                    this.f2823.add(m1630(this.f2826));
                } else {
                    int i7 = this.f2826;
                    while (i7 <= 23) {
                        i7 = C1293.m3406(this, i7, this.f2823, i7, 1);
                    }
                }
                int i8 = this.f2839;
                int i9 = SCROLL_TYPE.MINUTE.value;
                if ((i8 & i9) != i9) {
                    this.f2844.add(m1630(this.f2853));
                } else {
                    int i10 = this.f2853;
                    while (i10 <= 59) {
                        i10 = C1293.m3406(this, i10, this.f2844, i10, 1);
                    }
                }
            } else if (this.f2842) {
                ArrayList<String> arrayList2 = this.f2834;
                arrayList2.add(String.valueOf(this.f2825) + "");
                int i11 = this.f2833;
                while (i11 <= this.f2850) {
                    i11 = C1293.m3405(this, i11, new StringBuilder(), "", this.f2843, i11, 1);
                }
                int i12 = this.f2845;
                while (i12 <= this.f2840.getActualMaximum(5)) {
                    i12 = C1293.m3405(this, i12, new StringBuilder(), "", this.f2854, i12, 1);
                }
                int i13 = this.f2839;
                int i14 = SCROLL_TYPE.HOUR.value;
                if ((i13 & i14) != i14) {
                    this.f2823.add(m1630(this.f2826));
                } else {
                    int i15 = this.f2826;
                    while (i15 <= 23) {
                        i15 = C1293.m3406(this, i15, this.f2823, i15, 1);
                    }
                }
                int i16 = this.f2839;
                int i17 = SCROLL_TYPE.MINUTE.value;
                if ((i16 & i17) != i17) {
                    this.f2844.add(m1630(this.f2853));
                } else {
                    int i18 = this.f2853;
                    while (i18 <= 59) {
                        i18 = C1293.m3406(this, i18, this.f2844, i18, 1);
                    }
                }
            } else if (this.f2846) {
                ArrayList<String> arrayList3 = this.f2834;
                arrayList3.add(String.valueOf(this.f2825) + "");
                ArrayList<String> arrayList4 = this.f2843;
                arrayList4.add(m1630(this.f2833) + "");
                int i19 = this.f2845;
                while (i19 <= this.f2832) {
                    i19 = C1293.m3405(this, i19, new StringBuilder(), "", this.f2854, i19, 1);
                }
                int i20 = this.f2839;
                int i21 = SCROLL_TYPE.HOUR.value;
                if ((i20 & i21) != i21) {
                    this.f2823.add(m1630(this.f2826));
                } else {
                    int i22 = this.f2826;
                    while (i22 <= 23) {
                        i22 = C1293.m3406(this, i22, this.f2823, i22, 1);
                    }
                }
                int i23 = this.f2839;
                int i24 = SCROLL_TYPE.MINUTE.value;
                if ((i23 & i24) != i24) {
                    this.f2844.add(m1630(this.f2853));
                } else {
                    int i25 = this.f2853;
                    while (i25 <= 59) {
                        i25 = C1293.m3406(this, i25, this.f2844, i25, 1);
                    }
                }
            } else if (this.f2855) {
                ArrayList<String> arrayList5 = this.f2834;
                arrayList5.add(String.valueOf(this.f2825) + "");
                ArrayList<String> arrayList6 = this.f2843;
                arrayList6.add(m1630(this.f2833) + "");
                ArrayList<String> arrayList7 = this.f2854;
                arrayList7.add(m1630(this.f2845) + "");
                int i26 = this.f2839;
                int i27 = SCROLL_TYPE.HOUR.value;
                if ((i26 & i27) != i27) {
                    this.f2823.add(m1630(this.f2826));
                } else {
                    int i28 = this.f2826;
                    while (i28 <= this.f2848) {
                        i28 = C1293.m3406(this, i28, this.f2823, i28, 1);
                    }
                }
                int i29 = this.f2839;
                int i30 = SCROLL_TYPE.MINUTE.value;
                if ((i29 & i30) != i30) {
                    this.f2844.add(m1630(this.f2853));
                } else {
                    int i31 = this.f2853;
                    while (i31 <= 59) {
                        i31 = C1293.m3406(this, i31, this.f2844, i31, 1);
                    }
                }
            } else if (this.f2835) {
                ArrayList<String> arrayList8 = this.f2834;
                arrayList8.add(String.valueOf(this.f2825) + "");
                ArrayList<String> arrayList9 = this.f2843;
                arrayList9.add(m1630(this.f2833) + "");
                ArrayList<String> arrayList10 = this.f2854;
                arrayList10.add(m1630(this.f2845) + "");
                this.f2823.add(m1630(this.f2826));
                int i32 = this.f2839;
                int i33 = SCROLL_TYPE.MINUTE.value;
                if ((i32 & i33) != i33) {
                    this.f2844.add(m1630(this.f2853));
                } else {
                    int i34 = this.f2853;
                    while (i34 <= this.f2830) {
                        i34 = C1293.m3406(this, i34, this.f2844, i34, 1);
                    }
                }
            }
            this.f2849.setData(this.f2834);
            this.f2838.setData(this.f2843);
            this.f2852.setData(this.f2854);
            this.f2836.setData(this.f2823);
            this.f2847.setData(this.f2844);
            this.f2849.setSelected(0);
            this.f2838.setSelected(0);
            this.f2852.setSelected(0);
            this.f2836.setSelected(0);
            this.f2847.setSelected(0);
            m1631();
            this.f2849.setOnSelectListener(new C0735(this));
            this.f2838.setOnSelectListener(new C0724(this));
            this.f2852.setOnSelectListener(new C0731(this));
            this.f2836.setOnSelectListener(new C0723(this));
            this.f2847.setOnSelectListener(new C0728(this));
            if (this.f2851) {
                String[] split = str.split(" ");
                String str2 = split[0];
                Log.d("tttt", str2.substring(0, 4) + "," + str2.substring(5, 7) + "," + str2.substring(8, str2.length()));
                India_DatePickerView india_DatePickerView = this.f2849;
                StringBuilder sb = new StringBuilder();
                sb.append(str2.substring(0, 4));
                sb.append("");
                india_DatePickerView.setSelected(sb.toString());
                this.f2828.set(1, Integer.parseInt(str2.substring(0, 4)));
                this.f2843.clear();
                int i35 = this.f2828.get(1);
                if (i35 == this.f2825) {
                    int i36 = this.f2833;
                    while (i36 <= 12) {
                        i36 = C1293.m3405(this, i36, new StringBuilder(), "", this.f2843, i36, 1);
                    }
                    i = 7;
                } else {
                    i = 7;
                    if (i35 == this.f2824) {
                        int i37 = 1;
                        while (i37 <= this.f2850) {
                            i37 = C1293.m3405(this, i37, new StringBuilder(), "", this.f2843, i37, 1);
                        }
                    } else {
                        int i38 = 1;
                        while (i38 <= 12) {
                            i38 = C1293.m3405(this, i38, new StringBuilder(), "", this.f2843, i38, 1);
                        }
                    }
                }
                this.f2838.setData(this.f2843);
                India_DatePickerView india_DatePickerView2 = this.f2838;
                india_DatePickerView2.setSelected(str2.substring(5, i) + "");
                this.f2828.set(2, Integer.parseInt(str2.substring(5, i)) - 1);
                this.f2854.clear();
                int i39 = this.f2828.get(2) + 1;
                if (i35 == this.f2825 && i39 == this.f2833) {
                    int i40 = this.f2845;
                    while (i40 <= this.f2828.getActualMaximum(5)) {
                        i40 = C1293.m3405(this, i40, new StringBuilder(), "", this.f2854, i40, 1);
                    }
                } else if (i35 == this.f2824 && i39 == this.f2850) {
                    int i41 = 1;
                    while (i41 <= this.f2832) {
                        i41 = C1293.m3405(this, i41, new StringBuilder(), "", this.f2854, i41, 1);
                    }
                } else {
                    int i42 = 1;
                    while (i42 <= this.f2828.getActualMaximum(5)) {
                        i42 = C1293.m3405(this, i42, new StringBuilder(), "", this.f2854, i42, 1);
                    }
                }
                this.f2852.setData(this.f2854);
                India_DatePickerView india_DatePickerView3 = this.f2852;
                india_DatePickerView3.setSelected(str2.substring(8, str2.length()) + "");
                this.f2828.set(5, Integer.parseInt(str2.substring(8, str2.length())));
                if (split.length == 2) {
                    String[] split2 = split[1].split(CertificateUtil.DELIMITER);
                    int i43 = this.f2839;
                    int i44 = SCROLL_TYPE.HOUR.value;
                    if ((i43 & i44) == i44) {
                        this.f2823.clear();
                        int i45 = this.f2828.get(5);
                        if (i35 == this.f2825 && i39 == this.f2833 && i45 == this.f2845) {
                            int i46 = this.f2826;
                            while (i46 <= 23) {
                                i46 = C1293.m3406(this, i46, this.f2823, i46, 1);
                            }
                        } else if (i35 == this.f2824 && i39 == this.f2850 && i45 == this.f2832) {
                            int i47 = 0;
                            while (i47 <= this.f2848) {
                                i47 = C1293.m3406(this, i47, this.f2823, i47, 1);
                            }
                        } else {
                            int i48 = 0;
                            while (i48 <= 23) {
                                i48 = C1293.m3406(this, i48, this.f2823, i48, 1);
                            }
                        }
                        this.f2836.setData(this.f2823);
                        this.f2836.setSelected(split2[0]);
                        this.f2828.set(11, Integer.parseInt(split2[0]));
                    }
                    int i49 = this.f2839;
                    int i50 = SCROLL_TYPE.MINUTE.value;
                    if ((i49 & i50) == i50) {
                        this.f2844.clear();
                        int i51 = this.f2828.get(5);
                        int i52 = this.f2828.get(11);
                        if (i35 == this.f2825 && i39 == this.f2833 && i51 == this.f2845 && i52 == this.f2826) {
                            int i53 = this.f2853;
                            while (i53 <= 59) {
                                i53 = C1293.m3406(this, i53, this.f2844, i53, 1);
                            }
                        } else if (i35 == this.f2824 && i39 == this.f2850 && i51 == this.f2832 && i52 == this.f2848) {
                            int i54 = 0;
                            while (i54 <= this.f2830) {
                                i54 = C1293.m3406(this, i54, this.f2844, i54, 1);
                            }
                        } else {
                            int i55 = 0;
                            while (i55 <= 59) {
                                i55 = C1293.m3406(this, i55, this.f2844, i55, 1);
                            }
                        }
                        this.f2847.setData(this.f2844);
                        this.f2847.setSelected(split2[1]);
                        this.f2828.set(12, Integer.parseInt(split2[1]));
                    }
                }
                m1631();
            }
            this.f2827.show();
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public final boolean m1633(String str, String str2) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(str2, Locale.CHINA);
        try {
            simpleDateFormat.setLenient(false);
            simpleDateFormat.parse(str);
            return true;
        } catch (Exception unused) {
            return false;
        }
    }
}
