adjust other relevant element sizes in headline and article views based
on user setting
This commit is contained in:
parent
53e9a7d9f3
commit
86daa8ee53
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.fox.ttrss"
|
package="org.fox.ttrss"
|
||||||
android:versionCode="233"
|
android:versionCode="234"
|
||||||
android:versionName="1.36" >
|
android:versionName="1.37" >
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="8"
|
android:minSdkVersion="8"
|
||||||
|
@ -94,8 +94,11 @@ public class ArticleFragment extends Fragment {
|
|||||||
|
|
||||||
if (m_article != null) {
|
if (m_article != null) {
|
||||||
|
|
||||||
TextView title = (TextView)view.findViewById(R.id.title);
|
int articleFontSize = Integer.parseInt(m_prefs.getString("article_font_size_sp", "16"));
|
||||||
|
int articleSmallFontSize = Math.max(10, Math.min(18, articleFontSize - 2));
|
||||||
|
|
||||||
|
TextView title = (TextView)view.findViewById(R.id.title);
|
||||||
|
|
||||||
if (title != null) {
|
if (title != null) {
|
||||||
|
|
||||||
String titleStr;
|
String titleStr;
|
||||||
@ -104,8 +107,8 @@ public class ArticleFragment extends Fragment {
|
|||||||
titleStr = m_article.title.substring(0, 200) + "...";
|
titleStr = m_article.title.substring(0, 200) + "...";
|
||||||
else
|
else
|
||||||
titleStr = m_article.title;
|
titleStr = m_article.title;
|
||||||
|
|
||||||
|
title.setTextSize(TypedValue.COMPLEX_UNIT_SP, Math.min(21, articleFontSize + 3));
|
||||||
title.setText(Html.fromHtml(titleStr));
|
title.setText(Html.fromHtml(titleStr));
|
||||||
//title.setPaintFlags(title.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
//title.setPaintFlags(title.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||||
title.setOnClickListener(new OnClickListener() {
|
title.setOnClickListener(new OnClickListener() {
|
||||||
@ -131,6 +134,8 @@ public class ArticleFragment extends Fragment {
|
|||||||
|
|
||||||
if (comments != null) {
|
if (comments != null) {
|
||||||
if (m_activity.getApiLevel() >= 4 && m_article.comments_count > 0) {
|
if (m_activity.getApiLevel() >= 4 && m_article.comments_count > 0) {
|
||||||
|
comments.setTextSize(TypedValue.COMPLEX_UNIT_SP, articleSmallFontSize);
|
||||||
|
|
||||||
String commentsTitle = getString(R.string.article_comments, m_article.comments_count);
|
String commentsTitle = getString(R.string.article_comments, m_article.comments_count);
|
||||||
comments.setText(commentsTitle);
|
comments.setText(commentsTitle);
|
||||||
//comments.setPaintFlags(title.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
//comments.setPaintFlags(title.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||||
@ -161,6 +166,7 @@ public class ArticleFragment extends Fragment {
|
|||||||
|
|
||||||
if (note != null) {
|
if (note != null) {
|
||||||
if (m_article.note != null && !"".equals(m_article.note)) {
|
if (m_article.note != null && !"".equals(m_article.note)) {
|
||||||
|
note.setTextSize(TypedValue.COMPLEX_UNIT_SP, articleSmallFontSize);
|
||||||
note.setText(m_article.note);
|
note.setText(m_article.note);
|
||||||
} else {
|
} else {
|
||||||
note.setVisibility(View.GONE);
|
note.setVisibility(View.GONE);
|
||||||
@ -259,7 +265,7 @@ public class ArticleFragment extends Fragment {
|
|||||||
cssOverride += "body { text-align : justify; } ";
|
cssOverride += "body { text-align : justify; } ";
|
||||||
}
|
}
|
||||||
|
|
||||||
ws.setDefaultFontSize(Integer.parseInt(m_prefs.getString("article_font_size_sp", "16")));
|
ws.setDefaultFontSize(articleFontSize);
|
||||||
|
|
||||||
content =
|
content =
|
||||||
"<html>" +
|
"<html>" +
|
||||||
@ -329,6 +335,8 @@ public class ArticleFragment extends Fragment {
|
|||||||
TextView dv = (TextView)view.findViewById(R.id.date);
|
TextView dv = (TextView)view.findViewById(R.id.date);
|
||||||
|
|
||||||
if (dv != null) {
|
if (dv != null) {
|
||||||
|
dv.setTextSize(TypedValue.COMPLEX_UNIT_SP, articleSmallFontSize);
|
||||||
|
|
||||||
Date d = new Date(m_article.updated * 1000L);
|
Date d = new Date(m_article.updated * 1000L);
|
||||||
DateFormat df = new SimpleDateFormat("MMM dd, HH:mm");
|
DateFormat df = new SimpleDateFormat("MMM dd, HH:mm");
|
||||||
dv.setText(df.format(d));
|
dv.setText(df.format(d));
|
||||||
@ -339,6 +347,8 @@ public class ArticleFragment extends Fragment {
|
|||||||
boolean hasAuthor = false;
|
boolean hasAuthor = false;
|
||||||
|
|
||||||
if (author != null) {
|
if (author != null) {
|
||||||
|
author.setTextSize(TypedValue.COMPLEX_UNIT_SP, articleSmallFontSize);
|
||||||
|
|
||||||
if (m_article.author != null && m_article.author.length() > 0) {
|
if (m_article.author != null && m_article.author.length() > 0) {
|
||||||
author.setText(getString(R.string.author_formatted, m_article.author));
|
author.setText(getString(R.string.author_formatted, m_article.author));
|
||||||
} else {
|
} else {
|
||||||
@ -350,6 +360,8 @@ public class ArticleFragment extends Fragment {
|
|||||||
TextView tagv = (TextView)view.findViewById(R.id.tags);
|
TextView tagv = (TextView)view.findViewById(R.id.tags);
|
||||||
|
|
||||||
if (tagv != null) {
|
if (tagv != null) {
|
||||||
|
tagv.setTextSize(TypedValue.COMPLEX_UNIT_SP, articleSmallFontSize);
|
||||||
|
|
||||||
if (m_article.feed_title != null) {
|
if (m_article.feed_title != null) {
|
||||||
String fTitle = m_article.feed_title;
|
String fTitle = m_article.feed_title;
|
||||||
|
|
||||||
|
@ -658,6 +658,9 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
|
|
||||||
final Article article = items.get(position);
|
final Article article = items.get(position);
|
||||||
|
|
||||||
|
int headlineFontSize = Integer.parseInt(m_prefs.getString("headlines_font_size_sp", "13"));
|
||||||
|
int headlineSmallFontSize = Math.max(10, Math.min(18, headlineFontSize - 2));
|
||||||
|
|
||||||
if (v == null) {
|
if (v == null) {
|
||||||
int layoutId = R.layout.headlines_row;
|
int layoutId = R.layout.headlines_row;
|
||||||
|
|
||||||
@ -686,19 +689,21 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
TextView tt = (TextView)v.findViewById(R.id.title);
|
TextView tt = (TextView)v.findViewById(R.id.title);
|
||||||
|
|
||||||
if (tt != null) {
|
if (tt != null) {
|
||||||
|
tt.setTextSize(TypedValue.COMPLEX_UNIT_SP, Math.min(21, headlineFontSize + 3));
|
||||||
tt.setText(Html.fromHtml(article.title));
|
tt.setText(Html.fromHtml(article.title));
|
||||||
adjustTitleTextView(article.score, tt, position);
|
adjustTitleTextView(article.score, tt, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView ft = (TextView)v.findViewById(R.id.feed_title);
|
TextView ft = (TextView)v.findViewById(R.id.feed_title);
|
||||||
|
|
||||||
if (ft != null) {
|
if (ft != null) {
|
||||||
if (article.feed_title != null && (m_feed.is_cat || m_feed.id < 0)) {
|
if (article.feed_title != null && (m_feed.is_cat || m_feed.id < 0)) {
|
||||||
|
|
||||||
/* if (article.feed_title.length() > 20)
|
/* if (article.feed_title.length() > 20)
|
||||||
ft.setText(article.feed_title.substring(0, 20) + "...");
|
ft.setText(article.feed_title.substring(0, 20) + "...");
|
||||||
else */
|
else */
|
||||||
|
|
||||||
|
ft.setTextSize(TypedValue.COMPLEX_UNIT_SP, headlineSmallFontSize);
|
||||||
ft.setText(article.feed_title);
|
ft.setText(article.feed_title);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -754,7 +759,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
if (excerpt.length() > CommonActivity.EXCERPT_MAX_SIZE)
|
if (excerpt.length() > CommonActivity.EXCERPT_MAX_SIZE)
|
||||||
excerpt = excerpt.substring(0, CommonActivity.EXCERPT_MAX_SIZE) + "...";
|
excerpt = excerpt.substring(0, CommonActivity.EXCERPT_MAX_SIZE) + "...";
|
||||||
|
|
||||||
te.setTextSize(TypedValue.COMPLEX_UNIT_SP, Integer.parseInt(m_prefs.getString("headlines_font_size_sp", "13")));
|
te.setTextSize(TypedValue.COMPLEX_UNIT_SP, headlineFontSize);
|
||||||
te.setText(excerpt);
|
te.setText(excerpt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -763,12 +768,15 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
|
|
||||||
TextView author = (TextView)v.findViewById(R.id.author);
|
TextView author = (TextView)v.findViewById(R.id.author);
|
||||||
|
|
||||||
if (author != null)
|
if (author != null) {
|
||||||
|
author.setTextSize(TypedValue.COMPLEX_UNIT_SP, headlineSmallFontSize);
|
||||||
|
|
||||||
if (articleAuthor.length() > 0) {
|
if (articleAuthor.length() > 0) {
|
||||||
author.setText(getString(R.string.author_formatted, articleAuthor));
|
author.setText(getString(R.string.author_formatted, articleAuthor));
|
||||||
} else {
|
} else {
|
||||||
author.setText("");
|
author.setText("");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ImageView separator = (ImageView)v.findViewById(R.id.headlines_separator);
|
/* ImageView separator = (ImageView)v.findViewById(R.id.headlines_separator);
|
||||||
|
|
||||||
@ -779,6 +787,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
TextView dv = (TextView) v.findViewById(R.id.date);
|
TextView dv = (TextView) v.findViewById(R.id.date);
|
||||||
|
|
||||||
if (dv != null) {
|
if (dv != null) {
|
||||||
|
dv.setTextSize(TypedValue.COMPLEX_UNIT_SP, headlineSmallFontSize);
|
||||||
|
|
||||||
Date d = new Date((long)article.updated * 1000);
|
Date d = new Date((long)article.updated * 1000);
|
||||||
DateFormat df = new SimpleDateFormat("MMM dd, HH:mm");
|
DateFormat df = new SimpleDateFormat("MMM dd, HH:mm");
|
||||||
df.setTimeZone(TimeZone.getDefault());
|
df.setTimeZone(TimeZone.getDefault());
|
||||||
|
@ -131,6 +131,8 @@ public class OfflineArticleFragment extends Fragment {
|
|||||||
m_cursor.moveToFirst();
|
m_cursor.moveToFirst();
|
||||||
|
|
||||||
if (m_cursor.isFirst()) {
|
if (m_cursor.isFirst()) {
|
||||||
|
int articleFontSize = Integer.parseInt(m_prefs.getString("article_font_size_sp", "16"));
|
||||||
|
int articleSmallFontSize = Math.max(10, Math.min(18, articleFontSize - 2));
|
||||||
|
|
||||||
TextView title = (TextView)view.findViewById(R.id.title);
|
TextView title = (TextView)view.findViewById(R.id.title);
|
||||||
|
|
||||||
@ -145,6 +147,7 @@ public class OfflineArticleFragment extends Fragment {
|
|||||||
else
|
else
|
||||||
titleStr = m_cursor.getString(m_cursor.getColumnIndex("title"));
|
titleStr = m_cursor.getString(m_cursor.getColumnIndex("title"));
|
||||||
|
|
||||||
|
title.setTextSize(TypedValue.COMPLEX_UNIT_SP, Math.min(21, articleFontSize + 3));
|
||||||
title.setText(titleStr);
|
title.setText(titleStr);
|
||||||
//title.setPaintFlags(title.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
//title.setPaintFlags(title.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||||
title.setOnClickListener(new OnClickListener() {
|
title.setOnClickListener(new OnClickListener() {
|
||||||
@ -281,7 +284,7 @@ public class OfflineArticleFragment extends Fragment {
|
|||||||
cssOverride += "body { text-align : justify; } ";
|
cssOverride += "body { text-align : justify; } ";
|
||||||
}
|
}
|
||||||
|
|
||||||
ws.setDefaultFontSize(Integer.parseInt(m_prefs.getString("article_font_size_sp", "16")));
|
ws.setDefaultFontSize(articleFontSize);
|
||||||
|
|
||||||
content =
|
content =
|
||||||
"<html>" +
|
"<html>" +
|
||||||
@ -323,6 +326,8 @@ public class OfflineArticleFragment extends Fragment {
|
|||||||
TextView dv = (TextView)view.findViewById(R.id.date);
|
TextView dv = (TextView)view.findViewById(R.id.date);
|
||||||
|
|
||||||
if (dv != null) {
|
if (dv != null) {
|
||||||
|
dv.setTextSize(TypedValue.COMPLEX_UNIT_SP, articleSmallFontSize);
|
||||||
|
|
||||||
Date d = new Date(m_cursor.getInt(m_cursor.getColumnIndex("updated")) * 1000L);
|
Date d = new Date(m_cursor.getInt(m_cursor.getColumnIndex("updated")) * 1000L);
|
||||||
DateFormat df = new SimpleDateFormat("MMM dd, HH:mm");
|
DateFormat df = new SimpleDateFormat("MMM dd, HH:mm");
|
||||||
dv.setText(df.format(d));
|
dv.setText(df.format(d));
|
||||||
@ -333,6 +338,8 @@ public class OfflineArticleFragment extends Fragment {
|
|||||||
boolean hasAuthor = false;
|
boolean hasAuthor = false;
|
||||||
|
|
||||||
if (author != null) {
|
if (author != null) {
|
||||||
|
author.setTextSize(TypedValue.COMPLEX_UNIT_SP, articleSmallFontSize);
|
||||||
|
|
||||||
int authorIndex = m_cursor.getColumnIndex("author");
|
int authorIndex = m_cursor.getColumnIndex("author");
|
||||||
if (authorIndex >= 0)
|
if (authorIndex >= 0)
|
||||||
author.setText(m_cursor.getString(authorIndex));
|
author.setText(m_cursor.getString(authorIndex));
|
||||||
@ -345,6 +352,8 @@ public class OfflineArticleFragment extends Fragment {
|
|||||||
TextView tagv = (TextView)view.findViewById(R.id.tags);
|
TextView tagv = (TextView)view.findViewById(R.id.tags);
|
||||||
|
|
||||||
if (tagv != null) {
|
if (tagv != null) {
|
||||||
|
tagv.setTextSize(TypedValue.COMPLEX_UNIT_SP, articleSmallFontSize);
|
||||||
|
|
||||||
int feedTitleIndex = m_cursor.getColumnIndex("feed_title");
|
int feedTitleIndex = m_cursor.getColumnIndex("feed_title");
|
||||||
|
|
||||||
if (feedTitleIndex != -1 /* && m_isCat */) {
|
if (feedTitleIndex != -1 /* && m_isCat */) {
|
||||||
|
@ -462,6 +462,9 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
|
|||||||
Cursor article = (Cursor)getItem(position);
|
Cursor article = (Cursor)getItem(position);
|
||||||
final int articleId = article.getInt(0);
|
final int articleId = article.getInt(0);
|
||||||
|
|
||||||
|
int headlineFontSize = Integer.parseInt(m_prefs.getString("headlines_font_size_sp", "13"));
|
||||||
|
int headlineSmallFontSize = Math.max(10, Math.min(18, headlineFontSize - 2));
|
||||||
|
|
||||||
if (v == null) {
|
if (v == null) {
|
||||||
int layoutId = R.layout.headlines_row;
|
int layoutId = R.layout.headlines_row;
|
||||||
|
|
||||||
@ -490,6 +493,7 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
|
|||||||
TextView tt = (TextView)v.findViewById(R.id.title);
|
TextView tt = (TextView)v.findViewById(R.id.title);
|
||||||
|
|
||||||
if (tt != null) {
|
if (tt != null) {
|
||||||
|
tt.setTextSize(TypedValue.COMPLEX_UNIT_SP, Math.min(21, headlineFontSize + 3));
|
||||||
tt.setText(Html.fromHtml(article.getString(article.getColumnIndex("title"))));
|
tt.setText(Html.fromHtml(article.getString(article.getColumnIndex("title"))));
|
||||||
|
|
||||||
int scoreIndex = article.getColumnIndex("score");
|
int scoreIndex = article.getColumnIndex("score");
|
||||||
@ -508,6 +512,7 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
|
|||||||
feedTitle = feedTitle.substring(0, 20) + "...";
|
feedTitle = feedTitle.substring(0, 20) + "...";
|
||||||
|
|
||||||
if (feedTitle.length() > 0) {
|
if (feedTitle.length() > 0) {
|
||||||
|
ft.setTextSize(TypedValue.COMPLEX_UNIT_SP, headlineSmallFontSize);
|
||||||
ft.setText(feedTitle);
|
ft.setText(feedTitle);
|
||||||
} else {
|
} else {
|
||||||
ft.setVisibility(View.GONE);
|
ft.setVisibility(View.GONE);
|
||||||
@ -569,7 +574,7 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
|
|||||||
if (excerpt.length() > CommonActivity.EXCERPT_MAX_SIZE)
|
if (excerpt.length() > CommonActivity.EXCERPT_MAX_SIZE)
|
||||||
excerpt = excerpt.substring(0, CommonActivity.EXCERPT_MAX_SIZE) + "...";
|
excerpt = excerpt.substring(0, CommonActivity.EXCERPT_MAX_SIZE) + "...";
|
||||||
|
|
||||||
te.setTextSize(TypedValue.COMPLEX_UNIT_SP, Integer.parseInt(m_prefs.getString("headlines_font_size_sp", "13")));
|
te.setTextSize(TypedValue.COMPLEX_UNIT_SP, headlineFontSize);
|
||||||
te.setText(excerpt);
|
te.setText(excerpt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -581,7 +586,9 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
|
|||||||
if (authorIndex >= 0) {
|
if (authorIndex >= 0) {
|
||||||
String author = article.getString(authorIndex);
|
String author = article.getString(authorIndex);
|
||||||
|
|
||||||
if (author != null && author.length() > 0)
|
ta.setTextSize(TypedValue.COMPLEX_UNIT_SP, headlineSmallFontSize);
|
||||||
|
|
||||||
|
if (author != null && author.length() > 0)
|
||||||
ta.setText(getString(R.string.author_formatted, author));
|
ta.setText(getString(R.string.author_formatted, author));
|
||||||
else
|
else
|
||||||
ta.setText("");
|
ta.setText("");
|
||||||
@ -597,6 +604,8 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
|
|||||||
TextView dv = (TextView) v.findViewById(R.id.date);
|
TextView dv = (TextView) v.findViewById(R.id.date);
|
||||||
|
|
||||||
if (dv != null) {
|
if (dv != null) {
|
||||||
|
dv.setTextSize(TypedValue.COMPLEX_UNIT_SP, headlineSmallFontSize);
|
||||||
|
|
||||||
Date d = new Date((long)article.getInt(article.getColumnIndex("updated")) * 1000);
|
Date d = new Date((long)article.getInt(article.getColumnIndex("updated")) * 1000);
|
||||||
DateFormat df = new SimpleDateFormat("MMM dd, HH:mm");
|
DateFormat df = new SimpleDateFormat("MMM dd, HH:mm");
|
||||||
df.setTimeZone(TimeZone.getDefault());
|
df.setTimeZone(TimeZone.getDefault());
|
||||||
|
Loading…
Reference in New Issue
Block a user