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
This commit is contained in:
parent
12b784d06b
commit
ac96ae00d3
@ -94,7 +94,7 @@
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<WebView
|
||||
<org.fox.ttrss.util.LessBrokenWebView
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
37
src/org/fox/ttrss/util/LessBrokenWebView.java
Normal file
37
src/org/fox/ttrss/util/LessBrokenWebView.java
Normal file
@ -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);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user