From 8a97531a5a1d2e013db08b7fbef0eb2cd10baaf9 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 24 Jan 2014 13:41:37 +0400 Subject: [PATCH] tweak typography and layouts a bit --- AndroidManifest.xml | 4 +- res/layout/article_fragment.xml | 35 +++++------------ res/layout/article_fragment_compat.xml | 25 ++---------- res/layout/headlines_row.xml | 5 +++ res/layout/headlines_row_selected.xml | 5 +++ res/layout/headlines_row_selected_unread.xml | 5 +++ res/layout/headlines_row_unread.xml | 9 ++++- src/org/fox/ttrss/ArticleFragment.java | 30 +++++++++----- .../ttrss/offline/OfflineArticleFragment.java | 39 ++++++++++++------- 9 files changed, 84 insertions(+), 73 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index b140ace3..af410bb2 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="231" + android:versionName="1.35" > @@ -28,46 +28,28 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" + android:paddingTop="4dp" + android:fontFamily="sans-serif-condensed" android:paddingBottom="4dp" - android:text="My simple headline" + android:text="My simple headline" android:textColor="?linkColor" android:textSize="18sp" /> - - - - @@ -87,10 +70,12 @@ android:layout_height="wrap_content" android:layout_weight="0.5" android:gravity="right" + android:fontFamily="sans-serif-light" android:text="Jan 01, 12:00" android:textAppearance="?android:attr/textAppearanceSmall" android:textColor="?headlineSecondaryTextColor" android:textSize="12sp" /> + diff --git a/res/layout/article_fragment_compat.xml b/res/layout/article_fragment_compat.xml index 8c37eb72..dfe49ae7 100644 --- a/res/layout/article_fragment_compat.xml +++ b/res/layout/article_fragment_compat.xml @@ -26,22 +26,11 @@ android:layout_height="wrap_content" android:layout_weight="1" android:paddingBottom="4dp" + android:fontFamily="sans-serif-condensed" android:text="My simple headline" android:textColor="?linkColor" android:textSize="18sp" /> - - - - @@ -85,6 +67,7 @@ android:layout_weight="0.5" android:gravity="right" android:text="Jan 01, 12:00" + android:fontFamily="sans-serif-light" android:textAppearance="?android:attr/textAppearanceSmall" android:textColor="?headlineSecondaryTextColor" android:textSize="12sp" /> diff --git a/res/layout/headlines_row.xml b/res/layout/headlines_row.xml index 6df28379..92998b3e 100644 --- a/res/layout/headlines_row.xml +++ b/res/layout/headlines_row.xml @@ -36,6 +36,7 @@ android:gravity="center_vertical" android:singleLine="false" android:text="Sample entry title" + android:fontFamily="sans-serif-condensed" android:textColor="?headlineTextColor" android:textSize="18sp" /> @@ -58,6 +59,7 @@ android:gravity="center_vertical" android:singleLine="true" android:text="Example Feed" + android:fontFamily="sans-serif-light" android:textColor="?headlineSecondaryTextColor" android:textSize="12sp" /> @@ -68,6 +70,7 @@ android:layout_weight="1" android:gravity="right|center_vertical" android:text="Jan 01, 12:00" + android:fontFamily="sans-serif-light" android:textColor="?headlineSecondaryTextColor" android:textSize="12sp" /> @@ -102,6 +105,8 @@ android:gravity="center_vertical" android:singleLine="true" android:text="by Author" + android:fontFamily="sans-serif-light" + android:textStyle="italic" android:textColor="?headlineSecondaryTextColor" android:textSize="12sp" /> diff --git a/res/layout/headlines_row_selected.xml b/res/layout/headlines_row_selected.xml index 849e2b6f..2f6e9cba 100644 --- a/res/layout/headlines_row_selected.xml +++ b/res/layout/headlines_row_selected.xml @@ -31,6 +31,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" + android:fontFamily="sans-serif-condensed" android:gravity="center_vertical" android:singleLine="false" android:text="Sample entry title" @@ -55,6 +56,7 @@ android:ellipsize="end" android:gravity="center_vertical" android:singleLine="true" + android:fontFamily="sans-serif-light" android:text="Example Feed" android:textColor="?headlineSelectedSecondaryTextColor" android:textSize="12sp" /> @@ -66,6 +68,7 @@ android:layout_weight="1" android:gravity="right|center_vertical" android:text="Jan 01, 12:00" + android:fontFamily="sans-serif-light" android:textColor="?headlineSelectedSecondaryTextColor" android:textSize="12sp" /> @@ -100,6 +103,8 @@ android:gravity="center_vertical" android:singleLine="true" android:text="by Author" + android:fontFamily="sans-serif-light" + android:textStyle="italic" android:textColor="?headlineSelectedSecondaryTextColor" android:textSize="12sp" /> diff --git a/res/layout/headlines_row_selected_unread.xml b/res/layout/headlines_row_selected_unread.xml index 0fa6e213..d8ab9ce5 100644 --- a/res/layout/headlines_row_selected_unread.xml +++ b/res/layout/headlines_row_selected_unread.xml @@ -34,6 +34,7 @@ android:gravity="center_vertical" android:singleLine="false" android:text="Sample entry title" + android:fontFamily="sans-serif-condensed" android:textColor="?headlineSelectedTextColor" android:textSize="18sp" android:textStyle="bold" /> @@ -57,6 +58,7 @@ android:gravity="center_vertical" android:singleLine="true" android:text="Example Feed" + android:fontFamily="sans-serif-light" android:textColor="?headlineSelectedSecondaryTextColor" android:textSize="12sp" /> @@ -66,6 +68,7 @@ android:layout_height="wrap_content" android:layout_weight="1" android:gravity="right|center_vertical" + android:fontFamily="sans-serif-light" android:text="Jan 01, 12:00" android:textColor="?headlineSelectedSecondaryTextColor" android:textSize="12sp" /> @@ -101,6 +104,8 @@ android:gravity="center_vertical" android:singleLine="true" android:text="by Author" + android:fontFamily="sans-serif-light" + android:textStyle="italic" android:textColor="?headlineSelectedSecondaryTextColor" android:textSize="12sp" /> diff --git a/res/layout/headlines_row_unread.xml b/res/layout/headlines_row_unread.xml index 44f1c218..94df05f3 100644 --- a/res/layout/headlines_row_unread.xml +++ b/res/layout/headlines_row_unread.xml @@ -28,6 +28,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" + android:fontFamily="sans-serif-condensed" android:gravity="center_vertical" android:singleLine="false" android:text="Sample entry title" @@ -53,15 +54,17 @@ android:ellipsize="end" android:gravity="center_vertical" android:singleLine="true" - android:text="Example Feed" + android:fontFamily="sans-serif-light" + android:text="Example Feed" android:textColor="?headlineSecondaryTextColor" android:textSize="12sp" /> diff --git a/src/org/fox/ttrss/ArticleFragment.java b/src/org/fox/ttrss/ArticleFragment.java index d7791d83..96c119d9 100644 --- a/src/org/fox/ttrss/ArticleFragment.java +++ b/src/org/fox/ttrss/ArticleFragment.java @@ -333,12 +333,31 @@ public class ArticleFragment extends Fragment { DateFormat df = new SimpleDateFormat("MMM dd, HH:mm"); dv.setText(df.format(d)); } + + TextView author = (TextView)view.findViewById(R.id.author); + + boolean hasAuthor = false; + if (author != null) { + if (m_article.author != null && m_article.author.length() > 0) { + author.setText(getString(R.string.author_formatted, m_article.author)); + } else { + author.setVisibility(View.GONE); + } + hasAuthor = true; + } + TextView tagv = (TextView)view.findViewById(R.id.tags); if (tagv != null) { if (m_article.feed_title != null) { - tagv.setText(m_article.feed_title); + String fTitle = m_article.feed_title; + + if (!hasAuthor && m_article.author != null && m_article.author.length() > 0) { + fTitle += " (" + getString(R.string.author_formatted, m_article.author) + ")"; + } + + tagv.setText(fTitle); } else if (m_article.tags != null) { String tagsStr = ""; @@ -353,15 +372,6 @@ public class ArticleFragment extends Fragment { } } - TextView author = (TextView)view.findViewById(R.id.author); - - if (author != null) { - if (m_article.author != null && m_article.author.length() > 0) { - author.setText(getString(R.string.author_formatted, m_article.author)); - } else { - author.setVisibility(View.GONE); - } - } } return view; diff --git a/src/org/fox/ttrss/offline/OfflineArticleFragment.java b/src/org/fox/ttrss/offline/OfflineArticleFragment.java index a1033aec..de697006 100644 --- a/src/org/fox/ttrss/offline/OfflineArticleFragment.java +++ b/src/org/fox/ttrss/offline/OfflineArticleFragment.java @@ -327,29 +327,42 @@ public class OfflineArticleFragment extends Fragment { DateFormat df = new SimpleDateFormat("MMM dd, HH:mm"); dv.setText(df.format(d)); } - - TextView tagv = (TextView)view.findViewById(R.id.tags); - - if (tagv != null) { - int feedTitleIndex = m_cursor.getColumnIndex("feed_title"); - if (feedTitleIndex != -1 && m_isCat) { - tagv.setText(m_cursor.getString(feedTitleIndex)); - } else { - String tagsStr = m_cursor.getString(m_cursor.getColumnIndex("tags")); - tagv.setText(tagsStr); - } - } - TextView author = (TextView)view.findViewById(R.id.author); + boolean hasAuthor = false; + if (author != null) { int authorIndex = m_cursor.getColumnIndex("author"); if (authorIndex >= 0) author.setText(m_cursor.getString(authorIndex)); else author.setVisibility(View.GONE); + + hasAuthor = true; } + + TextView tagv = (TextView)view.findViewById(R.id.tags); + + if (tagv != null) { + int feedTitleIndex = m_cursor.getColumnIndex("feed_title"); + + if (feedTitleIndex != -1 /* && m_isCat */) { + String fTitle = m_cursor.getString(feedTitleIndex); + + int authorIndex = m_cursor.getColumnIndex("author"); + + if (!hasAuthor && authorIndex >= 0) { + fTitle += " (" + getString(R.string.author_formatted, m_cursor.getString(authorIndex)) + ")"; + } + + tagv.setText(fTitle); + } else { + String tagsStr = m_cursor.getString(m_cursor.getColumnIndex("tags")); + tagv.setText(tagsStr); + } + } + } return view;