aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/org/bienvenidoainternet/baiparser/ThemeManager.java
diff options
context:
space:
mode:
authorLibravatar Renard 2016-04-26 15:59:17 -0300
committerLibravatar Renard 2016-04-26 15:59:17 -0300
commita5f9e1088f94890c44f70a2ebd4c38d7e86f2adf (patch)
tree6ce7659e46c1da14052fe9d29f1c05a60e99fe91 /app/src/main/java/org/bienvenidoainternet/baiparser/ThemeManager.java
parent034e14235e987b30d0ebc181b2d24c632035c453 (diff)
downloadBaiApp-a5f9e1088f94890c44f70a2ebd4c38d7e86f2adf.tar.gz
BaiApp-a5f9e1088f94890c44f70a2ebd4c38d7e86f2adf.tar.xz
BaiApp-a5f9e1088f94890c44f70a2ebd4c38d7e86f2adf.zip
packageID, gradle version fix, jsoup license.dev
Diffstat (limited to 'app/src/main/java/org/bienvenidoainternet/baiparser/ThemeManager.java')
-rw-r--r--app/src/main/java/org/bienvenidoainternet/baiparser/ThemeManager.java140
1 files changed, 0 insertions, 140 deletions
diff --git a/app/src/main/java/org/bienvenidoainternet/baiparser/ThemeManager.java b/app/src/main/java/org/bienvenidoainternet/baiparser/ThemeManager.java
deleted file mode 100644
index d223773..0000000
--- a/app/src/main/java/org/bienvenidoainternet/baiparser/ThemeManager.java
+++ /dev/null
@@ -1,140 +0,0 @@
-package org.bienvenidoainternet.baiparser;
-
-import android.app.Activity;
-import android.content.SharedPreferences;
-import android.content.res.TypedArray;
-import android.graphics.Color;
-import android.preference.PreferenceManager;
-import android.util.Log;
-
-/**
- * BaiApp - Bienvenido a internet Android Application
- * Copyright (C) 2016 Renard1911(https://github.com/Renard1911)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-public class ThemeManager {
- private int currentThemeId;
- private int prefThemeId;
- private Activity activity;
- public ThemeManager(Activity activity){
- this.activity = activity;
- setCurrentThemeId();
- }
-
- public void setCurrentThemeId(){
- SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(activity);
- int themeId = Integer.valueOf(settings.getString("pref_theme", "1"));
- prefThemeId = themeId;
- switch (themeId) {
- case 1:
- currentThemeId = R.style.AppTheme_NoActionBar;
- break;
- case 2:
- currentThemeId = R.style.AppTheme_Dark;
- break;
- case 3:
- currentThemeId = R.style.AppTheme_HeadLine;
-// setTheme(R.style.AppTheme_HeadLine_Activity);
- break;
- case 4:
- currentThemeId = R.style.AppTheme_Black;
-// setTheme(R.style.AppTheme_Black_Activity);
- break;
- }
- Log.d("ThemeManager", "isDarkTheme: " + isDarkTheme());
- }
-
- public int getSageColor(){
- TypedArray a = activity.getTheme().obtainStyledAttributes(currentThemeId, new int[]{R.attr.sageColor});
- return a.getColor(0, Color.CYAN);
- }
-
- public int getMarginColor(){
- TypedArray a = activity.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 = activity.getTheme().obtainStyledAttributes(currentThemeId, new int[]{R.attr.nameColor});
- return a.getColor(0, Color.CYAN);
- }
-
- public int getTripcodeColor() {
- TypedArray a = activity.getTheme().obtainStyledAttributes(currentThemeId, new int[]{R.attr.tripcodeColor});
- return a.getColor(0, Color.CYAN);
- }
-
- public int getPrimaryColor(){
- TypedArray a = activity.getTheme().obtainStyledAttributes(currentThemeId, new int[]{R.attr.colorPrimary});
- return a.getColor(0, Color.CYAN);
- }
- public int getPrimaryDarkColor(){
- TypedArray a = activity.getTheme().obtainStyledAttributes(currentThemeId, new int[]{R.attr.colorPrimaryDark});
- return a.getColor(0, Color.CYAN);
- }
-
- public boolean isDarkTheme(){
- TypedArray a = activity.getTheme().obtainStyledAttributes(currentThemeId, new int[]{R.attr.isDarkTheme});
- return a.getBoolean(0, false);
- }
-
- public int getThemeForActivity(){
- int id = R.style.AppTheme;
- switch (prefThemeId) {
- case 1: // pseudoch
- id = R.style.AppTheme;
- break;
- case 2: // nightmode
- id = R.style.AppTheme;
- break;
- case 3: // photon
- id = R.style.AppTheme_HeadLineActionBar;
- break;
- case 4: // tomorrow
- id = R.style.AppTheme_BlackActionBar;
- break;
- }
- return id;
- }
-
- public int getThemeForMainActivity(){
- int id = R.style.AppTheme_NoActionBar;
- switch (prefThemeId) {
- case 1: // pseudoch
- id = R.style.AppTheme_NoActionBar;
- break;
- case 2: // nightmode
- id = R.style.AppTheme_NoActionBar;
- break;
- case 3: // photon
- id = R.style.AppTheme_HeadLineActionBar_NoActionBar;
- break;
- case 4: // tomorrow
- id = R.style.AppTheme_BlackActionBar_NoActionBar;
- break;
- }
- return id;
- }
-
-
- public int getCurrentThemeId() {
- return currentThemeId;
- }
-}