blob: 70db03aa081b5832e9b0b0c285dff6968967ed26 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
package it.niedermann.nextcloud.deck.ui.branding;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.ColorInt;
import androidx.annotation.Nullable;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceViewHolder;
import static it.niedermann.nextcloud.deck.DeckApplication.readCurrentAccountColor;
import static it.niedermann.nextcloud.deck.ui.branding.BrandingUtil.getSecondaryForegroundColorDependingOnTheme;
public class BrandedPreferenceCategory extends PreferenceCategory {
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
final View v = holder.itemView.findViewById(android.R.id.title);
@Nullable final Context context = getContext();
if (context != null && v instanceof TextView) {
@ColorInt final int mainColor = getSecondaryForegroundColorDependingOnTheme(context, readCurrentAccountColor(context));
((TextView) v).setTextColor(mainColor);
}
}
public BrandedPreferenceCategory(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
public BrandedPreferenceCategory(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public BrandedPreferenceCategory(Context context, AttributeSet attrs) {
super(context, attrs);
}
public BrandedPreferenceCategory(Context context) {
super(context);
}
}
|