diff options
author | Andrew Dolgov <[email protected]> | 2014-10-15 19:25:44 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2014-10-15 19:25:44 +0400 |
commit | f292677c71dce9dff4135988f39ab994f59571ec (patch) | |
tree | 27142210d26f706e9a3afba8eba2ca5d3d1612e1 /src/org | |
parent | 3e66d43c16b79e6f7348055c5a5e21efc935427e (diff) |
rename generic dark theme to holo, set light as default theme
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/fox/ttrss/ArticleFragment.java | 6 | ||||
-rw-r--r-- | src/org/fox/ttrss/CommonActivity.java | 24 | ||||
-rw-r--r-- | src/org/fox/ttrss/HeadlinesFragment.java | 6 | ||||
-rw-r--r-- | src/org/fox/ttrss/offline/OfflineArticleFragment.java | 9 |
4 files changed, 25 insertions, 20 deletions
diff --git a/src/org/fox/ttrss/ArticleFragment.java b/src/org/fox/ttrss/ArticleFragment.java index 396253c2..4a568d3c 100644 --- a/src/org/fox/ttrss/ArticleFragment.java +++ b/src/org/fox/ttrss/ArticleFragment.java @@ -260,11 +260,11 @@ public class ArticleFragment extends Fragment { TypedValue tv = new TypedValue(); getActivity().getTheme().resolveAttribute(R.attr.linkColor, tv, true); - String theme = m_prefs.getString("theme", "THEME_DARK"); + String theme = m_prefs.getString("theme", CommonActivity.THEME_DEFAULT); - if ("THEME_DARK".equals(theme) || "THEME_SYSTEM".equals(theme)) { + if (CommonActivity.THEME_HOLO.equals(theme)) { cssOverride = "body { background : transparent; color : #e0e0e0}"; - } else if ("THEME_DARK_GRAY".equals(theme)) { + } else if (CommonActivity.THEME_DARK.equals(theme)) { cssOverride = "body { background : transparent; color : #e0e0e0}"; } else { cssOverride = "body { background : transparent; }"; diff --git a/src/org/fox/ttrss/CommonActivity.java b/src/org/fox/ttrss/CommonActivity.java index b61240f3..47adbb1c 100644 --- a/src/org/fox/ttrss/CommonActivity.java +++ b/src/org/fox/ttrss/CommonActivity.java @@ -24,6 +24,12 @@ public class CommonActivity extends ActionBarActivity { public final static String FRAG_FEEDS = "feeds"; public final static String FRAG_CATS = "cats"; + public final static String THEME_DARK = "THEME_DARK"; + public final static String THEME_LIGHT = "THEME_LIGHT"; + public final static String THEME_SEPIA = "THEME_SEPIA"; + public final static String THEME_HOLO = "THEME_HOLO"; + public final static String THEME_DEFAULT = CommonActivity.THEME_LIGHT; + public static final int EXCERPT_MAX_SIZE = 200; private SQLiteDatabase m_readableDb; @@ -95,7 +101,7 @@ public class CommonActivity extends ActionBarActivity { public void onResume() { super.onResume(); - if (!m_theme.equals(m_prefs.getString("theme", "THEME_DARK"))) { + if (!m_theme.equals(m_prefs.getString("theme", CommonActivity.THEME_DEFAULT))) { Log.d(TAG, "theme changed, restarting"); finish(); @@ -172,22 +178,20 @@ public class CommonActivity extends ActionBarActivity { } public boolean isDarkTheme() { - String defaultTheme = "THEME_DARK"; + String theme = m_prefs.getString("theme", THEME_DEFAULT); - return (m_prefs.getString("theme", defaultTheme).equals("THEME_DARK")) || - m_prefs.getString("theme", defaultTheme).equals("THEME_SYSTEM") || - m_prefs.getString("theme", defaultTheme).equals("THEME_DARK_GRAY"); + return theme.equals(THEME_DARK) || theme.equals(THEME_HOLO); } protected void setAppTheme(SharedPreferences prefs) { - String defaultTheme = "THEME_DARK"; + String theme = prefs.getString("theme", CommonActivity.THEME_DEFAULT); - if (prefs.getString("theme", defaultTheme).equals("THEME_DARK")) { + if (theme.equals(THEME_DARK)) { setTheme(R.style.DarkTheme); - } else if (prefs.getString("theme", defaultTheme).equals("THEME_SEPIA")) { + } else if (theme.equals(THEME_SEPIA)) { setTheme(R.style.SepiaTheme); - } else if (prefs.getString("theme", defaultTheme).equals("THEME_DARK_GRAY")) { - setTheme(R.style.DarkGrayTheme); + } else if (theme.equals(THEME_HOLO)) { + setTheme(R.style.HoloTheme); } else { setTheme(R.style.LightTheme); } diff --git a/src/org/fox/ttrss/HeadlinesFragment.java b/src/org/fox/ttrss/HeadlinesFragment.java index 5aa14589..3321deb9 100644 --- a/src/org/fox/ttrss/HeadlinesFragment.java +++ b/src/org/fox/ttrss/HeadlinesFragment.java @@ -824,11 +824,11 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, getActivity().getTheme().resolveAttribute(R.attr.linkColor, tv, true); String cssOverride = ""; - String theme = m_prefs.getString("theme", "THEME_DARK"); + String theme = m_prefs.getString("theme", CommonActivity.THEME_DEFAULT); - if ("THEME_DARK".equals(theme) || "THEME_SYSTEM".equals(theme)) { + if (CommonActivity.THEME_HOLO.equals(theme)) { cssOverride = "body { background : transparent; color : #e0e0e0}"; - } else if ("THEME_DARK_GRAY".equals(theme)) { + } else if (CommonActivity.THEME_DARK.equals(theme)) { cssOverride = "body { background : transparent; color : #e0e0e0}"; } else { cssOverride = "body { background : transparent; }"; diff --git a/src/org/fox/ttrss/offline/OfflineArticleFragment.java b/src/org/fox/ttrss/offline/OfflineArticleFragment.java index 9042421b..985150a9 100644 --- a/src/org/fox/ttrss/offline/OfflineArticleFragment.java +++ b/src/org/fox/ttrss/offline/OfflineArticleFragment.java @@ -7,6 +7,7 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; +import org.fox.ttrss.CommonActivity; import org.fox.ttrss.R; import org.fox.ttrss.util.ImageCacheService; import org.fox.ttrss.util.TypefaceCache; @@ -267,11 +268,11 @@ public class OfflineArticleFragment extends Fragment { } } - String theme = m_prefs.getString("theme", "THEME_DARK"); - - if ("THEME_DARK".equals(theme) || "THEME_SYSTEM".equals(theme)) { + String theme = m_prefs.getString("theme", CommonActivity.THEME_DEFAULT); + + if (CommonActivity.THEME_HOLO.equals(theme)) { cssOverride = "body { background : transparent; color : #e0e0e0}"; - } else if ("THEME_DARK_GRAY".equals(theme)) { + } else if (CommonActivity.THEME_DARK.equals(theme)) { cssOverride = "body { background : transparent; color : #e0e0e0}"; } else { cssOverride = "body { background : transparent; }"; |