package k;

import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.view.LayoutInflater;
import com.riyaz.zvytour.R;

/* JADX INFO: loaded from: classes.dex */
public final class b extends ContextWrapper {

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

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

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

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

    public final void a() {
        if (this.f8563b == null) {
            this.f8563b = getResources().newTheme();
            Resources.Theme theme = getBaseContext().getTheme();
            if (theme != null) {
                this.f8563b.setTo(theme);
            }
        }
        this.f8563b.applyStyle(this.f8562a, 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.f8565d == null) {
            this.f8565d = super.getResources();
        }
        return this.f8565d;
    }

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

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

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