diff options
author | sungmann.cho@navercorp.com <sungmann.cho@navercorp.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-03 15:09:35 +0000 |
---|---|---|
committer | sungmann.cho@navercorp.com <sungmann.cho@navercorp.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-03 15:09:35 +0000 |
commit | b4b1d7648e839c135522e4daccb15a726f7ec9c6 (patch) | |
tree | 6074970c0bcc35f82fde57a7e95fe15c9d214376 /android_webview/test | |
parent | 30568e8cb6b59262f29d2493a30d5cce5c048923 (diff) | |
download | chromium_src-b4b1d7648e839c135522e4daccb15a726f7ec9c6.zip chromium_src-b4b1d7648e839c135522e4daccb15a726f7ec9c6.tar.gz chromium_src-b4b1d7648e839c135522e4daccb15a726f7ec9c6.tar.bz2 |
Fix a problem that video does not show up in AW Shell.
AW Shell shows a white screen when we play a video. It only plays sound.
This patch implements onShowCustomView() and onHideCustomView() of AwContentsClient to fix it up.
Review URL: https://codereview.chromium.org/223253005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261402 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/test')
-rw-r--r-- | android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java index b2f79e3..4f10e79 100644 --- a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java +++ b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java @@ -10,14 +10,19 @@ import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.text.TextUtils; +import android.view.Gravity; import android.view.KeyEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnFocusChangeListener; +import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; +import android.view.WindowManager; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; +import android.webkit.WebChromeClient; import android.widget.EditText; +import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.TextView; @@ -76,12 +81,36 @@ public class AwShellActivity extends Activity { AwBrowserProcess.start(this); AwTestContainerView testContainerView = new AwTestContainerView(this); AwContentsClient awContentsClient = new NullContentsClient() { + private View mCustomView; + @Override public void onPageStarted(String url) { if (mUrlTextView != null) { mUrlTextView.setText(url); } } + + @Override + public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) { + getWindow().setFlags( + WindowManager.LayoutParams.FLAG_FULLSCREEN, + WindowManager.LayoutParams.FLAG_FULLSCREEN); + + getWindow().addContentView(view, + new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT, + Gravity.CENTER)); + mCustomView = view; + } + + @Override + public void onHideCustomView() { + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); + FrameLayout decorView = (FrameLayout) getWindow().getDecorView(); + decorView.removeView(mCustomView); + mCustomView = null; + } }; SharedPreferences sharedPreferences = |