enable support for watching videos if permitted by backend

This commit is contained in:
Andrew Dolgov 2014-11-20 12:21:29 +03:00
parent 55f86ded62
commit 1accc3749f
2 changed files with 29 additions and 20 deletions

View File

@ -80,17 +80,17 @@
</content> </content>
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <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="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="jsoup-1.6.1" level="project" />
<orderEntry type="library" exported="" name="library-2.4.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="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="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="" /> <orderEntry type="module" module-name="taskerlocaleapi" exported="" />
</component> </component>
</module> </module>

View File

@ -18,6 +18,7 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings; import android.webkit.WebSettings;
import android.webkit.WebView; import android.webkit.WebView;
import android.webkit.WebView.HitTestResult; import android.webkit.WebView.HitTestResult;
@ -239,10 +240,13 @@ public class ArticleFragment extends Fragment {
} }
}); });
boolean acceleratedWebview = true;
// prevent flicker in ics // prevent flicker in ics
if (!m_prefs.getBoolean("webview_hardware_accel", true) || useTitleWebView) { if (!m_prefs.getBoolean("webview_hardware_accel", true) || useTitleWebView) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
web.setLayerType(View.LAYER_TYPE_SOFTWARE, null); web.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
acceleratedWebview = false;
} }
} }
@ -274,6 +278,7 @@ public class ArticleFragment extends Fragment {
String articleContent = m_article.content != null ? m_article.content : ""; String articleContent = m_article.content != null ? m_article.content : "";
if (m_activity.isCompatMode() || !acceleratedWebview) {
Document doc = Jsoup.parse(articleContent); Document doc = Jsoup.parse(articleContent);
if (doc != null) { if (doc != null) {
@ -284,6 +289,10 @@ public class ArticleFragment extends Fragment {
video.remove(); video.remove();
articleContent = doc.toString(); articleContent = doc.toString();
}
} else {
ws.setJavaScriptEnabled(true);
web.setWebChromeClient(new WebChromeClient());
} }
if (m_prefs.getBoolean("justify_article_text", true)) { if (m_prefs.getBoolean("justify_article_text", true)) {
@ -299,7 +308,7 @@ public class ArticleFragment extends Fragment {
"<meta name=\"viewport\" content=\"width=device-width, user-scalable=no\" />" + "<meta name=\"viewport\" content=\"width=device-width, user-scalable=no\" />" +
"<style type=\"text/css\">" + "<style type=\"text/css\">" +
"body { padding : 0px; margin : 0px; line-height : 130%; }" + "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%; }" + " table { width : 100%; }" +
cssOverride + cssOverride +
"</style>" + "</style>" +