diff --git a/res/values/strings.xml b/res/values/strings.xml
index a24ab9a5..bdcfa61d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -192,4 +192,5 @@
Requires version 1.7.6
Labels
View Caption
+ Light theme is not supported on Honeycomb
diff --git a/src/org/fox/ttrss/CommonActivity.java b/src/org/fox/ttrss/CommonActivity.java
index 0566aaf8..3db70fdf 100644
--- a/src/org/fox/ttrss/CommonActivity.java
+++ b/src/org/fox/ttrss/CommonActivity.java
@@ -30,11 +30,6 @@ public class CommonActivity extends FragmentActivity {
protected SharedPreferences m_prefs;
- protected boolean isDarkTheme() {
- return m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK") ||
- m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK_GRAY");
- }
-
protected void setSmallScreen(boolean smallScreen) {
Log.d(TAG, "m_smallScreenMode=" + smallScreen);
m_smallScreenMode = smallScreen;
@@ -142,4 +137,24 @@ public class CommonActivity extends FragmentActivity {
toast.show();
}
+ protected void setAppTheme(SharedPreferences prefs) {
+ String defaultTheme = "THEME_DARK";
+
+ if (prefs.getString("theme", defaultTheme).equals("THEME_DARK")) {
+ setTheme(R.style.DarkTheme);
+ } else if (prefs.getString("theme", defaultTheme).equals("THEME_SEPIA")) {
+ setTheme(R.style.SepiaTheme);
+ } else if (prefs.getString("theme", defaultTheme).equals("THEME_DARK_GRAY")) {
+ setTheme(R.style.DarkGrayTheme);
+ } else {
+ // LightTheme is not supported on honeycomb
+
+ if (android.os.Build.VERSION.SDK_INT >= 11 && android.os.Build.VERSION.SDK_INT < 14) {
+ toast(R.string.light_theme_is_not_supported_on_honeycomb);
+ setTheme(R.style.DarkTheme);
+ } else {
+ setTheme(R.style.LightTheme);
+ }
+ }
+ }
}
diff --git a/src/org/fox/ttrss/FeedsActivity.java b/src/org/fox/ttrss/FeedsActivity.java
index 6e725e99..8904d4cb 100644
--- a/src/org/fox/ttrss/FeedsActivity.java
+++ b/src/org/fox/ttrss/FeedsActivity.java
@@ -40,11 +40,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
m_prefs = PreferenceManager
.getDefaultSharedPreferences(getApplicationContext());
- if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) {
- setTheme(R.style.DarkTheme);
- } else {
- setTheme(R.style.LightTheme);
- }
+ setAppTheme(m_prefs);
super.onCreate(savedInstanceState);
diff --git a/src/org/fox/ttrss/HeadlinesActivity.java b/src/org/fox/ttrss/HeadlinesActivity.java
index 5c4e5e3e..bccc9e79 100644
--- a/src/org/fox/ttrss/HeadlinesActivity.java
+++ b/src/org/fox/ttrss/HeadlinesActivity.java
@@ -26,11 +26,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
m_prefs = PreferenceManager
.getDefaultSharedPreferences(getApplicationContext());
- if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) {
- setTheme(R.style.DarkTheme);
- } else {
- setTheme(R.style.LightTheme);
- }
+ setAppTheme(m_prefs);
super.onCreate(savedInstanceState);
diff --git a/src/org/fox/ttrss/OnlineActivity.java b/src/org/fox/ttrss/OnlineActivity.java
index d398843b..56ee6479 100644
--- a/src/org/fox/ttrss/OnlineActivity.java
+++ b/src/org/fox/ttrss/OnlineActivity.java
@@ -145,16 +145,8 @@ public class OnlineActivity extends CommonActivity {
// we use that before parent onCreate so let's init locally
m_prefs = PreferenceManager
.getDefaultSharedPreferences(getApplicationContext());
-
- if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) {
- setTheme(R.style.DarkTheme);
- } else if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_SEPIA")) {
- setTheme(R.style.SepiaTheme);
- } else if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK_GRAY")) {
- setTheme(R.style.DarkGrayTheme);
- } else {
- setTheme(R.style.LightTheme);
- }
+
+ setAppTheme(m_prefs);
super.onCreate(savedInstanceState);
diff --git a/src/org/fox/ttrss/offline/OfflineActivity.java b/src/org/fox/ttrss/offline/OfflineActivity.java
index 78102c1a..2c679a7f 100644
--- a/src/org/fox/ttrss/offline/OfflineActivity.java
+++ b/src/org/fox/ttrss/offline/OfflineActivity.java
@@ -74,15 +74,7 @@ public class OfflineActivity extends CommonActivity {
m_prefs = PreferenceManager
.getDefaultSharedPreferences(getApplicationContext());
- if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) {
- setTheme(R.style.DarkTheme);
- } else if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_SEPIA")) {
- setTheme(R.style.SepiaTheme);
- } else if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK_GRAY")) {
- setTheme(R.style.DarkGrayTheme);
- } else {
- setTheme(R.style.LightTheme);
- }
+ setAppTheme(m_prefs);
super.onCreate(savedInstanceState);
diff --git a/src/org/fox/ttrss/offline/OfflineFeedsActivity.java b/src/org/fox/ttrss/offline/OfflineFeedsActivity.java
index 002d74e4..7d301161 100644
--- a/src/org/fox/ttrss/offline/OfflineFeedsActivity.java
+++ b/src/org/fox/ttrss/offline/OfflineFeedsActivity.java
@@ -30,11 +30,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
m_prefs = PreferenceManager
.getDefaultSharedPreferences(getApplicationContext());
- if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) {
- setTheme(R.style.DarkTheme);
- } else {
- setTheme(R.style.LightTheme);
- }
+ setAppTheme(m_prefs);
super.onCreate(savedInstanceState);
diff --git a/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java b/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java
index f4352158..6faa292b 100644
--- a/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java
+++ b/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java
@@ -27,11 +27,7 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
m_prefs = PreferenceManager
.getDefaultSharedPreferences(getApplicationContext());
- if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) {
- setTheme(R.style.DarkTheme);
- } else {
- setTheme(R.style.LightTheme);
- }
+ setAppTheme(m_prefs);
super.onCreate(savedInstanceState);