Fix Global Settings compound buttons color

This commit is contained in:
Nazar 2020-02-18 13:48:51 +02:00
parent b9d217e675
commit 159e5dc319

View file

@ -387,14 +387,16 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
titleView.setSingleLine(false);
}
boolean enabled = preference.isEnabled();
if (isProfileDependent()) {
View cb = holder.itemView.findViewById(R.id.switchWidget);
if (cb == null) {
cb = holder.findViewById(android.R.id.checkbox);
}
if (cb instanceof CompoundButton) {
View cb = holder.itemView.findViewById(R.id.switchWidget);
if (cb == null) {
cb = holder.findViewById(android.R.id.checkbox);
}
if (cb instanceof CompoundButton) {
if (isProfileDependent()) {
int color = enabled ? getActiveProfileColor() : getDisabledTextColor();
UiUtilities.setupCompoundButton(isNightMode(), color, (CompoundButton) cb);
} else {
UiUtilities.setupCompoundButton((CompoundButton) cb, isNightMode(), UiUtilities.CompoundButtonType.GLOBAL);
}
}
if ((preference.isPersistent() || preference instanceof TwoStatePreference) && !(preference instanceof PreferenceCategory)) {