summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2011-12-04 10:50:49 +0300
committerAndrew Dolgov <[email protected]>2011-12-04 10:50:49 +0300
commitea51e68b5b3845a206df1d95d10769ea3740f611 (patch)
tree329c4475f85d9a7c73ae567001b527676def0458
parente057f881b154fc51052eb53f8d2d36a29f5863b1 (diff)
rework combined mode to use textviews to prevent graphical glitches
-rw-r--r--AndroidManifest.xml2
-rw-r--r--res/layout-port/headlines_row.xml2
-rw-r--r--res/layout-port/headlines_row_selected.xml3
-rw-r--r--res/layout-port/headlines_row_unread.xml2
-rw-r--r--res/layout-xlarge/headlines_row.xml4
-rw-r--r--res/layout-xlarge/headlines_row_selected.xml4
-rw-r--r--res/layout-xlarge/headlines_row_unread.xml4
-rw-r--r--res/layout/headlines_row.xml4
-rw-r--r--res/layout/headlines_row_selected.xml4
-rw-r--r--res/layout/headlines_row_unread.xml4
-rw-r--r--res/values/strings.xml2
-rw-r--r--src/org/fox/ttrss/ArticleFragment.java1
-rw-r--r--src/org/fox/ttrss/HeadlinesFragment.java67
13 files changed, 45 insertions, 58 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index d630da5b..b02cb212 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -9,7 +9,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- <application android:icon="@drawable/icon" android:label="@string/app_name">
+ <application android:icon="@drawable/icon" android:label="@string/app_name" android:hardwareAccelerated="true">
<activity android:name=".LoginActivity"
android:label="@string/app_name">
</activity>
diff --git a/res/layout-port/headlines_row.xml b/res/layout-port/headlines_row.xml
index cb58bb26..833a1397 100644
--- a/res/layout-port/headlines_row.xml
+++ b/res/layout-port/headlines_row.xml
@@ -95,7 +95,7 @@
</LinearLayout>
</LinearLayout>
- <WebView
+ <TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/res/layout-port/headlines_row_selected.xml b/res/layout-port/headlines_row_selected.xml
index 85e53116..abdb188b 100644
--- a/res/layout-port/headlines_row_selected.xml
+++ b/res/layout-port/headlines_row_selected.xml
@@ -98,8 +98,9 @@
</LinearLayout>
- <WebView
+ <TextView
android:id="@+id/content"
+ android:text="Article content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
diff --git a/res/layout-port/headlines_row_unread.xml b/res/layout-port/headlines_row_unread.xml
index 28eb47ed..6510535c 100644
--- a/res/layout-port/headlines_row_unread.xml
+++ b/res/layout-port/headlines_row_unread.xml
@@ -98,7 +98,7 @@
</LinearLayout>
- <WebView
+ <TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/res/layout-xlarge/headlines_row.xml b/res/layout-xlarge/headlines_row.xml
index 8b51030d..9b5832c9 100644
--- a/res/layout-xlarge/headlines_row.xml
+++ b/res/layout-xlarge/headlines_row.xml
@@ -100,12 +100,12 @@
</LinearLayout>
</LinearLayout>
- <WebView
+ <TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="3dip" >
- </WebView>
+ </TextView>
</LinearLayout> \ No newline at end of file
diff --git a/res/layout-xlarge/headlines_row_selected.xml b/res/layout-xlarge/headlines_row_selected.xml
index a8d8d8bd..916e2634 100644
--- a/res/layout-xlarge/headlines_row_selected.xml
+++ b/res/layout-xlarge/headlines_row_selected.xml
@@ -98,12 +98,12 @@
</LinearLayout>
</LinearLayout>
- <WebView
+ <TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="3dip" >
- </WebView>
+ </TextView>
</LinearLayout> \ No newline at end of file
diff --git a/res/layout-xlarge/headlines_row_unread.xml b/res/layout-xlarge/headlines_row_unread.xml
index 65f4a5f4..84fcd33f 100644
--- a/res/layout-xlarge/headlines_row_unread.xml
+++ b/res/layout-xlarge/headlines_row_unread.xml
@@ -98,12 +98,12 @@
</LinearLayout>
</LinearLayout>
- <WebView
+ <TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="3dip" >
- </WebView>
+ </TextView>
</LinearLayout> \ No newline at end of file
diff --git a/res/layout/headlines_row.xml b/res/layout/headlines_row.xml
index 8b51030d..9b5832c9 100644
--- a/res/layout/headlines_row.xml
+++ b/res/layout/headlines_row.xml
@@ -100,12 +100,12 @@
</LinearLayout>
</LinearLayout>
- <WebView
+ <TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="3dip" >
- </WebView>
+ </TextView>
</LinearLayout> \ No newline at end of file
diff --git a/res/layout/headlines_row_selected.xml b/res/layout/headlines_row_selected.xml
index a8d8d8bd..916e2634 100644
--- a/res/layout/headlines_row_selected.xml
+++ b/res/layout/headlines_row_selected.xml
@@ -98,12 +98,12 @@
</LinearLayout>
</LinearLayout>
- <WebView
+ <TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="3dip" >
- </WebView>
+ </TextView>
</LinearLayout> \ No newline at end of file
diff --git a/res/layout/headlines_row_unread.xml b/res/layout/headlines_row_unread.xml
index 65f4a5f4..84fcd33f 100644
--- a/res/layout/headlines_row_unread.xml
+++ b/res/layout/headlines_row_unread.xml
@@ -98,12 +98,12 @@
</LinearLayout>
</LinearLayout>
- <WebView
+ <TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="3dip" >
- </WebView>
+ </TextView>
</LinearLayout> \ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a7fb96a9..af36a5c1 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -88,6 +88,6 @@
<string name="error_api_unknown">Error: unknown API error (see log)</string>
<string name="error_login_failed">Error: username or password incorrect</string>
<string name="error_invalid_api_url">Error: invalid API URL</string>
- <string name="combined_mode_summary">Displays articles inline, instead of a separate panel</string>
+ <string name="combined_mode_summary">Displays full article text inline, instead of a separate panel</string>
<string name="combined_mode">Combined mode</string>
</resources> \ No newline at end of file
diff --git a/src/org/fox/ttrss/ArticleFragment.java b/src/org/fox/ttrss/ArticleFragment.java
index a57821ab..1b6debf9 100644
--- a/src/org/fox/ttrss/ArticleFragment.java
+++ b/src/org/fox/ttrss/ArticleFragment.java
@@ -19,7 +19,6 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
-import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.TextView;
diff --git a/src/org/fox/ttrss/HeadlinesFragment.java b/src/org/fox/ttrss/HeadlinesFragment.java
index 8035e191..95ba1f9a 100644
--- a/src/org/fox/ttrss/HeadlinesFragment.java
+++ b/src/org/fox/ttrss/HeadlinesFragment.java
@@ -1,6 +1,9 @@
package org.fox.ttrss;
+import java.io.IOException;
+import java.io.InputStream;
import java.lang.reflect.Type;
+import java.net.MalformedURLException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -9,26 +12,31 @@ import java.util.HashMap;
import java.util.List;
import java.util.TimeZone;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.DefaultHttpClient;
import org.jsoup.Jsoup;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.text.Html;
+import android.text.Html.ImageGetter;
+import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.util.Log;
-import android.util.TypedValue;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
-import android.webkit.WebSettings;
-import android.webkit.WebView;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.AdapterView;
@@ -67,6 +75,15 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
private ArticleOps m_articleOps;
+ private ImageGetter m_dummyGetter = new ImageGetter() {
+
+ @Override
+ public Drawable getDrawable(String source) {
+ return new BitmapDrawable();
+ }
+
+ };
+
public ArticleList getSelectedArticles() {
return m_selectedArticles;
}
@@ -330,7 +347,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
View v = convertView;
final Article article = items.get(position);
- int webBgResource = R.attr.headlineNormalBackground;
if (v == null) {
int layoutId = R.layout.headlines_row;
@@ -341,11 +357,9 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
break;
case VIEW_UNREAD:
layoutId = R.layout.headlines_row_unread;
- webBgResource = R.attr.headlineUnreadBackground;
break;
case VIEW_SELECTED:
layoutId = R.layout.headlines_row_selected;
- webBgResource = R.attr.headlineSelectedBackground;
break;
}
@@ -416,46 +430,19 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
}
}
- WebView web = (WebView)v.findViewById(R.id.content);
+ TextView content = (TextView)v.findViewById(R.id.content);
- if (web != null) {
+ if (content != null) {
if (m_combinedMode) {
- String content;
- String cssOverride = "";
-
- TypedValue tv = new TypedValue();
- getActivity().getTheme().resolveAttribute(webBgResource, tv, true);
- int webColor = tv.data;
-
- web.setBackgroundColor(webColor);
-
- //WebSettings ws = web.getSettings();
- //ws.setBlockNetworkLoads(true);
+ content.setMovementMethod(LinkMovementMethod.getInstance());
- if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) {
- cssOverride = "body { background : transparent; color : #e0e0e0}\n";
- } else {
- cssOverride = "body { background : transparent; }\n";
- }
+ //content.setText(Html.fromHtml(article.content, new URLImageGetter(content, getActivity()), null));
+ content.setText(Html.fromHtml(article.content, m_dummyGetter, null));
- content =
- "<html>" +
- "<head>" +
- "<meta content=\"text/html; charset=utf-8\" http-equiv=\"content-type\" />" +
- "<meta name=\"viewport\" content=\"target-densitydpi=device-dpi\" />" +
- "<style type=\"text/css\">" +
- cssOverride +
- "img { max-width : 98%; height : auto; }" +
- "body { text-align : justify; }" +
- "</style>" +
- "</head>" +
- "<body>" + article.content + "</body></html>";
-
- web.loadDataWithBaseURL(null, content, "text/html", "utf-8", null);
- //web.setOnTouchListener(new WebViewClickListener(web, parent, position));
} else {
- web.setVisibility(View.GONE);
+ content.setVisibility(View.GONE);
}
+
}
TextView dv = (TextView) v.findViewById(R.id.date);