package l;

import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.view.LayoutInflater;
import com.martsnew.tv.R;

/* JADX INFO: renamed from: l.b, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1117b extends ContextWrapper {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public int f14211a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public Resources.Theme f14212b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public LayoutInflater f14213c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public Resources f14214d;

    public final void a() {
        if (this.f14212b == null) {
            this.f14212b = getResources().newTheme();
            Resources.Theme theme = getBaseContext().getTheme();
            if (theme != null) {
                this.f14212b.setTo(theme);
            }
        }
        this.f14212b.applyStyle(this.f14211a, true);
    }

    @Override // android.content.ContextWrapper
    public final void attachBaseContext(Context context) {
        super.attachBaseContext(context);
    }

    @Override // android.content.ContextWrapper, android.content.Context
    public final AssetManager getAssets() {
        return getResources().getAssets();
    }

    @Override // android.content.ContextWrapper, android.content.Context
    public final Resources getResources() {
        if (this.f14214d == null) {
            this.f14214d = super.getResources();
        }
        return this.f14214d;
    }

    @Override // android.content.ContextWrapper, android.content.Context
    public final Object getSystemService(String str) {
        if (!"layout_inflater".equals(str)) {
            return getBaseContext().getSystemService(str);
        }
        if (this.f14213c == null) {
            this.f14213c = LayoutInflater.from(getBaseContext()).cloneInContext(this);
        }
        return this.f14213c;
    }

    @Override // android.content.ContextWrapper, android.content.Context
    public final Resources.Theme getTheme() {
        Resources.Theme theme = this.f14212b;
        if (theme != null) {
            return theme;
        }
        if (this.f14211a == 0) {
            this.f14211a = R.style.Theme_AppCompat_Light;
        }
        a();
        return this.f14212b;
    }

    @Override // android.content.ContextWrapper, android.content.Context
    public final void setTheme(int i) {
        if (this.f14211a != i) {
            this.f14211a = i;
            a();
        }
    }
}
