make article fragment more materal-y; simplify themes a bit
This commit is contained in:
parent
3de2528826
commit
68ff9e90e7
@ -4,14 +4,12 @@ import android.annotation.SuppressLint;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.util.Log;
|
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
@ -96,7 +94,7 @@ public class ArticleFragment extends Fragment {
|
|||||||
|
|
||||||
if (m_article != null) {
|
if (m_article != null) {
|
||||||
|
|
||||||
if (!useTitleWebView) {
|
/* if (!useTitleWebView) {
|
||||||
View scroll = view.findViewById(R.id.article_scrollview);
|
View scroll = view.findViewById(R.id.article_scrollview);
|
||||||
|
|
||||||
if (scroll != null) {
|
if (scroll != null) {
|
||||||
@ -116,7 +114,7 @@ public class ArticleFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
|
|
||||||
int articleFontSize = Integer.parseInt(m_prefs.getString("article_font_size_sp", "16"));
|
int articleFontSize = Integer.parseInt(m_prefs.getString("article_font_size_sp", "16"));
|
||||||
int articleSmallFontSize = Math.max(10, Math.min(18, articleFontSize - 2));
|
int articleSmallFontSize = Math.max(10, Math.min(18, articleFontSize - 2));
|
||||||
@ -247,28 +245,22 @@ public class ArticleFragment extends Fragment {
|
|||||||
WebSettings ws = web.getSettings();
|
WebSettings ws = web.getSettings();
|
||||||
ws.setSupportZoom(false);
|
ws.setSupportZoom(false);
|
||||||
|
|
||||||
TypedValue tv = new TypedValue();
|
TypedValue tvBackground = new TypedValue();
|
||||||
getActivity().getTheme().resolveAttribute(R.attr.linkColor, tv, true);
|
getActivity().getTheme().resolveAttribute(R.attr.articleBackground, tvBackground, true);
|
||||||
|
|
||||||
String theme = m_prefs.getString("theme", CommonActivity.THEME_DEFAULT);
|
String backgroundHexColor = String.format("#%06X", (0xFFFFFF & tvBackground.data));
|
||||||
|
|
||||||
if (CommonActivity.THEME_DARK.equals(theme)) {
|
cssOverride = "body { background : "+ backgroundHexColor+"; }";
|
||||||
cssOverride = "body { background : transparent; color : #e0e0e0}";
|
|
||||||
} else {
|
if (m_activity.isDarkTheme()) {
|
||||||
cssOverride = "body { background : transparent; }";
|
cssOverride += "body { color : #e0e0e0; }";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useTitleWebView || android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
|
TypedValue tvLinkColor = new TypedValue();
|
||||||
web.setBackgroundColor(Color.TRANSPARENT);
|
getActivity().getTheme().resolveAttribute(R.attr.linkColor, tvLinkColor, true);
|
||||||
} else {
|
|
||||||
// seriously?
|
|
||||||
web.setBackgroundColor(Color.argb(1, 0, 0, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
String hexColor = String.format("#%06X", (0xFFFFFF & tv.data));
|
String linkHexColor = String.format("#%06X", (0xFFFFFF & tvLinkColor.data));
|
||||||
cssOverride += " a:link {color: "+hexColor+";} a:visited { color: "+hexColor+";}";
|
cssOverride += " a:link {color: "+linkHexColor+";} a:visited { color: "+linkHexColor+";}";
|
||||||
|
|
||||||
cssOverride += " table { width : 100%; }";
|
|
||||||
|
|
||||||
String articleContent = m_article.content != null ? m_article.content : "";
|
String articleContent = m_article.content != null ? m_article.content : "";
|
||||||
|
|
||||||
@ -298,6 +290,7 @@ public class ArticleFragment extends Fragment {
|
|||||||
"<style type=\"text/css\">" +
|
"<style type=\"text/css\">" +
|
||||||
"body { padding : 0px; margin : 0px; line-height : 130%; }" +
|
"body { padding : 0px; margin : 0px; line-height : 130%; }" +
|
||||||
"img { max-width : 100%; width : auto; height : auto; }" +
|
"img { max-width : 100%; width : auto; height : auto; }" +
|
||||||
|
" table { width : 100%; }" +
|
||||||
cssOverride +
|
cssOverride +
|
||||||
"</style>" +
|
"</style>" +
|
||||||
"</head>" +
|
"</head>" +
|
||||||
|
@ -16,7 +16,9 @@
|
|||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:padding="8dp"
|
||||||
android:id="@+id/article_header"
|
android:id="@+id/article_header"
|
||||||
|
android:background="?articleHeader"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
@ -29,7 +31,7 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:paddingTop="4dp"
|
android:paddingTop="4dp"
|
||||||
android:text="My simple headline"
|
android:text="My simple headline"
|
||||||
android:textColor="?linkColor"
|
android:textColor="?articleHeaderTextColor"
|
||||||
android:textSize="18sp" />
|
android:textSize="18sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -40,7 +42,7 @@
|
|||||||
android:fontFamily="sans-serif-light"
|
android:fontFamily="sans-serif-light"
|
||||||
android:paddingTop="4dp"
|
android:paddingTop="4dp"
|
||||||
android:text="24 comments"
|
android:text="24 comments"
|
||||||
android:textColor="?linkColor"
|
android:textColor="?articleHeaderTextColor"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -59,7 +61,7 @@
|
|||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:fontFamily="sans-serif-light"
|
android:fontFamily="sans-serif-light"
|
||||||
android:text="Example Feed"
|
android:text="Example Feed"
|
||||||
android:textColor="?headlineSecondaryTextColor"
|
android:textColor="?articleHeaderTextColor"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -72,7 +74,7 @@
|
|||||||
android:fontFamily="sans-serif-light"
|
android:fontFamily="sans-serif-light"
|
||||||
android:text="Jan 01, 12:00"
|
android:text="Jan 01, 12:00"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:textColor="?headlineSecondaryTextColor"
|
android:textColor="?articleHeaderTextColor"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -87,11 +89,11 @@
|
|||||||
android:background="?articleNoteBackground"
|
android:background="?articleNoteBackground"
|
||||||
android:textColor="?articleNoteTextColor"
|
android:textColor="?articleNoteTextColor"
|
||||||
android:textSize="13sp"
|
android:textSize="13sp"
|
||||||
android:padding="2dp"
|
android:padding="8dp"
|
||||||
android:layout_marginBottom="6dp"
|
|
||||||
android:text="[Article note]" />
|
android:text="[Article note]" />
|
||||||
|
|
||||||
<org.fox.ttrss.util.LessBrokenWebView
|
<org.fox.ttrss.util.LessBrokenWebView
|
||||||
|
android:layout_margin="8dp"
|
||||||
android:id="@+id/article_content"
|
android:id="@+id/article_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
@ -27,4 +27,6 @@
|
|||||||
<attr name="articleNoteTextColor" format="reference|color" />
|
<attr name="articleNoteTextColor" format="reference|color" />
|
||||||
<attr name="statusBarHintColor" format="reference|color" />
|
<attr name="statusBarHintColor" format="reference|color" />
|
||||||
<attr name="parentBtnBackground" format="reference|color" />
|
<attr name="parentBtnBackground" format="reference|color" />
|
||||||
|
<attr name="articleHeader" format="reference|color" />
|
||||||
|
<attr name="articleHeaderTextColor" format="reference|color" />
|
||||||
</resources>
|
</resources>
|
@ -5,7 +5,6 @@
|
|||||||
<color name="headlines_light">#ffffff</color>
|
<color name="headlines_light">#ffffff</color>
|
||||||
<color name="headlines_sepia">#EAE2DC</color>
|
<color name="headlines_sepia">#EAE2DC</color>
|
||||||
<color name="feeds_sepia">#D3C6BA</color>
|
<color name="feeds_sepia">#D3C6BA</color>
|
||||||
<color name="ics_cyan">#33b5e5</color>
|
|
||||||
<color name="unread_counter_background">#88b0f0</color>
|
<color name="unread_counter_background">#88b0f0</color>
|
||||||
<color name="unread_counter_background_dark">#63758E</color>
|
<color name="unread_counter_background_dark">#63758E</color>
|
||||||
<color name="unread_counter_background_sepia">#C46262</color>
|
<color name="unread_counter_background_sepia">#C46262</color>
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<style name="LightThemeBase" parent="Theme.AppCompat.Light.DarkActionBar">
|
<style name="LightTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
<item name="statusBarHintColor">#6482AF</item>
|
<item name="statusBarHintColor">?colorPrimaryDark</item>
|
||||||
<item name="smallScreenBackground">#eeeeee</item>
|
<item name="smallScreenBackground">#eeeeee</item>
|
||||||
<item name="ttrssHorizontalDivider">@android:drawable/divider_horizontal_bright</item>
|
<item name="ttrssHorizontalDivider">@android:drawable/divider_horizontal_bright</item>
|
||||||
<item name="feedlistBackground"><!-- #e0e0e0 -->@drawable/shadow_feeds</item>
|
<item name="feedlistBackground"><!-- #e0e0e0 -->@drawable/shadow_feeds</item>
|
||||||
<item name="unreadCounterColor">#909090</item>
|
<item name="unreadCounterColor">#909090</item>
|
||||||
<item name="headlinesBackground"><!-- #f0f0f0 -->@drawable/shadow_headlines</item>
|
<item name="headlinesBackground"><!-- #f0f0f0 -->@drawable/shadow_headlines</item>
|
||||||
<item name="headlinesBackgroundSolid">#f0f0f0</item>
|
<item name="headlinesBackgroundSolid">#f0f0f0</item>
|
||||||
<item name="articleBackground">@android:color/transparent</item>
|
<item name="articleBackground">@android:color/white</item>
|
||||||
<item name="headlineSelectedBackground">#88b0f0</item>
|
<item name="headlineSelectedBackground">?colorAccent</item>
|
||||||
<item name="headlineUnreadBackground">@android:color/white</item>
|
<item name="headlineUnreadBackground">@android:color/white</item>
|
||||||
<item name="headlineNormalBackground">#f5f5f5</item>
|
<item name="headlineNormalBackground">#f5f5f5</item>
|
||||||
<item name="feedsSelectedBackground">#526a8e</item>
|
<item name="feedsSelectedBackground">?colorPrimaryDark</item>
|
||||||
<item name="feedlistTextColor">@android:color/primary_text_light</item>
|
<item name="feedlistTextColor">@android:color/primary_text_light</item>
|
||||||
<item name="feedlistSelectedTextColor">#ffffff</item>
|
<item name="feedlistSelectedTextColor">#ffffff</item>
|
||||||
<item name="headlineTextColor">@android:color/secondary_text_light</item>
|
<item name="headlineTextColor">@android:color/secondary_text_light</item>
|
||||||
@ -23,98 +23,68 @@
|
|||||||
<item name="headlineSelectedSecondaryTextColor">#606060</item>
|
<item name="headlineSelectedSecondaryTextColor">#606060</item>
|
||||||
<item name="headlineSelectedExcerptTextColor">@android:color/secondary_text_light</item>
|
<item name="headlineSelectedExcerptTextColor">@android:color/secondary_text_light</item>
|
||||||
<item name="headlineTitleHighScoreUnreadTextColor">#008000</item>
|
<item name="headlineTitleHighScoreUnreadTextColor">#008000</item>
|
||||||
<item name="linkColor">#4684ff</item>
|
<item name="linkColor">?colorPrimary</item>
|
||||||
<item name="loadingBackground">@android:color/white</item>
|
<item name="loadingBackground">@android:color/white</item>
|
||||||
<item name="articleNoteTextColor">#9a8c59</item>
|
<item name="articleNoteTextColor">#9a8c59</item>
|
||||||
<item name="articleNoteBackground">#fff7d5</item>
|
<item name="articleNoteBackground">#fff7d5</item>
|
||||||
<item name="parentBtnBackground">#dddddd</item>
|
<item name="parentBtnBackground">#dddddd</item>
|
||||||
|
<item name="articleHeader">?colorPrimaryDark</item>
|
||||||
|
<item name="articleHeaderTextColor">@android:color/white</item>
|
||||||
|
|
||||||
<item name="colorPrimary">#6482af</item>
|
<item name="colorPrimary">#6482af</item>
|
||||||
<item name="colorPrimaryDark">#526A8E</item>
|
<item name="colorPrimaryDark">#526A8E</item>
|
||||||
<item name="colorAccent">#88b0f0</item>
|
<item name="colorAccent">?colorPrimary</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="LightTheme" parent="LightThemeBase">
|
<style name="SepiaTheme" parent="LightTheme">
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="SepiaThemeBase" parent="LightTheme">
|
|
||||||
<item name="statusBarHintColor">#7F3F3F</item>
|
|
||||||
<item name="smallScreenBackground">@drawable/paper_sepia</item>
|
<item name="smallScreenBackground">@drawable/paper_sepia</item>
|
||||||
<item name="feedlistBackground">@drawable/shadow_feeds_sepia</item>
|
<item name="feedlistBackground">@drawable/shadow_feeds_sepia</item>
|
||||||
<item name="headlinesBackground">@drawable/shadow_headlines_sepia</item>
|
<item name="headlinesBackground">@drawable/shadow_headlines_sepia</item>
|
||||||
<item name="headlinesBackgroundSolid">@drawable/paper_sepia</item>
|
<item name="headlinesBackgroundSolid">@drawable/paper_sepia</item>
|
||||||
<item name="headlineSelectedBackground">#E5B0A0</item>
|
|
||||||
<item name="feedsSelectedBackground">#7F3F3F</item>
|
|
||||||
<item name="articleBackground">@drawable/paper_sepia</item>
|
|
||||||
<item name="feedlistTextColor">#35281C</item>
|
<item name="feedlistTextColor">#35281C</item>
|
||||||
<item name="linkColor">#C46262</item>
|
<item name="linkColor">?colorPrimary</item>
|
||||||
|
|
||||||
<item name="colorPrimary">#C46262</item>
|
<item name="colorPrimary">#C46262</item>
|
||||||
<item name="colorPrimaryDark">#7F3F3F</item>
|
<item name="colorPrimaryDark">#7F3F3F</item>
|
||||||
<item name="colorAccent">#E5B0A0</item>
|
<item name="colorAccent">#E5B0A0</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="SepiaTheme" parent="SepiaThemeBase">
|
<style name="DarkTheme" parent="Theme.AppCompat">
|
||||||
</style>
|
<item name="statusBarHintColor">?colorPrimaryDark</item>
|
||||||
|
|
||||||
<style name="HoloThemeBase" parent="Theme.AppCompat">
|
|
||||||
<item name="statusBarHintColor">@android:color/black</item>
|
|
||||||
<item name="smallScreenBackground">@android:color/transparent</item>
|
|
||||||
<item name="ttrssHorizontalDivider">@android:drawable/divider_horizontal_dark</item>
|
|
||||||
<item name="feedlistBackground">@android:color/transparent</item>
|
|
||||||
<item name="unreadCounterColor">#909090</item>
|
<item name="unreadCounterColor">#909090</item>
|
||||||
<item name="headlinesBackground">@android:color/black</item>
|
|
||||||
<item name="headlinesBackgroundSolid">@android:color/black</item>
|
|
||||||
<item name="articleBackground">@android:color/black</item>
|
|
||||||
<item name="headlineSelectedBackground">@color/ics_cyan</item>
|
|
||||||
<item name="headlineUnreadBackground">#202020</item>
|
|
||||||
<item name="headlineNormalBackground">#151515</item>
|
<item name="headlineNormalBackground">#151515</item>
|
||||||
<item name="feedsSelectedBackground">@color/ics_cyan</item>
|
|
||||||
<item name="feedlistTextColor">@android:color/primary_text_dark</item>
|
<item name="feedlistTextColor">@android:color/primary_text_dark</item>
|
||||||
<item name="feedlistSelectedTextColor">@android:color/black</item>
|
|
||||||
<item name="headlineTextColor">@android:color/secondary_text_dark</item>
|
|
||||||
<item name="headlineUnreadTextColor">@android:color/primary_text_dark</item>
|
<item name="headlineUnreadTextColor">@android:color/primary_text_dark</item>
|
||||||
<item name="headlineSelectedTextColor">@android:color/white</item>
|
<item name="headlineSelectedTextColor">@android:color/white</item>
|
||||||
<item name="headlineExcerptTextColor">@android:color/secondary_text_dark</item>
|
<item name="headlineExcerptTextColor">@android:color/secondary_text_dark</item>
|
||||||
<item name="headlineSelectedExcerptTextColor">@android:color/black</item>
|
|
||||||
<item name="headlineSecondaryTextColor">#909090</item>
|
<item name="headlineSecondaryTextColor">#909090</item>
|
||||||
<item name="headlineSelectedSecondaryTextColor">#404040</item>
|
|
||||||
<item name="headlineTitleHighScoreUnreadTextColor">#00FF00</item>
|
<item name="headlineTitleHighScoreUnreadTextColor">#00FF00</item>
|
||||||
<item name="linkColor">@color/ics_cyan</item>
|
<item name="linkColor">?colorPrimary</item>
|
||||||
<item name="loadingBackground">@android:color/black</item>
|
<item name="loadingBackground">@android:color/black</item>
|
||||||
<item name="articleNoteTextColor">@android:color/secondary_text_dark</item>
|
<item name="articleNoteTextColor">@android:color/secondary_text_dark</item>
|
||||||
<item name="articleNoteBackground">#303030</item>
|
<item name="articleNoteBackground">#303030</item>
|
||||||
<item name="parentBtnBackground">#101010</item>
|
<item name="parentBtnBackground">#101010</item>
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="HoloTheme" parent="HoloThemeBase">
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="DarkThemeBase" parent="HoloTheme">
|
|
||||||
<item name="statusBarHintColor">#51698E</item>
|
|
||||||
<item name="smallScreenBackground">@color/feeds_dark_gray</item>
|
<item name="smallScreenBackground">@color/feeds_dark_gray</item>
|
||||||
<item name="ttrssHorizontalDivider">@android:drawable/divider_horizontal_dark</item>
|
<item name="ttrssHorizontalDivider">@android:drawable/divider_horizontal_dark</item>
|
||||||
<item name="feedlistBackground">@drawable/shadow_feeds_gray</item>
|
<item name="feedlistBackground">@drawable/shadow_feeds_gray</item>
|
||||||
<item name="headlinesBackground">@drawable/shadow_headlines_gray</item>
|
<item name="headlinesBackground">@drawable/shadow_headlines_gray</item>
|
||||||
<item name="headlinesBackgroundSolid">@color/feeds_dark_gray</item>
|
<item name="headlinesBackgroundSolid">@color/feeds_dark_gray</item>
|
||||||
<item name="articleBackground">@color/feeds_dark_gray</item>
|
<item name="articleBackground">@color/feeds_dark_gray</item>
|
||||||
<item name="headlineSelectedBackground">#51698E</item>
|
<item name="headlineSelectedBackground">?colorPrimary</item>
|
||||||
<item name="headlineUnreadBackground">#383c42</item>
|
<item name="headlineUnreadBackground">#383c42</item>
|
||||||
<item name="feedsSelectedBackground">#445877</item>
|
<item name="feedsSelectedBackground">#445877</item>
|
||||||
<item name="feedlistSelectedTextColor">@android:color/primary_text_dark</item>
|
<item name="feedlistSelectedTextColor">@android:color/primary_text_dark</item>
|
||||||
<item name="headlineSelectedExcerptTextColor">@android:color/secondary_text_dark</item>
|
<item name="headlineSelectedExcerptTextColor">@android:color/secondary_text_dark</item>
|
||||||
<item name="headlineTextColor">@android:color/secondary_text_dark</item>
|
<item name="headlineTextColor">@android:color/secondary_text_dark</item>
|
||||||
<item name="headlineSelectedSecondaryTextColor">#a0a0a0</item>
|
<item name="headlineSelectedSecondaryTextColor">#a0a0a0</item>
|
||||||
|
<item name="articleHeader">?colorPrimaryDark</item>
|
||||||
|
<item name="articleHeaderTextColor">@android:color/white</item>
|
||||||
|
|
||||||
<item name="colorPrimary">#51698E</item>
|
<item name="colorPrimary">#51698E</item>
|
||||||
<item name="colorPrimaryDark">#445877</item>
|
<item name="colorPrimaryDark">#445877</item>
|
||||||
<item name="colorAccent">#88b0f0</item>
|
<item name="colorAccent">#88b0f0</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="DarkTheme" parent="DarkThemeBase">
|
<style name="DarkDialogTheme" parent="android:Theme"></style>
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="DarkDialogTheme" parent="android:Theme">
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue
Block a user