diff options
author | Andrew Dolgov <[email protected]> | 2013-11-19 20:07:17 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-11-19 20:07:17 +0400 |
commit | ac96ae00d3fa887a7bb1ad0b67821cadd60fe887 (patch) | |
tree | 1ac7c0d27c465374c542f1f1c03459a620d6921f /src/org | |
parent | 12b784d06b380894348a793d106b586ba1f79f17 (diff) |
add workaround for webview not working correctly inside viewpager or w/e
(the no rect test based nodes found issue)
thanks, google engineers, amazing work
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/fox/ttrss/ArticleFragment.java | 70 | ||||
-rw-r--r-- | src/org/fox/ttrss/offline/OfflineArticleFragment.java | 68 | ||||
-rw-r--r-- | src/org/fox/ttrss/util/LessBrokenWebView.java | 37 |
3 files changed, 40 insertions, 135 deletions
diff --git a/src/org/fox/ttrss/ArticleFragment.java b/src/org/fox/ttrss/ArticleFragment.java index 73312c48..d2b94b98 100644 --- a/src/org/fox/ttrss/ArticleFragment.java +++ b/src/org/fox/ttrss/ArticleFragment.java @@ -41,13 +41,12 @@ import android.webkit.WebView; import android.webkit.WebView.HitTestResult; import android.widget.TextView; -public class ArticleFragment extends Fragment implements GestureDetector.OnDoubleTapListener { +public class ArticleFragment extends Fragment { private final String TAG = this.getClass().getSimpleName(); private SharedPreferences m_prefs; private Article m_article; private OnlineActivity m_activity; - private GestureDetector m_detector; public void initialize(Article article) { m_article = article; @@ -173,7 +172,7 @@ public class ArticleFragment extends Fragment implements GestureDetector.OnDoubl } } - web.setWebChromeClient(new WebChromeClient() { + web.setWebChromeClient(new WebChromeClient() { @Override public void onProgressChanged(WebView view, int progress) { m_activity.setProgress(Math.round(((float)progress / 100f) * 10000)); @@ -183,13 +182,6 @@ public class ArticleFragment extends Fragment implements GestureDetector.OnDoubl } }); - web.setOnTouchListener(new View.OnTouchListener() { - @Override - public boolean onTouch(View v, MotionEvent event) { - return m_detector.onTouchEvent(event); - } - }); - String content; String cssOverride = ""; @@ -385,63 +377,5 @@ public class ArticleFragment extends Fragment implements GestureDetector.OnDoubl m_activity = (OnlineActivity)activity; //m_article = m_onlineServices.getSelectedArticle(); - m_detector = new GestureDetector(m_activity, new GestureDetector.OnGestureListener() { - @Override - public boolean onSingleTapUp(MotionEvent e) { - // TODO Auto-generated method stub - return false; - } - - @Override - public void onShowPress(MotionEvent e) { - // TODO Auto-generated method stub - - } - - @Override - public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, - float distanceY) { - // TODO Auto-generated method stub - return false; - } - - @Override - public void onLongPress(MotionEvent e) { - m_activity.openContextMenu(getView()); - } - - @Override - public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, - float velocityY) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean onDown(MotionEvent e) { - // TODO Auto-generated method stub - return false; - } - }); - - m_detector.setOnDoubleTapListener(this); - } - - @Override - public boolean onDoubleTap(MotionEvent arg0) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean onDoubleTapEvent(MotionEvent arg0) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean onSingleTapConfirmed(MotionEvent arg0) { - // TODO Auto-generated method stub - return false; } } diff --git a/src/org/fox/ttrss/offline/OfflineArticleFragment.java b/src/org/fox/ttrss/offline/OfflineArticleFragment.java index f3d6f5d9..248827cd 100644 --- a/src/org/fox/ttrss/offline/OfflineArticleFragment.java +++ b/src/org/fox/ttrss/offline/OfflineArticleFragment.java @@ -43,7 +43,7 @@ import android.webkit.WebView; import android.webkit.WebView.HitTestResult; import android.widget.TextView; -public class OfflineArticleFragment extends Fragment implements GestureDetector.OnDoubleTapListener { +public class OfflineArticleFragment extends Fragment { private final String TAG = this.getClass().getSimpleName(); private SharedPreferences m_prefs; @@ -51,7 +51,6 @@ public class OfflineArticleFragment extends Fragment implements GestureDetector. private boolean m_isCat = false; // FIXME use private Cursor m_cursor; private OfflineActivity m_activity; - private GestureDetector m_detector; public void initialize(int articleId) { m_articleId = articleId; @@ -191,13 +190,6 @@ public class OfflineArticleFragment extends Fragment implements GestureDetector. } }); - web.setOnTouchListener(new View.OnTouchListener() { - @Override - public boolean onTouch(View v, MotionEvent event) { - return m_detector.onTouchEvent(event); - } - }); - String content; String cssOverride = ""; @@ -379,63 +371,5 @@ public class OfflineArticleFragment extends Fragment implements GestureDetector. m_activity = (OfflineActivity) activity; - m_detector = new GestureDetector(m_activity, new GestureDetector.OnGestureListener() { - @Override - public boolean onSingleTapUp(MotionEvent e) { - // TODO Auto-generated method stub - return false; - } - - @Override - public void onShowPress(MotionEvent e) { - // TODO Auto-generated method stub - - } - - @Override - public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, - float distanceY) { - // TODO Auto-generated method stub - return false; - } - - @Override - public void onLongPress(MotionEvent e) { - m_activity.openContextMenu(getView()); - } - - @Override - public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, - float velocityY) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean onDown(MotionEvent e) { - // TODO Auto-generated method stub - return false; - } - }); - - m_detector.setOnDoubleTapListener(this); - } - - @Override - public boolean onDoubleTap(MotionEvent arg0) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean onDoubleTapEvent(MotionEvent arg0) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean onSingleTapConfirmed(MotionEvent e) { - // TODO Auto-generated method stub - return false; } } diff --git a/src/org/fox/ttrss/util/LessBrokenWebView.java b/src/org/fox/ttrss/util/LessBrokenWebView.java new file mode 100644 index 00000000..c6cab513 --- /dev/null +++ b/src/org/fox/ttrss/util/LessBrokenWebView.java @@ -0,0 +1,37 @@ +package org.fox.ttrss.util;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.webkit.WebView;
+
+public class LessBrokenWebView extends WebView {
+
+ public LessBrokenWebView(Context context) {
+ super(context);
+ // TODO Auto-generated constructor stub
+ }
+
+ public LessBrokenWebView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ // TODO Auto-generated constructor stub
+ }
+
+ public LessBrokenWebView(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+
+ if (event.getAction() == MotionEvent.ACTION_DOWN) {
+ int temp_ScrollY = getScrollY();
+ scrollTo(getScrollX(), getScrollY() + 1);
+ scrollTo(getScrollX(), temp_ScrollY);
+ }
+
+ return super.onTouchEvent(event);
+ }
+
+}
|