enable support for watching videos if permitted by backend
This commit is contained in:
parent
55f86ded62
commit
1accc3749f
@ -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>
|
||||
|
@ -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>" +
|
||||
|
Loading…
Reference in New Issue
Block a user