unify theme setting, disable light theme on HC
This commit is contained in:
parent
16aaf4547f
commit
e9b049c540
@ -192,4 +192,5 @@
|
|||||||
<string name="requires_api5">Requires version 1.7.6</string>
|
<string name="requires_api5">Requires version 1.7.6</string>
|
||||||
<string name="labels">Labels</string>
|
<string name="labels">Labels</string>
|
||||||
<string name="article_img_view_caption">View Caption</string>
|
<string name="article_img_view_caption">View Caption</string>
|
||||||
|
<string name="light_theme_is_not_supported_on_honeycomb">Light theme is not supported on Honeycomb</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -30,11 +30,6 @@ public class CommonActivity extends FragmentActivity {
|
|||||||
|
|
||||||
protected SharedPreferences m_prefs;
|
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) {
|
protected void setSmallScreen(boolean smallScreen) {
|
||||||
Log.d(TAG, "m_smallScreenMode=" + smallScreen);
|
Log.d(TAG, "m_smallScreenMode=" + smallScreen);
|
||||||
m_smallScreenMode = smallScreen;
|
m_smallScreenMode = smallScreen;
|
||||||
@ -142,4 +137,24 @@ public class CommonActivity extends FragmentActivity {
|
|||||||
toast.show();
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,11 +40,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
m_prefs = PreferenceManager
|
m_prefs = PreferenceManager
|
||||||
.getDefaultSharedPreferences(getApplicationContext());
|
.getDefaultSharedPreferences(getApplicationContext());
|
||||||
|
|
||||||
if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) {
|
setAppTheme(m_prefs);
|
||||||
setTheme(R.style.DarkTheme);
|
|
||||||
} else {
|
|
||||||
setTheme(R.style.LightTheme);
|
|
||||||
}
|
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
@ -26,11 +26,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
|||||||
m_prefs = PreferenceManager
|
m_prefs = PreferenceManager
|
||||||
.getDefaultSharedPreferences(getApplicationContext());
|
.getDefaultSharedPreferences(getApplicationContext());
|
||||||
|
|
||||||
if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) {
|
setAppTheme(m_prefs);
|
||||||
setTheme(R.style.DarkTheme);
|
|
||||||
} else {
|
|
||||||
setTheme(R.style.LightTheme);
|
|
||||||
}
|
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
@ -146,15 +146,7 @@ public class OnlineActivity extends CommonActivity {
|
|||||||
m_prefs = PreferenceManager
|
m_prefs = PreferenceManager
|
||||||
.getDefaultSharedPreferences(getApplicationContext());
|
.getDefaultSharedPreferences(getApplicationContext());
|
||||||
|
|
||||||
if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) {
|
setAppTheme(m_prefs);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
@ -74,15 +74,7 @@ public class OfflineActivity extends CommonActivity {
|
|||||||
m_prefs = PreferenceManager
|
m_prefs = PreferenceManager
|
||||||
.getDefaultSharedPreferences(getApplicationContext());
|
.getDefaultSharedPreferences(getApplicationContext());
|
||||||
|
|
||||||
if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) {
|
setAppTheme(m_prefs);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
@ -30,11 +30,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
|
|||||||
m_prefs = PreferenceManager
|
m_prefs = PreferenceManager
|
||||||
.getDefaultSharedPreferences(getApplicationContext());
|
.getDefaultSharedPreferences(getApplicationContext());
|
||||||
|
|
||||||
if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) {
|
setAppTheme(m_prefs);
|
||||||
setTheme(R.style.DarkTheme);
|
|
||||||
} else {
|
|
||||||
setTheme(R.style.LightTheme);
|
|
||||||
}
|
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
@ -27,11 +27,7 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
|
|||||||
m_prefs = PreferenceManager
|
m_prefs = PreferenceManager
|
||||||
.getDefaultSharedPreferences(getApplicationContext());
|
.getDefaultSharedPreferences(getApplicationContext());
|
||||||
|
|
||||||
if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) {
|
setAppTheme(m_prefs);
|
||||||
setTheme(R.style.DarkTheme);
|
|
||||||
} else {
|
|
||||||
setTheme(R.style.LightTheme);
|
|
||||||
}
|
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user