article fragment: simplify things a bit
This commit is contained in:
parent
e5159ab48a
commit
9523151a25
@ -221,18 +221,6 @@ public class ArticleFragment extends Fragment {
|
|||||||
|
|
||||||
if (title != null) {
|
if (title != null) {
|
||||||
|
|
||||||
/* if (m_prefs.getBoolean("enable_condensed_fonts", false)) {
|
|
||||||
Typeface tf = TypefaceCache.get(m_activity, "sans-serif-condensed", Typeface.NORMAL);
|
|
||||||
|
|
||||||
if (tf != null && !tf.equals(title.getTypeface())) {
|
|
||||||
title.setTypeface(tf);
|
|
||||||
}
|
|
||||||
|
|
||||||
title.setTextSize(TypedValue.COMPLEX_UNIT_SP, Math.min(21, articleFontSize + 5));
|
|
||||||
} else {
|
|
||||||
title.setTextSize(TypedValue.COMPLEX_UNIT_SP, Math.min(21, articleFontSize + 3));
|
|
||||||
} */
|
|
||||||
|
|
||||||
title.setTextSize(TypedValue.COMPLEX_UNIT_SP, Math.min(21, articleFontSize + 3));
|
title.setTextSize(TypedValue.COMPLEX_UNIT_SP, Math.min(21, articleFontSize + 3));
|
||||||
|
|
||||||
String titleStr;
|
String titleStr;
|
||||||
@ -372,14 +360,6 @@ public class ArticleFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_article != null) {
|
|
||||||
|
|
||||||
new Handler().postDelayed(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
|
|
||||||
if (m_web != null) {
|
|
||||||
|
|
||||||
m_web.setOnLongClickListener(new View.OnLongClickListener() {
|
m_web.setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongClick(View v) {
|
public boolean onLongClick(View v) {
|
||||||
@ -406,7 +386,6 @@ public class ArticleFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String content;
|
|
||||||
String cssOverride = "";
|
String cssOverride = "";
|
||||||
|
|
||||||
WebSettings ws = m_web.getSettings();
|
WebSettings ws = m_web.getSettings();
|
||||||
@ -447,8 +426,7 @@ public class ArticleFragment extends Fragment {
|
|||||||
|
|
||||||
ws.setDefaultFontSize(articleFontSize);
|
ws.setDefaultFontSize(articleFontSize);
|
||||||
|
|
||||||
content =
|
StringBuilder content = new StringBuilder("<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\" />" +
|
"<meta name=\"viewport\" content=\"width=device-width, user-scalable=no\" />" +
|
||||||
@ -459,7 +437,9 @@ public class ArticleFragment extends Fragment {
|
|||||||
cssOverride +
|
cssOverride +
|
||||||
"</style>" +
|
"</style>" +
|
||||||
"</head>" +
|
"</head>" +
|
||||||
"<body>" + articleContent;
|
"<body>");
|
||||||
|
|
||||||
|
content.append(articleContent);
|
||||||
|
|
||||||
if (m_article.attachments != null && m_article.attachments.size() != 0) {
|
if (m_article.attachments != null && m_article.attachments.size() != 0) {
|
||||||
String flatContent = articleContent.replaceAll("[\r\n]", "");
|
String flatContent = articleContent.replaceAll("[\r\n]", "");
|
||||||
@ -474,7 +454,7 @@ public class ArticleFragment extends Fragment {
|
|||||||
URL url = new URL(a.content_url.trim());
|
URL url = new URL(a.content_url.trim());
|
||||||
String strUrl = url.toString().trim();
|
String strUrl = url.toString().trim();
|
||||||
|
|
||||||
content += "<p><img src=\"" + strUrl.replace("\"", "\\\"") + "\"></p>";
|
content.append("<p><img src=\"" + strUrl.replace("\"", "\\\"") + "\"></p>");
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
@ -486,7 +466,7 @@ public class ArticleFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
content += "</body></html>";
|
content.append("</body></html>");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String baseUrl = null;
|
String baseUrl = null;
|
||||||
@ -499,13 +479,13 @@ public class ArticleFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (savedInstanceState == null || !acceleratedWebview) {
|
if (savedInstanceState == null || !acceleratedWebview) {
|
||||||
m_web.loadDataWithBaseURL(baseUrl, content, "text/html", "utf-8", null);
|
m_web.loadDataWithBaseURL(baseUrl, content.toString(), "text/html", "utf-8", null);
|
||||||
} else {
|
} else {
|
||||||
WebBackForwardList rc = m_web.restoreState(savedInstanceState);
|
WebBackForwardList rc = m_web.restoreState(savedInstanceState);
|
||||||
|
|
||||||
if (rc == null) {
|
if (rc == null) {
|
||||||
// restore failed...
|
// restore failed...
|
||||||
m_web.loadDataWithBaseURL(baseUrl, content, "text/html", "utf-8", null);
|
m_web.loadDataWithBaseURL(baseUrl, content.toString(), "text/html", "utf-8", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -513,16 +493,7 @@ public class ArticleFragment extends Fragment {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (m_activity.isSmallScreen())
|
|
||||||
// web.setOnTouchListener(m_gestureListener);
|
|
||||||
|
|
||||||
m_web.setVisibility(View.VISIBLE);
|
m_web.setVisibility(View.VISIBLE);
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user