Created
September 5, 2012 03:33
-
-
Save simpleton/3629917 to your computer and use it in GitHub Desktop.
html5 custom view
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class MyWebChromeClient extends WebChromeClient { | |
private Bitmap mDefaultVideoPoster; | |
private View mVideoProgressView; | |
@Override | |
public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) | |
{ | |
//Log.i(LOGTAG, "here in on ShowCustomView"); | |
HTML5WebView.this.setVisibility(View.GONE); | |
// if a view already exists then immediately terminate the new one | |
if (mCustomView != null) { | |
callback.onCustomViewHidden(); | |
return; | |
} | |
mCustomViewContainer.addView(view); | |
mCustomView = view; | |
mCustomViewCallback = callback; | |
mCustomViewContainer.setVisibility(View.VISIBLE); | |
} | |
@Override | |
public void onHideCustomView() { | |
if (mCustomView == null) | |
return; | |
// Hide the custom view. | |
mCustomView.setVisibility(View.GONE); | |
// Remove the custom view from its container. | |
mCustomViewContainer.removeView(mCustomView); | |
mCustomView = null; | |
mCustomViewContainer.setVisibility(View.GONE); | |
mCustomViewCallback.onCustomViewHidden(); | |
HTML5WebView.this.setVisibility(View.VISIBLE); | |
//Log.i(LOGTAG, "set it to webVew"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment