package ῲ.ῲ.㴹;

import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import androidx.appcompat.R$attr;
import androidx.appcompat.R$color;
import androidx.appcompat.R$drawable;
import ῲ.ᨨ.ʬ.C1718;
import ῲ.ῲ.ῲ.K.C1940;
import ῲ.ῲ.㴹.C2012;

/* renamed from: ῲ.ῲ.㴹.㴹  reason: contains not printable characters */
/* compiled from: AppCompatDrawableManager */
public final class C2044 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public static C2044 f6950;

    /* renamed from: ῲ  reason: contains not printable characters */
    public static final PorterDuff.Mode f6951 = PorterDuff.Mode.SRC_IN;

    /* renamed from: K  reason: contains not printable characters */
    public C2012 f6952;

    /* renamed from: ῲ  reason: contains not printable characters */
    public static synchronized void m5311() {
        synchronized (C2044.class) {
            if (f6950 == null) {
                f6950 = new C2044();
                f6950.f6952 = C2012.m5203();
                f6950.f6952.m5213(new C2045());
            }
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public static synchronized C2044 m5313() {
        C2044 r1;
        synchronized (C2044.class) {
            if (f6950 == null) {
                m5311();
            }
            r1 = f6950;
        }
        return r1;
    }

    /* renamed from: K  reason: contains not printable characters */
    public synchronized Drawable m5316(Context context, int i) {
        return this.f6952.m5206(context, i);
    }

    /* renamed from: K  reason: contains not printable characters */
    public synchronized Drawable m5317(Context context, int i, boolean z) {
        return this.f6952.m5208(context, i, z);
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public synchronized ColorStateList m5315(Context context, int i) {
        return this.f6952.m5205(context, i);
    }

    /* renamed from: K  reason: contains not printable characters */
    public synchronized void m5318(Context context) {
        this.f6952.m5211(context);
    }

    /* renamed from: K  reason: contains not printable characters */
    public static void m5314(Drawable drawable, C2029 r1, int[] iArr) {
        C2012.m5204(drawable, r1, iArr);
    }

    /* renamed from: ῲ.ῲ.㴹.㴹$K  reason: contains not printable characters */
    /* compiled from: AppCompatDrawableManager */
    public class C2045 implements C2012.AbstractC2014 {

        /* renamed from: ʬ  reason: contains not printable characters */
        public final int[] f6953 = {R$drawable.abc_textfield_activated_mtrl_alpha, R$drawable.abc_textfield_search_activated_mtrl_alpha, R$drawable.abc_cab_background_top_mtrl_alpha, R$drawable.abc_text_cursor_material, R$drawable.abc_text_select_handle_left_mtrl_dark, R$drawable.abc_text_select_handle_middle_mtrl_dark, R$drawable.abc_text_select_handle_right_mtrl_dark, R$drawable.abc_text_select_handle_left_mtrl_light, R$drawable.abc_text_select_handle_middle_mtrl_light, R$drawable.abc_text_select_handle_right_mtrl_light};

        /* renamed from: ඓ  reason: contains not printable characters */
        public final int[] f6954 = {R$drawable.abc_tab_indicator_material, R$drawable.abc_textfield_search_material};

        /* renamed from: ῲ  reason: contains not printable characters */
        public final int[] f6955 = {R$drawable.abc_ic_commit_search_api_mtrl_alpha, R$drawable.abc_seekbar_tick_mark_material, R$drawable.abc_ic_menu_share_mtrl_alpha, R$drawable.abc_ic_menu_copy_mtrl_am_alpha, R$drawable.abc_ic_menu_cut_mtrl_alpha, R$drawable.abc_ic_menu_selectall_mtrl_alpha, R$drawable.abc_ic_menu_paste_mtrl_am_alpha};

        /* renamed from: K  reason: contains not printable characters */
        public final int[] f6956 = {R$drawable.abc_textfield_search_default_mtrl_alpha, R$drawable.abc_textfield_default_mtrl_alpha, R$drawable.abc_ab_share_pack_mtrl_alpha};

        /* renamed from: 㴹  reason: contains not printable characters */
        public final int[] f6957 = {R$drawable.abc_btn_check_material, R$drawable.abc_btn_radio_material, R$drawable.abc_btn_check_material_anim, R$drawable.abc_btn_radio_material_anim};

        /* renamed from: 㸾  reason: contains not printable characters */
        public final int[] f6958 = {R$drawable.abc_popup_background_mtrl_mult, R$drawable.abc_cab_background_internal_bg, R$drawable.abc_menu_hardkey_panel_mtrl_mult};

        /* JADX WARNING: Removed duplicated region for block: B:17:0x0049  */
        /* JADX WARNING: Removed duplicated region for block: B:24:0x0064 A[RETURN] */
        /* renamed from: ῲ  reason: contains not printable characters */
        public boolean m5320(Context context, int i, Drawable drawable) {
            boolean z;
            PorterDuff.Mode mode;
            int i2;
            PorterDuff.Mode mode2 = C2044.f6951;
            int i3 = 16842801;
            if (m5326(this.f6956, i)) {
                i3 = R$attr.colorControlNormal;
            } else if (m5326(this.f6953, i)) {
                i3 = R$attr.colorControlActivated;
            } else if (m5326(this.f6958, i)) {
                mode2 = PorterDuff.Mode.MULTIPLY;
            } else {
                if (i == R$drawable.abc_list_divider_mtrl_alpha) {
                    i3 = 16842800;
                    mode = mode2;
                    i2 = Math.round(40.8f);
                    z = true;
                } else if (i != R$drawable.abc_dialog_material_background) {
                    mode = mode2;
                    z = false;
                    i2 = -1;
                    i3 = 0;
                }
                if (z) {
                    return false;
                }
                if (C2021.m5243(drawable)) {
                    drawable = drawable.mutate();
                }
                drawable.setColorFilter(C2044.m5312(C2056.m5360(context, i3), mode));
                if (i2 != -1) {
                    drawable.setAlpha(i2);
                }
                return true;
            }
            mode = mode2;
            z = true;
            i2 = -1;
            if (z) {
            }
        }

        /* renamed from: K  reason: contains not printable characters */
        public final ColorStateList m5321(Context context, int i) {
            int r2 = C2056.m5360(context, R$attr.colorControlHighlight);
            int r6 = C2056.m5361(context, R$attr.colorButtonNormal);
            return new ColorStateList(new int[][]{C2056.f6998, C2056.f7002, C2056.f6996, C2056.f7001}, new int[]{r6, C1718.m4411(r2, i), C1718.m4411(r2, i), i});
        }

        /* renamed from: K  reason: contains not printable characters */
        public Drawable m5323(C2012 r4, Context context, int i) {
            if (i != R$drawable.abc_cab_background_top_material) {
                return null;
            }
            return new LayerDrawable(new Drawable[]{r4.m5206(context, R$drawable.abc_cab_background_internal_bg), r4.m5206(context, R$drawable.abc_cab_background_top_mtrl_alpha)});
        }

        /* renamed from: K  reason: contains not printable characters */
        public final void m5324(Drawable drawable, int i, PorterDuff.Mode mode) {
            if (C2021.m5243(drawable)) {
                drawable = drawable.mutate();
            }
            if (mode == null) {
                mode = C2044.f6951;
            }
            drawable.setColorFilter(C2044.m5312(i, mode));
        }

        /* renamed from: ῲ  reason: contains not printable characters */
        public ColorStateList m5319(Context context, int i) {
            if (i == R$drawable.abc_edit_text_material) {
                return C1940.m5018(context, R$color.abc_tint_edittext);
            }
            if (i == R$drawable.abc_switch_track_mtrl_alpha) {
                return C1940.m5018(context, R$color.abc_tint_switch_track);
            }
            if (i == R$drawable.abc_switch_thumb_material) {
                int[][] iArr = new int[3][];
                int[] iArr2 = new int[3];
                ColorStateList r2 = C2056.m5359(context, R$attr.colorSwitchThumbNormal);
                if (r2 == null || !r2.isStateful()) {
                    iArr[0] = C2056.f6998;
                    iArr2[0] = C2056.m5361(context, R$attr.colorSwitchThumbNormal);
                    iArr[1] = C2056.f6997;
                    iArr2[1] = C2056.m5360(context, R$attr.colorControlActivated);
                    iArr[2] = C2056.f7001;
                    iArr2[2] = C2056.m5360(context, R$attr.colorSwitchThumbNormal);
                } else {
                    iArr[0] = C2056.f6998;
                    iArr2[0] = r2.getColorForState(iArr[0], 0);
                    iArr[1] = C2056.f6997;
                    iArr2[1] = C2056.m5360(context, R$attr.colorControlActivated);
                    iArr[2] = C2056.f7001;
                    iArr2[2] = r2.getDefaultColor();
                }
                return new ColorStateList(iArr, iArr2);
            } else if (i == R$drawable.abc_btn_default_mtrl_shape) {
                return m5321(context, C2056.m5360(context, R$attr.colorButtonNormal));
            } else {
                if (i == R$drawable.abc_btn_borderless_material) {
                    return m5321(context, 0);
                }
                if (i == R$drawable.abc_btn_colored_material) {
                    return m5321(context, C2056.m5360(context, R$attr.colorAccent));
                }
                if (i == R$drawable.abc_spinner_mtrl_am_alpha || i == R$drawable.abc_spinner_textfield_background_material) {
                    return C1940.m5018(context, R$color.abc_tint_spinner);
                }
                if (m5326(this.f6955, i)) {
                    return C2056.m5359(context, R$attr.colorControlNormal);
                }
                if (m5326(this.f6954, i)) {
                    return C1940.m5018(context, R$color.abc_tint_default);
                }
                if (m5326(this.f6957, i)) {
                    return C1940.m5018(context, R$color.abc_tint_btn_checkable);
                }
                if (i == R$drawable.abc_seekbar_thumb_material) {
                    return C1940.m5018(context, R$color.abc_tint_seek_thumb);
                }
                return null;
            }
        }

        /* renamed from: K  reason: contains not printable characters */
        public boolean m5325(Context context, int i, Drawable drawable) {
            if (i == R$drawable.abc_seekbar_track_material) {
                LayerDrawable layerDrawable = (LayerDrawable) drawable;
                m5324(layerDrawable.findDrawableByLayerId(16908288), C2056.m5360(context, R$attr.colorControlNormal), C2044.f6951);
                m5324(layerDrawable.findDrawableByLayerId(16908303), C2056.m5360(context, R$attr.colorControlNormal), C2044.f6951);
                m5324(layerDrawable.findDrawableByLayerId(16908301), C2056.m5360(context, R$attr.colorControlActivated), C2044.f6951);
                return true;
            } else if (i != R$drawable.abc_ratingbar_material && i != R$drawable.abc_ratingbar_indicator_material && i != R$drawable.abc_ratingbar_small_material) {
                return false;
            } else {
                LayerDrawable layerDrawable2 = (LayerDrawable) drawable;
                m5324(layerDrawable2.findDrawableByLayerId(16908288), C2056.m5361(context, R$attr.colorControlNormal), C2044.f6951);
                m5324(layerDrawable2.findDrawableByLayerId(16908303), C2056.m5360(context, R$attr.colorControlActivated), C2044.f6951);
                m5324(layerDrawable2.findDrawableByLayerId(16908301), C2056.m5360(context, R$attr.colorControlActivated), C2044.f6951);
                return true;
            }
        }

        /* renamed from: K  reason: contains not printable characters */
        public final boolean m5326(int[] iArr, int i) {
            for (int i2 : iArr) {
                if (i2 == i) {
                    return true;
                }
            }
            return false;
        }

        /* renamed from: K  reason: contains not printable characters */
        public PorterDuff.Mode m5322(int i) {
            if (i == R$drawable.abc_switch_thumb_material) {
                return PorterDuff.Mode.MULTIPLY;
            }
            return null;
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public static synchronized PorterDuffColorFilter m5312(int i, PorterDuff.Mode mode) {
        PorterDuffColorFilter r1;
        synchronized (C2044.class) {
            r1 = C2012.m5202(i, mode);
        }
        return r1;
    }
}
