allow more precise font size selection for headlines & article
remove single_column layout stuff
This commit is contained in:
parent
3b3b79ade2
commit
3d23240bb0
@ -11,16 +11,6 @@
|
|||||||
<item>THEME_LIGHT</item>
|
<item>THEME_LIGHT</item>
|
||||||
<item>THEME_SEPIA</item>
|
<item>THEME_SEPIA</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="pref_font_size_names">
|
|
||||||
<item>@string/font_size_small</item>
|
|
||||||
<item>@string/font_size_medium</item>
|
|
||||||
<item>@string/font_size_large</item>
|
|
||||||
</string-array>
|
|
||||||
<string-array name="pref_font_size_values" translatable="false">
|
|
||||||
<item>0</item>
|
|
||||||
<item>1</item>
|
|
||||||
<item>2</item>
|
|
||||||
</string-array>
|
|
||||||
<string-array name="pref_view_mode_names">
|
<string-array name="pref_view_mode_names">
|
||||||
<item>@string/category_browse_headlines</item>
|
<item>@string/category_browse_headlines</item>
|
||||||
<item>@string/category_browse_articles</item>
|
<item>@string/category_browse_articles</item>
|
||||||
|
@ -103,21 +103,18 @@
|
|||||||
android:summary="@string/pref_headlines_mark_read_scroll_long"
|
android:summary="@string/pref_headlines_mark_read_scroll_long"
|
||||||
android:title="@string/pref_headlines_mark_read_scroll" />
|
android:title="@string/pref_headlines_mark_read_scroll" />
|
||||||
|
|
||||||
<ListPreference
|
<EditTextPreference
|
||||||
android:defaultValue="0"
|
android:defaultValue="13"
|
||||||
android:entries="@array/pref_font_size_names"
|
android:key="headlines_font_size_sp"
|
||||||
android:entryValues="@array/pref_font_size_values"
|
android:inputType="number"
|
||||||
android:key="headlines_font_size"
|
|
||||||
android:title="@string/pref_headline_font_size" />
|
android:title="@string/pref_headline_font_size" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="@string/reading" >
|
<PreferenceCategory android:title="@string/reading" >
|
||||||
<ListPreference
|
<EditTextPreference
|
||||||
android:defaultValue="0"
|
android:defaultValue="16"
|
||||||
android:entries="@array/pref_font_size_names"
|
android:key="article_font_size_sp"
|
||||||
android:entryValues="@array/pref_font_size_values"
|
android:inputType="number"
|
||||||
android:key="font_size"
|
|
||||||
android:title="@string/pref_font_size" />
|
android:title="@string/pref_font_size" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="justify_article_text"
|
android:key="justify_article_text"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package org.fox.ttrss;
|
package org.fox.ttrss;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
@ -25,20 +24,16 @@ 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;
|
||||||
import android.view.GestureDetector;
|
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MotionEvent;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.webkit.WebChromeClient;
|
import android.webkit.WebChromeClient;
|
||||||
import android.webkit.WebSettings;
|
import android.webkit.WebSettings;
|
||||||
import android.webkit.WebSettings.LayoutAlgorithm;
|
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.webkit.WebView.HitTestResult;
|
import android.webkit.WebView.HitTestResult;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -219,13 +214,7 @@ public class ArticleFragment extends Fragment {
|
|||||||
String cssOverride = "";
|
String cssOverride = "";
|
||||||
|
|
||||||
WebSettings ws = web.getSettings();
|
WebSettings ws = web.getSettings();
|
||||||
ws.setSupportZoom(true);
|
ws.setSupportZoom(false);
|
||||||
ws.setBuiltInZoomControls(true);
|
|
||||||
|
|
||||||
if (!m_activity.isCompatMode())
|
|
||||||
ws.setDisplayZoomControls(false);
|
|
||||||
|
|
||||||
web.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
|
|
||||||
|
|
||||||
TypedValue tv = new TypedValue();
|
TypedValue tv = new TypedValue();
|
||||||
getActivity().getTheme().resolveAttribute(R.attr.linkColor, tv, true);
|
getActivity().getTheme().resolveAttribute(R.attr.linkColor, tv, true);
|
||||||
@ -270,30 +259,17 @@ public class ArticleFragment extends Fragment {
|
|||||||
cssOverride += "body { text-align : justify; } ";
|
cssOverride += "body { text-align : justify; } ";
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Integer.parseInt(m_prefs.getString("font_size", "0"))) {
|
ws.setDefaultFontSize(Integer.parseInt(m_prefs.getString("article_font_size_sp", "16")));
|
||||||
case 0:
|
|
||||||
ws.setDefaultFontSize(13);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
ws.setDefaultFontSize(16);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
ws.setDefaultFontSize(18);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
|
||||||
cssOverride += "img { max-width : 99%; }";
|
|
||||||
}
|
|
||||||
|
|
||||||
content =
|
content =
|
||||||
"<html>" +
|
"<html>" +
|
||||||
"<head>" +
|
"<head>" +
|
||||||
"<meta content=\"text/html; charset=utf-8\" http-equiv=\"content-type\">" +
|
"<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\">" +
|
"<style type=\"text/css\">" +
|
||||||
"body { padding : 0px; margin : 0px; }" +
|
"body { padding : 0px; margin : 0px; line-height : 120%; }" +
|
||||||
|
"img { max-width : 100%; width : auto; height : auto; }" +
|
||||||
cssOverride +
|
cssOverride +
|
||||||
"body { line-height : 120%; }" +
|
|
||||||
"</style>" +
|
"</style>" +
|
||||||
"</head>" +
|
"</head>" +
|
||||||
"<body>" + articleContent;
|
"<body>" + articleContent;
|
||||||
|
@ -732,22 +732,8 @@ 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) + "...";
|
||||||
|
|
||||||
int fontSize = -1;
|
|
||||||
|
|
||||||
switch (Integer.parseInt(m_prefs.getString("headlines_font_size", "0"))) {
|
te.setTextSize(TypedValue.COMPLEX_UNIT_SP, Integer.parseInt(m_prefs.getString("headlines_font_size_sp", "13")));
|
||||||
case 0:
|
|
||||||
fontSize = 13;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
fontSize = 16;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
fontSize = 18;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
te.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
|
|
||||||
te.setText(excerpt);
|
te.setText(excerpt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,17 +29,14 @@ 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;
|
||||||
import android.view.GestureDetector;
|
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.MotionEvent;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.webkit.WebChromeClient;
|
import android.webkit.WebChromeClient;
|
||||||
import android.webkit.WebSettings;
|
import android.webkit.WebSettings;
|
||||||
import android.webkit.WebSettings.LayoutAlgorithm;
|
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.webkit.WebView.HitTestResult;
|
import android.webkit.WebView.HitTestResult;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -220,13 +217,7 @@ public class OfflineArticleFragment extends Fragment {
|
|||||||
String cssOverride = "";
|
String cssOverride = "";
|
||||||
|
|
||||||
WebSettings ws = web.getSettings();
|
WebSettings ws = web.getSettings();
|
||||||
ws.setSupportZoom(true);
|
ws.setSupportZoom(false);
|
||||||
ws.setBuiltInZoomControls(true);
|
|
||||||
|
|
||||||
if (!m_activity.isCompatMode())
|
|
||||||
ws.setDisplayZoomControls(false);
|
|
||||||
|
|
||||||
web.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
|
|
||||||
|
|
||||||
TypedValue tv = new TypedValue();
|
TypedValue tv = new TypedValue();
|
||||||
getActivity().getTheme().resolveAttribute(R.attr.linkColor, tv, true);
|
getActivity().getTheme().resolveAttribute(R.attr.linkColor, tv, true);
|
||||||
@ -290,30 +281,17 @@ public class OfflineArticleFragment extends Fragment {
|
|||||||
cssOverride += "body { text-align : justify; } ";
|
cssOverride += "body { text-align : justify; } ";
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Integer.parseInt(m_prefs.getString("font_size", "0"))) {
|
ws.setDefaultFontSize(Integer.parseInt(m_prefs.getString("article_font_size_sp", "16")));
|
||||||
case 0:
|
|
||||||
ws.setDefaultFontSize(13);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
ws.setDefaultFontSize(16);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
ws.setDefaultFontSize(18);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
|
||||||
cssOverride += "img { max-width : 99%; }";
|
|
||||||
}
|
|
||||||
|
|
||||||
content =
|
content =
|
||||||
"<html>" +
|
"<html>" +
|
||||||
"<head>" +
|
"<head>" +
|
||||||
"<meta content=\"text/html; charset=utf-8\" http-equiv=\"content-type\">" +
|
"<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\">" +
|
"<style type=\"text/css\">" +
|
||||||
"body { padding : 0px; margin : 0px; }" +
|
"body { padding : 0px; margin : 0px; line-height : 120%; }" +
|
||||||
cssOverride +
|
cssOverride +
|
||||||
"body { line-height : 120%; }" +
|
"img { max-width : 100%; width : auto; height : auto; }" +
|
||||||
"</style>" +
|
"</style>" +
|
||||||
"</head>" +
|
"</head>" +
|
||||||
"<body>" + articleContent;
|
"<body>" + articleContent;
|
||||||
|
@ -568,22 +568,8 @@ 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) + "...";
|
||||||
|
|
||||||
int fontSize = -1;
|
|
||||||
|
|
||||||
switch (Integer.parseInt(m_prefs.getString("headlines_font_size", "0"))) {
|
te.setTextSize(TypedValue.COMPLEX_UNIT_SP, Integer.parseInt(m_prefs.getString("headlines_font_size_sp", "13")));
|
||||||
case 0:
|
|
||||||
fontSize = 13;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
fontSize = 16;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
fontSize = 18;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
te.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
|
|
||||||
te.setText(excerpt);
|
te.setText(excerpt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user