From 90ca8b34d823eed19d26f6611716ca231d60424c Mon Sep 17 00:00:00 2001 From: Renard Date: Tue, 5 Apr 2016 01:52:13 -0300 Subject: Initial commit --- .../baiparser/ThemeManager.java | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 app/src/main/java/org/bienvenidoainternet/baiparser/ThemeManager.java (limited to 'app/src/main/java/org/bienvenidoainternet/baiparser/ThemeManager.java') diff --git a/app/src/main/java/org/bienvenidoainternet/baiparser/ThemeManager.java b/app/src/main/java/org/bienvenidoainternet/baiparser/ThemeManager.java new file mode 100644 index 0000000..7f0be86 --- /dev/null +++ b/app/src/main/java/org/bienvenidoainternet/baiparser/ThemeManager.java @@ -0,0 +1,55 @@ +package org.bienvenidoainternet.baiparser; + +import android.content.res.TypedArray; +import android.graphics.Color; + +/** + * Created by Renard on 16-03-2016. + */ +public class ThemeManager { + private MainActivity ac; + private int currentThemeId; + public ThemeManager(MainActivity ac){ + this.ac = ac; + this.currentThemeId = ac.getCurrentThemeId(); + } + + public int getSageColor(){ + TypedArray a = ac.getTheme().obtainStyledAttributes(currentThemeId, new int[]{R.attr.sageColor}); + return a.getColor(0, Color.CYAN); + } + + public int getMarginColor(){ + TypedArray a = ac.getTheme().obtainStyledAttributes(currentThemeId, new int[]{R.attr.marginColor}); + return a.getColor(0, Color.CYAN); + } + + public void updateThemeId(int id){ + this.currentThemeId = id; + } + + public int getNameColor() { + TypedArray a = ac.getTheme().obtainStyledAttributes(currentThemeId, new int[]{R.attr.nameColor}); + return a.getColor(0, Color.CYAN); + } + + public int getTripcodeColor() { + TypedArray a = ac.getTheme().obtainStyledAttributes(currentThemeId, new int[]{R.attr.tripcodeColor}); + return a.getColor(0, Color.CYAN); + } + + public int getPrimaryColor(){ + TypedArray a = ac.getTheme().obtainStyledAttributes(currentThemeId, new int[]{R.attr.colorPrimary}); + return a.getColor(0, Color.CYAN); + } + public int getPrimaryDarkColor(){ + TypedArray a = ac.getTheme().obtainStyledAttributes(currentThemeId, new int[]{R.attr.colorPrimaryDark}); + return a.getColor(0, Color.CYAN); + } + + public boolean isDarkTheme(){ + TypedArray a = ac.getTheme().obtainStyledAttributes(currentThemeId, new int[]{R.attr.isDarkTheme}); + return a.getBoolean(0, false); + } + +} -- cgit v1.2.1-18-gbd029