下面列出了怎么用android.webkit.WebChromeClient.CustomViewCallback的API类实例代码及写法,或者点击链接到github查看源代码。
public void onShowCustomView(View view, CustomViewCallback callback)
{
if (myCallback != null)
{
myCallback.onCustomViewHidden();
myCallback = null;
return;
}
long id = Thread.currentThread().getId();
Log.I("WidgetChromeClient", "rong debug in showCustomView Ex: " + id);
ViewGroup parent = (ViewGroup) mWebView.getParent();
String s = parent.getClass().getName();
Log.I("WidgetChromeClient", "rong debug Ex: " + s);
parent.removeView(mWebView);
parent.addView(view);
myView = view;
myCallback = callback;
// chromeClient = this ;
}
@Override
public void onShowCustomView(View view, int requestedOrientation, CustomViewCallback callback) {
if (view == null) {
return;
}
if (mCustomView != null && callback != null) {
callback.onCustomViewHidden();
return;
}
try {
view.setKeepScreenOn(true);
} catch (SecurityException e) {
Log.e(Constants.TAG, "WebView is not allowed to keep the screen on");
}
mOriginalOrientation = getRequestedOrientation();
FrameLayout decor = (FrameLayout) getWindow().getDecorView();
mFullscreenContainer = new FullscreenHolder(this);
mCustomView = view;
mFullscreenContainer.addView(mCustomView, COVER_SCREEN_PARAMS);
decor.addView(mFullscreenContainer, COVER_SCREEN_PARAMS);
setFullscreen(true);
getCurrentWebView().setVisibility(View.GONE);
if (view instanceof FrameLayout) {
if (((FrameLayout) view).getFocusedChild() instanceof VideoView) {
mVideoView = (VideoView) ((FrameLayout) view).getFocusedChild();
mVideoView.setOnErrorListener(new VideoCompletionListener());
mVideoView.setOnCompletionListener(new VideoCompletionListener());
}
}
mCustomViewCallback = callback;
}
@Override
public synchronized void onShowCustomView(View view, CustomViewCallback callback) {
int requestedOrientation = mOriginalOrientation = getRequestedOrientation();
onShowCustomView(view, callback, requestedOrientation);
}
@Override
public void onShowCustomView(View view, CustomViewCallback callback)
{
this.mWebViewActivity.onShowCustomView(view, callback);
}
@Override
public synchronized void onShowCustomView(View view, CustomViewCallback callback) {
int requestedOrientation = mOriginalOrientation = getRequestedOrientation();
onShowCustomView(view, callback, requestedOrientation);
}
/**
* Deprecated in 4.0.0. Use your own View-toggling logic.
*/
@Deprecated
void showCustomView(View view, CustomViewCallback callback);
/**
* Deprecated in 4.0.0. Use your own View-toggling logic.
*/
@Deprecated
void showCustomView(View view, CustomViewCallback callback);
/**
* Deprecated in 4.0.0. Use your own View-toggling logic.
*/
@Deprecated
void showCustomView(View view, CustomViewCallback callback);
/**
* Deprecated in 4.0.0. Use your own View-toggling logic.
*/
@Deprecated
void showCustomView(View view, CustomViewCallback callback);
/**
* Deprecated in 4.0.0. Use your own View-toggling logic.
*/
@Deprecated
void showCustomView(View view, CustomViewCallback callback);
/**
* Deprecated in 4.0.0. Use your own View-toggling logic.
*/
@Deprecated
void showCustomView(View view, CustomViewCallback callback);
/**
* Deprecated in 4.0.0. Use your own View-toggling logic.
*/
@Deprecated
void showCustomView(View view, CustomViewCallback callback);
/**
* Deprecated in 4.0.0. Use your own View-toggling logic.
*/
@Deprecated
void showCustomView(View view, CustomViewCallback callback);
/**
* Deprecated in 4.0.0. Use your own View-toggling logic.
*/
@Deprecated
void showCustomView(View view, CustomViewCallback callback);
/**
* Deprecated in 4.0.0. Use your own View-toggling logic.
*/
@Deprecated
void showCustomView(View view, CustomViewCallback callback);
/**
* Deprecated in 4.0.0. Use your own View-toggling logic.
*/
@Deprecated
void showCustomView(View view, CustomViewCallback callback);
/**
* Deprecated in 4.0.0. Use your own View-toggling logic.
*/
@Deprecated
void showCustomView(View view, CustomViewCallback callback);
/**
* Deprecated in 4.0.0. Use your own View-toggling logic.
*/
@Deprecated
void showCustomView(View view, CustomViewCallback callback);
void onShowCustomView(View view, int requestedOrientation, CustomViewCallback callback);
void onShowCustomView(View view, CustomViewCallback callback);
void onShowCustomView(View view, CustomViewCallback callback, int requestedOrienation);