mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-11-26 06:47:03 +03:00
Colorize switches when branding is disabled
This commit is contained in:
parent
46359ae84f
commit
764b9bc050
1 changed files with 9 additions and 5 deletions
|
@ -2,6 +2,7 @@ package it.niedermann.owncloud.notes.branding;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -50,7 +51,7 @@ public class BrandedSwitchPreference extends SwitchPreference implements Branded
|
|||
public void onBindViewHolder(PreferenceViewHolder holder) {
|
||||
super.onBindViewHolder(holder);
|
||||
|
||||
if (BrandingUtil.isBrandingEnabled(getContext()) && holder.itemView instanceof ViewGroup) {
|
||||
if (holder.itemView instanceof ViewGroup) {
|
||||
switchView = findSwitchWidget(holder.itemView);
|
||||
if (mainColor != null && textColor != null) {
|
||||
applyBrand();
|
||||
|
@ -60,12 +61,15 @@ public class BrandedSwitchPreference extends SwitchPreference implements Branded
|
|||
|
||||
@Override
|
||||
public void applyBrand(@ColorInt int mainColor, @ColorInt int textColor) {
|
||||
if (BrandingUtil.isBrandingEnabled(getContext())) {
|
||||
this.mainColor = mainColor;
|
||||
this.textColor = textColor;
|
||||
// onBindViewHolder is called after applyBrand, therefore we have to store the given values and apply them later.
|
||||
if (BrandingUtil.isBrandingEnabled(getContext())) {
|
||||
applyBrand();
|
||||
} else {
|
||||
this.mainColor = getContext().getResources().getColor(R.color.defaultBrand);
|
||||
this.textColor = Color.WHITE;
|
||||
}
|
||||
// onBindViewHolder is called after applyBrand, therefore we have to store the given values and apply them later.
|
||||
applyBrand();
|
||||
}
|
||||
|
||||
private void applyBrand() {
|
||||
|
|
Loading…
Reference in a new issue