Status: Unconfirmed
Owner: ----
Labels: OS-Android Pri-2
New issue 502180 by
yeni0...@gmail.com: On Lollipop, the full screen video
view is transparent on webview.
https://code.google.com/p/chromium/issues/detail?id=502180
Device name: Samsung Galaxy note4
From "Settings > About Chrome"
Application version: 43.0.2357.93
OS: Lollipop
URLs (if applicable):
http://milk.soribada.com/mobile/milkEvent/?uid=F335EF26F46A58CCF7EF804616226763&opt=5
Behavior in Android Browser (if applicable):
What steps will reproduce the problem?
1. Loaded a url which has a youtube video on webview.
2. Set The webview activity theme as transparent.
3. When the video is paused, click full screen button at the bottom right
of video view.
What is the expected result?
When I checked it on KitKat with same apk, black screen was showing. It
might be normal operation.
What happens instead?
The background color of the video surface view is transparent in case of
switching to full screen view when the video is paused on webview.
So, an activity stacked behind is appeared through the video surface view.
This issue just occurs on Lollipop OS.
[Sample code]
--MainActivity.java-----------------------------------------------------------------------
package com.example.webviewtestactivity;
import android.app.Activity;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
public class MainActivity extends Activity {
private WebView mWebView;
private View mCustomView;
FullscreenableChromeClient mChoromeClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mWebView = (WebView) findViewById(R.id.notice_webview);
mWebView.setHorizontalScrollBarEnabled(false);
mWebView.getSettings().setTextZoom(100);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.setWebViewClient(new WebViewClient());
mChoromeClient = new FullscreenableChromeClient();
mWebView.setWebChromeClient(mChoromeClient);
mWebView.loadUrl("
http://milk.soribada.com/mobile/milkEvent/?uid=F335EF26F46A58CCF7EF804616226763&opt=5");
}
public class FullscreenableChromeClient extends WebChromeClient {
private Activity mActivity = MainActivity.this;
private WebChromeClient.CustomViewCallback mCustomViewCallback;
private FrameLayout mFullscreenContainer;
private final FrameLayout.LayoutParams COVER_SCREEN_PARAMS = new
FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
@Override
public void onShowCustomView(View view,
WebChromeClient.CustomViewCallback callback) {
if (mCustomView != null) {
callback.onCustomViewHidden();
return;
}
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
FrameLayout decor = (FrameLayout)
mActivity.getWindow().getDecorView();
mFullscreenContainer = new FullscreenHolder(mActivity);
mFullscreenContainer.addView(view, COVER_SCREEN_PARAMS);
decor.addView(mFullscreenContainer, COVER_SCREEN_PARAMS);
mCustomView = view;
setFullscreen(true);
mCustomViewCallback = callback;
super.onShowCustomView(view, callback);
}
@Override
public void onHideCustomView() {
if (mCustomView == null) {
return;
}
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setFullscreen(false);
FrameLayout decor = (FrameLayout)
mActivity.getWindow().getDecorView();
decor.removeView(mFullscreenContainer);
mFullscreenContainer = null;
mCustomView = null;
mCustomViewCallback.onCustomViewHidden();
}
private void setFullscreen(boolean enabled) {
Window win = mActivity.getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
final int bits = WindowManager.LayoutParams.FLAG_FULLSCREEN;
if (enabled) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
if (mCustomView != null) {
mCustomView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
}
win.setAttributes(winParams);
}
}
private static class FullscreenHolder extends FrameLayout {
public FullscreenHolder(Context ctx) {
super(ctx);
setBackgroundColor(ctx.getResources().getColor(android.R.color.black));
}
@Override
public boolean onTouchEvent(MotionEvent evt) {
return true;
}
}
}
--Manifest.xml-------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="
http://schemas.android.com/apk/res/android"
package="com.example.webviewtestactivity"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|uiMode|
orientation|screenSize"
android:theme="@style/AppTheme.Transparent"
android:launchMode="singleTop"
android:hardwareAccelerated="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
--activity_main.xml---------------------------------------------------------------------------------
<RelativeLayout xmlns:android="
http://schemas.android.com/apk/res/android"
xmlns:tools="
http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<WebView
android:id="@+id/notice_webview"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</WebView>
</RelativeLayout>
--styles.xml--------------------------------------------------------------------------------------
<resources>
<!--
Base application theme, dependent on API level. This theme is
replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular
API-level can go here. -->
</style>
<style name="AppTheme.Transparent" parent="AppTheme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
</resources>
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings