rename generic dark theme to holo, set light as default theme

This commit is contained in:
Andrew Dolgov 2014-10-15 19:25:44 +04:00
parent 3e66d43c16
commit f292677c71
7 changed files with 34 additions and 29 deletions

View File

@ -1,15 +1,15 @@
<resources>
<string-array name="pref_theme_names">
<item>@string/theme_dark</item>
<item>@string/theme_dark_gray</item>
<item>@string/theme_light</item>
<item>@string/theme_dark</item>
<item>@string/theme_sepia</item>
<item>@string/theme_holo</item>
</string-array>
<string-array name="pref_theme_values" translatable="false">
<item>THEME_DARK</item>
<item>THEME_DARK_GRAY</item>
<item>THEME_LIGHT</item>
<item>THEME_DARK</item>
<item>THEME_SEPIA</item>
<item>THEME_HOLO</item>
</string-array>
<string-array name="pref_view_mode_names">
<item>@string/category_browse_headlines</item>

View File

@ -15,9 +15,10 @@
<string name="pref_theme">Theme</string>
<string name="pref_theme_long">Changes color theme of the application</string>
<string name="ttrss_url">Tiny Tiny RSS URL</string>
<string name="theme_dark">Dark</string>
<string name="preferences">Settings</string>
<string name="theme_light">Light</string>
<string name="theme_dark">Dark</string>
<string name="theme_holo">Holo</string>
<string name="preferences">Settings</string>
<string name="connection">Connection</string>
<string name="headline_context_multiple">Selected articles</string>
<string name="http_authentication">HTTP Authentication</string>
@ -156,7 +157,6 @@
<string name="trial_thanks">Full version, thank you for support!</string>
<string name="prefs_fullscreen_mode">Fullscreen mode</string>
<string name="reading">Reading</string>
<string name="theme_dark_gray">Dark gray</string>
<string name="offline_articles_to_download">Amount of articles to download</string>
<string name="offline_articles_to_download_long">How many articles to download for offline mode (newest first).</string>
<string name="pref_headlines_show_content_long">Show content previews in headlines list</string>

View File

@ -47,7 +47,7 @@
<item name="android:actionBarStyle">@style/ActionBar.Sepia</item>
</style>
<style name="DarkTheme" parent="Theme.AppCompat">
<style name="HoloTheme" parent="Theme.AppCompat">
<item name="smallScreenBackground">@android:color/transparent</item>
<item name="ttrssHorizontalDivider">@android:drawable/divider_horizontal_dark</item>
<item name="feedlistBackground">@android:color/transparent</item>
@ -77,7 +77,7 @@
<item name="articleNoteBackground">#303030</item>
</style>
<style name="DarkGrayTheme" parent="DarkTheme">
<style name="DarkTheme" parent="HoloTheme">
<item name="smallScreenBackground">@color/feeds_dark_gray</item>
<item name="ttrssHorizontalDivider">@android:drawable/divider_horizontal_dark</item>
<item name="feedlistBackground">@drawable/shadow_feeds_gray</item>

View File

@ -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; }";

View File

@ -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);
}

View File

@ -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; }";

View File

@ -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");
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; }";