2016-10-26 16:23:14 +02:00
|
|
|
package com.github.dfa.diaspora_android.ui.theme;
|
2016-10-25 17:04:32 +02:00
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.preference.PreferenceCategory;
|
|
|
|
import android.util.AttributeSet;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.TextView;
|
|
|
|
|
2016-10-26 16:23:14 +02:00
|
|
|
import com.github.dfa.diaspora_android.util.AppSettings;
|
2016-10-25 17:04:32 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* PreferenceCategory with a colored title
|
|
|
|
* Created by vanitas on 24.10.16.
|
|
|
|
*/
|
|
|
|
|
|
|
|
public class ThemedPreferenceCategory extends PreferenceCategory implements Themeable {
|
|
|
|
protected TextView titleTextView;
|
2016-10-26 16:23:14 +02:00
|
|
|
|
2016-10-25 17:04:32 +02:00
|
|
|
@SuppressWarnings("unused")
|
|
|
|
public ThemedPreferenceCategory(Context context) {
|
|
|
|
super(context);
|
|
|
|
}
|
2016-10-26 16:23:14 +02:00
|
|
|
|
2016-10-25 17:04:32 +02:00
|
|
|
@SuppressWarnings("unused")
|
|
|
|
public ThemedPreferenceCategory(Context context, AttributeSet attrs) {
|
|
|
|
super(context, attrs);
|
|
|
|
}
|
2016-10-26 16:23:14 +02:00
|
|
|
|
2016-10-25 17:04:32 +02:00
|
|
|
@SuppressWarnings("unused")
|
|
|
|
public ThemedPreferenceCategory(Context context, AttributeSet attrs,
|
|
|
|
int defStyle) {
|
|
|
|
super(context, attrs, defStyle);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected View onCreateView(ViewGroup parent) {
|
|
|
|
View rootLayout = super.onCreateView(parent);
|
2018-03-30 00:38:31 +02:00
|
|
|
this.titleTextView = rootLayout.findViewById(android.R.id.title);
|
2016-10-25 17:04:32 +02:00
|
|
|
setColors();
|
|
|
|
return rootLayout;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setColors() {
|
2016-10-26 16:23:14 +02:00
|
|
|
if (titleTextView != null) {
|
2017-05-20 02:08:04 +02:00
|
|
|
ThemeHelper.getInstance(AppSettings.get());
|
2016-10-25 17:04:32 +02:00
|
|
|
ThemeHelper.updateTextViewTextColor(titleTextView);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|