diff options
author | Andrew Dolgov <[email protected]> | 2014-11-20 12:21:29 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2014-11-20 12:21:29 +0300 |
commit | 1accc3749f49ae77aa33991e8a6eb5be1f868793 (patch) | |
tree | ffba8c2fe00bb5716addcda77935b1400f014d0d /org.fox.ttrss | |
parent | 55f86ded6220ea6317260d914690ee32b67dc0bf (diff) |
enable support for watching videos if permitted by backend
Diffstat (limited to 'org.fox.ttrss')
-rw-r--r-- | org.fox.ttrss/org.fox.ttrss.iml | 12 | ||||
-rw-r--r-- | org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java | 37 |
2 files changed, 29 insertions, 20 deletions
diff --git a/org.fox.ttrss/org.fox.ttrss.iml b/org.fox.ttrss/org.fox.ttrss.iml index 5506e1af..64ffc5b1 100644 --- a/org.fox.ttrss/org.fox.ttrss.iml +++ b/org.fox.ttrss/org.fox.ttrss.iml @@ -80,17 +80,17 @@ </content> <orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" /> <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="library" exported="" name="cardview-v7-21.0.0" level="project" /> - <orderEntry type="library" exported="" name="support-annotations-21.0.0" level="project" /> - <orderEntry type="library" exported="" name="fab-0.0.5" level="project" /> - <orderEntry type="library" exported="" name="support-v4-21.0.0" level="project" /> - <orderEntry type="library" exported="" name="dashclock-api-r1.1" level="project" /> - <orderEntry type="library" exported="" name="systembartint-1.0.3" level="project" /> <orderEntry type="library" exported="" name="gson-2.2.4" level="project" /> + <orderEntry type="library" exported="" name="cardview-v7-21.0.0" level="project" /> <orderEntry type="library" exported="" name="jsoup-1.6.1" level="project" /> <orderEntry type="library" exported="" name="library-2.4.1" level="project" /> + <orderEntry type="library" exported="" name="support-v4-21.0.0" level="project" /> + <orderEntry type="library" exported="" name="systembartint-1.0.3" level="project" /> <orderEntry type="library" exported="" name="universal-image-loader-1.9.3" level="project" /> <orderEntry type="library" exported="" name="appcompat-v7-21.0.0" level="project" /> + <orderEntry type="library" exported="" name="dashclock-api-r1.1" level="project" /> + <orderEntry type="library" exported="" name="fab-0.0.5" level="project" /> + <orderEntry type="library" exported="" name="support-annotations-21.0.0" level="project" /> <orderEntry type="module" module-name="taskerlocaleapi" exported="" /> </component> </module> diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java index 398fa1ad..e74ea2e1 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java @@ -18,6 +18,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; +import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebView.HitTestResult; @@ -238,11 +239,14 @@ public class ArticleFragment extends Fragment { } } }); - + + boolean acceleratedWebview = true; + // prevent flicker in ics if (!m_prefs.getBoolean("webview_hardware_accel", true) || useTitleWebView) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { web.setLayerType(View.LAYER_TYPE_SOFTWARE, null); + acceleratedWebview = false; } } @@ -273,18 +277,23 @@ public class ArticleFragment extends Fragment { cssOverride += " a:link {color: "+linkHexColor+";} a:visited { color: "+linkHexColor+";}"; String articleContent = m_article.content != null ? m_article.content : ""; - - Document doc = Jsoup.parse(articleContent); - - if (doc != null) { - // thanks webview for crashing on <video> tag - Elements videos = doc.select("video"); - - for (Element video : videos) - video.remove(); - - articleContent = doc.toString(); - } + + if (m_activity.isCompatMode() || !acceleratedWebview) { + Document doc = Jsoup.parse(articleContent); + + if (doc != null) { + // thanks webview for crashing on <video> tag + Elements videos = doc.select("video"); + + for (Element video : videos) + video.remove(); + + articleContent = doc.toString(); + } + } else { + ws.setJavaScriptEnabled(true); + web.setWebChromeClient(new WebChromeClient()); + } if (m_prefs.getBoolean("justify_article_text", true)) { cssOverride += "body { text-align : justify; } "; @@ -299,7 +308,7 @@ public class ArticleFragment extends Fragment { "<meta name=\"viewport\" content=\"width=device-width, user-scalable=no\" />" + "<style type=\"text/css\">" + "body { padding : 0px; margin : 0px; line-height : 130%; }" + - "img { max-width : 100%; width : auto; height : auto; }" + + "img, video, iframe { max-width : 100%; width : auto; height : auto; }" + " table { width : 100%; }" + cssOverride + "</style>" + |