discord-jadx/app/src/main/java/j/d.java
2022-04-15 08:15:37 +00:00

137 lines
4.2 KiB
Java

package j;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.AssetManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.view.LayoutInflater;
import e.i;
/* compiled from: ContextThemeWrapper.java */
/* loaded from: classes.dex */
public class d extends ContextWrapper {
/* renamed from: a reason: collision with root package name */
private int f14466a;
/* renamed from: b reason: collision with root package name */
private Resources.Theme f14467b;
/* renamed from: c reason: collision with root package name */
private LayoutInflater f14468c;
/* renamed from: d reason: collision with root package name */
private Configuration f14469d;
/* renamed from: e reason: collision with root package name */
private Resources f14470e;
public d() {
super(null);
}
public d(Context context, int i10) {
super(context);
this.f14466a = i10;
}
public d(Context context, Resources.Theme theme) {
super(context);
this.f14467b = theme;
}
private Resources b() {
if (this.f14470e == null) {
Configuration configuration = this.f14469d;
if (configuration == null) {
this.f14470e = super.getResources();
} else if (Build.VERSION.SDK_INT >= 17) {
this.f14470e = createConfigurationContext(configuration).getResources();
} else {
Resources resources = super.getResources();
Configuration configuration2 = new Configuration(resources.getConfiguration());
configuration2.updateFrom(this.f14469d);
this.f14470e = new Resources(resources.getAssets(), resources.getDisplayMetrics(), configuration2);
}
}
return this.f14470e;
}
private void d() {
boolean z10 = this.f14467b == null;
if (z10) {
this.f14467b = getResources().newTheme();
Resources.Theme theme = getBaseContext().getTheme();
if (theme != null) {
this.f14467b.setTo(theme);
}
}
e(this.f14467b, this.f14466a, z10);
}
public void a(Configuration configuration) {
if (this.f14470e != null) {
throw new IllegalStateException("getResources() or getAssets() has already been called");
} else if (this.f14469d == null) {
this.f14469d = new Configuration(configuration);
} else {
throw new IllegalStateException("Override configuration has already been set");
}
}
@Override // android.content.ContextWrapper
protected void attachBaseContext(Context context) {
super.attachBaseContext(context);
}
public int c() {
return this.f14466a;
}
protected void e(Resources.Theme theme, int i10, boolean z10) {
theme.applyStyle(i10, true);
}
@Override // android.content.ContextWrapper, android.content.Context
public AssetManager getAssets() {
return getResources().getAssets();
}
@Override // android.content.ContextWrapper, android.content.Context
public Resources getResources() {
return b();
}
@Override // android.content.ContextWrapper, android.content.Context
public Object getSystemService(String str) {
if (!"layout_inflater".equals(str)) {
return getBaseContext().getSystemService(str);
}
if (this.f14468c == null) {
this.f14468c = LayoutInflater.from(getBaseContext()).cloneInContext(this);
}
return this.f14468c;
}
@Override // android.content.ContextWrapper, android.content.Context
public Resources.Theme getTheme() {
Resources.Theme theme = this.f14467b;
if (theme != null) {
return theme;
}
if (this.f14466a == 0) {
this.f14466a = i.f10337d;
}
d();
return this.f14467b;
}
@Override // android.content.ContextWrapper, android.content.Context
public void setTheme(int i10) {
if (this.f14466a != i10) {
this.f14466a = i10;
d();
}
}
}