add amber theme

This commit is contained in:
Andrew Dolgov 2014-11-12 15:15:12 +03:00
parent 9ad5384b38
commit c8e8aaf850
15 changed files with 127 additions and 104 deletions

View File

@ -123,29 +123,6 @@ public class ArticleFragment extends Fragment {
}
}
/* if (!useTitleWebView) {
View scroll = view.findViewById(R.id.article_scrollview);
if (scroll != null) {
final float scale = getResources().getDisplayMetrics().density;
if (m_activity.isSmallScreen()) {
scroll.setPadding((int)(8 * scale + 0.5f),
(int)(5 * scale + 0.5f),
(int)(8 * scale + 0.5f),
0);
} else {
scroll.setPadding((int)(25 * scale + 0.5f),
(int)(10 * scale + 0.5f),
(int)(25 * scale + 0.5f),
0);
}
}
} */
int articleFontSize = Integer.parseInt(m_prefs.getString("article_font_size_sp", "16"));
int articleSmallFontSize = Math.max(10, Math.min(18, articleFontSize - 2));
@ -282,9 +259,12 @@ public class ArticleFragment extends Fragment {
cssOverride = "body { background : "+ backgroundHexColor+"; }";
if (m_activity.isDarkTheme()) {
cssOverride += "body { color : #e0e0e0; }";
}
TypedValue tvTextColor = new TypedValue();
getActivity().getTheme().resolveAttribute(R.attr.articleTextColor, tvTextColor, true);
String textColor = String.format("#%06X", (0xFFFFFF & tvTextColor.data));
cssOverride += "body { color : "+textColor+"; }";
TypedValue tvLinkColor = new TypedValue();
getActivity().getTheme().resolveAttribute(R.attr.linkColor, tvLinkColor, true);

View File

@ -29,6 +29,7 @@ public class CommonActivity extends ActionBarActivity {
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_AMBER = "THEME_AMBER";
public final static String THEME_DEFAULT = CommonActivity.THEME_LIGHT;
public static final int EXCERPT_MAX_SIZE = 200;
@ -202,14 +203,16 @@ public class CommonActivity extends ActionBarActivity {
public boolean isDarkTheme() {
String theme = m_prefs.getString("theme", THEME_DEFAULT);
return theme.equals(THEME_DARK);
return theme.equals(THEME_DARK) || theme.equals(THEME_AMBER);
}
protected void setAppTheme(SharedPreferences prefs) {
String theme = prefs.getString("theme", CommonActivity.THEME_DEFAULT);
if (theme.equals(THEME_DARK)) {
setTheme(R.style.DarkTheme);
setTheme(R.style.DarkTheme);
} else if (theme.equals(THEME_AMBER)) {
setTheme(R.style.AmberTheme);
} else if (theme.equals(THEME_SEPIA)) {
setTheme(R.style.SepiaTheme);
} else {

View File

@ -164,26 +164,6 @@ public class OfflineArticleFragment extends Fragment {
fab.setVisibility(View.GONE);
}
}
/* View scroll = view.findViewById(R.id.article_scrollview);
if (scroll != null) {
final float scale = getResources().getDisplayMetrics().density;
if (m_activity.isSmallScreen()) {
scroll.setPadding((int)(8 * scale + 0.5f),
(int)(5 * scale + 0.5f),
(int)(8 * scale + 0.5f),
0);
} else {
scroll.setPadding((int)(25 * scale + 0.5f),
(int)(10 * scale + 0.5f),
(int)(25 * scale + 0.5f),
0);
}
} */
}
int articleFontSize = Integer.parseInt(m_prefs.getString("article_font_size_sp", "16"));
@ -269,43 +249,40 @@ public class OfflineArticleFragment extends Fragment {
}
}
});
String content;
String cssOverride = "";
WebSettings ws = web.getSettings();
ws.setSupportZoom(false);
TypedValue tv = new TypedValue();
getActivity().getTheme().resolveAttribute(R.attr.linkColor, tv, true);
// prevent flicker in ics
if (!m_prefs.getBoolean("webview_hardware_accel", true) || useTitleWebView) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
web.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
}
String theme = m_prefs.getString("theme", CommonActivity.THEME_DEFAULT);
if (CommonActivity.THEME_DARK.equals(theme)) {
cssOverride = "body { background : transparent; color : #e0e0e0}";
} else {
cssOverride = "body { background : transparent; }";
}
// prevent flicker in ics
if (!m_prefs.getBoolean("webview_hardware_accel", true) || useTitleWebView) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
web.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
}
String content;
String cssOverride = "";
WebSettings ws = web.getSettings();
ws.setSupportZoom(false);
TypedValue tvBackground = new TypedValue();
getActivity().getTheme().resolveAttribute(R.attr.articleBackground, tvBackground, true);
String backgroundHexColor = String.format("#%06X", (0xFFFFFF & tvBackground.data));
cssOverride = "body { background : "+ backgroundHexColor+"; }";
TypedValue tvTextColor = new TypedValue();
getActivity().getTheme().resolveAttribute(R.attr.articleTextColor, tvTextColor, true);
String textColor = String.format("#%06X", (0xFFFFFF & tvTextColor.data));
cssOverride += "body { color : "+textColor+"; }";
TypedValue tvLinkColor = new TypedValue();
getActivity().getTheme().resolveAttribute(R.attr.linkColor, tvLinkColor, true);
String linkHexColor = String.format("#%06X", (0xFFFFFF & tvLinkColor.data));
cssOverride += " a:link {color: "+linkHexColor+";} a:visited { color: "+linkHexColor+";}";
if (useTitleWebView || android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
web.setBackgroundColor(Color.TRANSPARENT);
} else {
// seriously?
web.setBackgroundColor(Color.argb(1, 0, 0, 0));
}
String hexColor = String.format("#%06X", (0xFFFFFF & tv.data));
cssOverride += " a:link {color: "+hexColor+";} a:visited { color: "+hexColor+";}";
cssOverride += " table { width : 100%; }";
String articleContent = m_cursor.getString(m_cursor.getColumnIndex("content"));
Document doc = Jsoup.parse(articleContent);
@ -337,19 +314,20 @@ public class OfflineArticleFragment extends Fragment {
}
ws.setDefaultFontSize(articleFontSize);
content =
"<html>" +
"<head>" +
"<meta content=\"text/html; charset=utf-8\" http-equiv=\"content-type\">" +
"<meta name=\"viewport\" content=\"width=device-width, user-scalable=no\" />" +
"<style type=\"text/css\">" +
"body { padding : 0px; margin : 0px; line-height : 130%; }" +
cssOverride +
"img { max-width : 100%; width : auto; height : auto; }" +
"</style>" +
"</head>" +
"<body>" + articleContent;
content =
"<html>" +
"<head>" +
"<meta content=\"text/html; charset=utf-8\" http-equiv=\"content-type\">" +
"<meta name=\"viewport\" content=\"width=device-width, user-scalable=no\" />" +
"<style type=\"text/css\">" +
"body { padding : 0px; margin : 0px; line-height : 130%; }" +
"img { max-width : 100%; width : auto; height : auto; }" +
" table { width : 100%; }" +
cssOverride +
"</style>" +
"</head>" +
"<body>" + articleContent;
if (useTitleWebView) {
content += "<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>";

View File

@ -86,7 +86,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?articleNoteBackground"
android:background="?articleNoteBackground"
android:textColor="?articleNoteTextColor"
android:textSize="13sp"
android:padding="8dp"

View File

@ -2,6 +2,7 @@
android:id="@+id/article_images"
android:layout_width="fill_parent"
android:fitsSystemWindows="true"
android:background="?smallScreenBackground"
android:layout_height="fill_parent">
/*
android:paddingLeft="@dimen/activity_horizontal_margin"

View File

@ -13,6 +13,7 @@
android:orientation="horizontal">
<ImageView
android:tint="?iconTintColor"
android:id="@+id/icon"
android:layout_gravity="center_vertical"
android:layout_width="16dp"

View File

@ -14,6 +14,7 @@
android:orientation="horizontal">
<ImageView
android:tint="?iconTintColor"
android:id="@+id/icon"
android:layout_gravity="center_vertical"
android:layout_width="16dp"

View File

@ -153,6 +153,7 @@
android:textStyle="italic" />
<ImageView
android:tint="?iconTintColor"
android:id="@+id/marked"
android:layout_width="wrap_content"
android:layout_height="16dp"
@ -163,6 +164,7 @@
android:src="@drawable/ic_star_empty" />
<ImageView
android:tint="?iconTintColor"
android:id="@+id/published"
android:layout_width="wrap_content"
android:layout_height="16dp"
@ -173,6 +175,7 @@
android:src="@drawable/ic_unpublished" />
<ImageView
android:tint="?iconTintColor"
android:id="@+id/article_menu_button"
android:layout_width="wrap_content"
android:layout_height="16dp"

View File

@ -154,6 +154,7 @@
android:textStyle="italic" />
<ImageView
android:tint="?iconTintColor"
android:id="@+id/marked"
android:layout_width="wrap_content"
android:layout_height="16dp"
@ -164,6 +165,7 @@
android:src="@drawable/ic_star_empty" />
<ImageView
android:tint="?iconTintColor"
android:id="@+id/published"
android:layout_width="wrap_content"
android:layout_height="16dp"
@ -174,6 +176,7 @@
android:src="@drawable/ic_unpublished" />
<ImageView
android:tint="?iconTintColor"
android:id="@+id/article_menu_button"
android:layout_width="wrap_content"
android:layout_height="16dp"

View File

@ -155,6 +155,7 @@
android:textStyle="italic" />
<ImageView
android:tint="?iconTintColor"
android:id="@+id/marked"
android:layout_width="wrap_content"
android:layout_height="16dp"
@ -165,6 +166,7 @@
android:src="@drawable/ic_star_empty" />
<ImageView
android:tint="?iconTintColor"
android:id="@+id/published"
android:layout_width="wrap_content"
android:layout_height="16dp"
@ -175,6 +177,7 @@
android:src="@drawable/ic_unpublished" />
<ImageView
android:tint="?iconTintColor"
android:id="@+id/article_menu_button"
android:layout_width="wrap_content"
android:layout_height="16dp"

View File

@ -154,6 +154,7 @@
android:textStyle="italic" />
<ImageView
android:tint="?iconTintColor"
android:id="@+id/marked"
android:layout_width="wrap_content"
android:layout_height="16dp"
@ -164,6 +165,7 @@
android:src="@drawable/ic_star_empty" />
<ImageView
android:tint="?iconTintColor"
android:id="@+id/published"
android:layout_width="wrap_content"
android:layout_height="16dp"
@ -174,6 +176,7 @@
android:src="@drawable/ic_unpublished" />
<ImageView
android:tint="?iconTintColor"
android:id="@+id/article_menu_button"
android:layout_width="wrap_content"
android:layout_height="16dp"

View File

@ -2,12 +2,14 @@
<string-array name="pref_theme_names">
<item>@string/theme_light</item>
<item>@string/theme_dark</item>
<item>@string/theme_sepia</item>
<item>@string/theme_sepia</item>
<item>@string/theme_amber</item>
</string-array>
<string-array name="pref_theme_values" translatable="false">
<item>THEME_LIGHT</item>
<item>THEME_DARK</item>
<item>THEME_SEPIA</item>
<item>THEME_AMBER</item>
</string-array>
<string-array name="pref_view_mode_names">
<item>@string/category_browse_headlines</item>

View File

@ -29,4 +29,6 @@
<attr name="parentBtnBackground" format="reference|color" />
<attr name="articleHeader" format="reference|color" />
<attr name="articleHeaderTextColor" format="reference|color" />
<attr name="articleTextColor" format="reference|color" />
<attr name="iconTintColor" format="reference|color" />
</resources>

View File

@ -159,6 +159,7 @@
<string name="trial_expired">Trial expired</string>
<string name="trial_expired_message">To continue using Tiny Tiny RSS please unlock the full version by purchasing the key.</string>
<string name="theme_sepia">Sepia</string>
<string name="theme_amber">Amber</string>
<string name="trial_thanks">Full version, thank you for support!</string>
<string name="prefs_fullscreen_mode">Fullscreen mode</string>
<string name="reading">Reading</string>

View File

@ -30,7 +30,9 @@
<item name="parentBtnBackground">#dddddd</item>
<item name="articleHeader">?colorPrimaryDark</item>
<item name="articleHeaderTextColor">@android:color/white</item>
<item name="articleTextColor">@android:color/black</item>
<item name="floatingActionButtonStyle">@style/FabTheme</item>
<item name="iconTintColor">@android:color/transparent</item>
<item name="colorPrimary">#6482af</item>
<item name="colorPrimaryDark">#526A8E</item>
@ -50,6 +52,44 @@
<item name="colorAccent">#E5B0A0</item>
</style>
<style name="AmberTheme" parent="DarkTheme">
<item name="articleHeader">@android:color/black</item>
<item name="articleNoteTextColor">?linkColor</item>
<item name="articleNoteBackground">#543800</item>
<item name="headlineNormalBackground">@android:color/black</item>
<item name="smallScreenBackground">@android:color/black</item>
<item name="feedlistBackground">?colorPrimaryDark</item>
<item name="headlinesBackground">@android:color/black</item>
<item name="headlinesBackgroundSolid">@android:color/black</item>
<item name="articleBackground">@android:color/black</item>
<item name="articleHeaderTextColor">?linkColor</item>
<item name="articleTextColor">?colorPrimary</item>
<item name="linkColor">?colorAccent</item>
<item name="feedlistTextColor">?linkColor</item>
<item name="unreadCounterColor">?colorPrimaryDark</item>
<item name="headlineUnreadTextColor">?linkColor</item>
<item name="headlineSelectedTextColor">?linkColor</item>
<item name="headlineExcerptTextColor">?articleTextColor</item>
<item name="headlineSecondaryTextColor">?colorPrimary</item>
<item name="headlineSelectedExcerptTextColor">?linkColor</item>
<item name="headlineTextColor">@android:color/secondary_text_dark</item>
<item name="headlineSelectedSecondaryTextColor">?colorPrimary</item>
<item name="headlineUnreadBackground">@android:color/black</item>
<item name="headlineSelectedBackground">#635200</item>
<item name="iconTintColor">?linkColor</item>
<item name="colorPrimary">#B78300</item>
<item name="colorPrimaryDark">#A87300</item>
<item name="colorAccent">#FFBF00</item>
</style>
<style name="DarkTheme" parent="Theme.AppCompat">
<item name="statusBarHintColor">?colorPrimary</item>
<item name="unreadCounterColor">#909090</item>
@ -60,6 +100,11 @@
<item name="headlineExcerptTextColor">@android:color/secondary_text_dark</item>
<item name="headlineSecondaryTextColor">#909090</item>
<item name="headlineTitleHighScoreUnreadTextColor">#00FF00</item>
<item name="headlineSelectedExcerptTextColor">@android:color/secondary_text_dark</item>
<item name="headlineTextColor">@android:color/secondary_text_dark</item>
<item name="headlineSelectedSecondaryTextColor">#a0a0a0</item>
<item name="headlineSelectedBackground">?colorPrimary</item>
<item name="headlineUnreadBackground">#383c42</item>
<item name="linkColor">?colorPrimary</item>
<item name="loadingBackground">@android:color/black</item>
<item name="articleNoteTextColor">@android:color/secondary_text_dark</item>
@ -71,16 +116,13 @@
<item name="headlinesBackground">@drawable/shadow_headlines_gray</item>
<item name="headlinesBackgroundSolid">@color/feeds_dark_gray</item>
<item name="articleBackground">@color/feeds_dark_gray</item>
<item name="headlineSelectedBackground">?colorPrimary</item>
<item name="headlineUnreadBackground">#383c42</item>
<item name="feedsSelectedBackground">#445877</item>
<item name="feedsSelectedBackground">?colorPrimaryDark</item>
<item name="feedlistSelectedTextColor">@android:color/primary_text_dark</item>
<item name="headlineSelectedExcerptTextColor">@android:color/secondary_text_dark</item>
<item name="headlineTextColor">@android:color/secondary_text_dark</item>
<item name="headlineSelectedSecondaryTextColor">#a0a0a0</item>
<item name="articleHeader">?colorPrimaryDark</item>
<item name="articleHeaderTextColor">@android:color/white</item>
<item name="floatingActionButtonStyle">@style/FabTheme</item>
<item name="articleTextColor">#e0e0e0</item>
<item name="iconTintColor">@android:color/transparent</item>
<item name="colorPrimary">#51698E</item>
<item name="colorPrimaryDark">#445877</item>