aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/org/bienvenidoainternet/baiparser/ThemeManager.java
blob: 7f0be8614d6c8b07c17d7fd81088ba52416e20dc (plain) (blame)
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
46
47
48
49
50
51
52
53
54
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);
    }

}