package com.ifpdos.factorytest;

import android.content.Context;
import android.content.res.TypedArray;
import android.os.SystemProperties;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;

/* JADX INFO: compiled from: ConfigLoader.kt */
/* JADX INFO: loaded from: classes.dex */
@Metadata(d1 = {"\u0000>\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\u0007\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\bÆ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J \u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\u00062\b\b\u0002\u0010\n\u001a\u00020\u000bJ\u0016\u0010\f\u001a\u00020\b2\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\bJ\u0016\u0010\r\u001a\u00020\u000e2\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\u000eJ \u0010\u000f\u001a\u00020\b2\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\b2\b\b\u0002\u0010\n\u001a\u00020\u000bJ\u0018\u0010\u0010\u001a\u00020\u000b2\u0006\u0010\u0007\u001a\u00020\b2\b\b\u0002\u0010\n\u001a\u00020\u000bJ\u0016\u0010\u0011\u001a\u00020\u00122\u0006\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\bR\u000e\u0010\u0003\u001a\u00020\u0004X\u0082.¢\u0006\u0002\n\u0000¨\u0006\u0016"}, d2 = {"Lcom/ifpdos/factorytest/ConfigLoader;", "", "()V", "typedArray", "Landroid/content/res/TypedArray;", "getBoolean", "", "index", "", "def", "prop", "", "getColor", "getFloat", "", "getInt", "getString", "loadConfig", "", "context", "Landroid/content/Context;", "config", "app_generalRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class ConfigLoader {
    public static final ConfigLoader INSTANCE = new ConfigLoader();
    private static TypedArray typedArray;

    private ConfigLoader() {
    }

    public final void loadConfig(Context context, int config) {
        Intrinsics.checkNotNullParameter(context, "context");
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(config, R.styleable.Config);
        Intrinsics.checkNotNullExpressionValue(typedArrayObtainStyledAttributes, "context.obtainStyledAttr…nfig, R.styleable.Config)");
        typedArray = typedArrayObtainStyledAttributes;
    }

    public static /* synthetic */ String getString$default(ConfigLoader configLoader, int i, String str, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            str = "";
        }
        return configLoader.getString(i, str);
    }

    public final String getString(int index, String prop) {
        Intrinsics.checkNotNullParameter(prop, "prop");
        TypedArray typedArray2 = typedArray;
        if (typedArray2 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("typedArray");
            typedArray2 = null;
        }
        String string = typedArray2.getString(index);
        if (string == null) {
            string = "";
        }
        if (prop.length() <= 0) {
            return string;
        }
        String str = SystemProperties.get(prop, string);
        Intrinsics.checkNotNullExpressionValue(str, "get(prop, config)");
        return str;
    }

    public static /* synthetic */ int getInt$default(ConfigLoader configLoader, int i, int i2, String str, int i3, Object obj) {
        if ((i3 & 4) != 0) {
            str = "";
        }
        return configLoader.getInt(i, i2, str);
    }

    public final int getInt(int index, int def, String prop) {
        Intrinsics.checkNotNullParameter(prop, "prop");
        TypedArray typedArray2 = typedArray;
        if (typedArray2 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("typedArray");
            typedArray2 = null;
        }
        int i = typedArray2.getInt(index, def);
        return prop.length() > 0 ? SystemProperties.getInt(prop, i) : i;
    }

    public static /* synthetic */ boolean getBoolean$default(ConfigLoader configLoader, int i, boolean z, String str, int i2, Object obj) {
        if ((i2 & 4) != 0) {
            str = "";
        }
        return configLoader.getBoolean(i, z, str);
    }

    public final boolean getBoolean(int index, boolean def, String prop) {
        Intrinsics.checkNotNullParameter(prop, "prop");
        TypedArray typedArray2 = typedArray;
        if (typedArray2 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("typedArray");
            typedArray2 = null;
        }
        boolean z = typedArray2.getBoolean(index, def);
        return prop.length() > 0 ? SystemProperties.getBoolean(prop, z) : z;
    }

    public final float getFloat(int index, float def) {
        TypedArray typedArray2 = typedArray;
        if (typedArray2 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("typedArray");
            typedArray2 = null;
        }
        return typedArray2.getFloat(index, def);
    }

    public final int getColor(int index, int def) {
        TypedArray typedArray2 = typedArray;
        if (typedArray2 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("typedArray");
            typedArray2 = null;
        }
        return typedArray2.getColor(index, def);
    }
}
