Java Code Examples for android.webkit.WebChromeClient#CustomViewCallback

The following examples show how to use android.webkit.WebChromeClient#CustomViewCallback . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CordovaWebView.java    From CordovaYoutubeVideoPlayer with MIT License 6 votes vote down vote up
public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0
    Log.d(TAG, "showing Custom View");
    // if a view already exists then immediately terminate the new one
    if (mCustomView != null) {
        callback.onCustomViewHidden();
        return;
    }
    
    // Store the view and its callback for later (to kill it properly)
    mCustomView = view;
    mCustomViewCallback = callback;
    
    // Add the custom view to its container.
    ViewGroup parent = (ViewGroup) this.getParent();
    parent.addView(view, COVER_SCREEN_GRAVITY_CENTER);
    
    // Hide the content view.
    this.setVisibility(View.GONE);
    
    // Finally show the custom view container.
    parent.setVisibility(View.VISIBLE);
    parent.bringToFront();
}
 
Example 2
Source File: CordovaWebView.java    From cordova-android-chromeview with Apache License 2.0 6 votes vote down vote up
public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0
    Log.d(TAG, "showing Custom View");
    // if a view already exists then immediately terminate the new one
    if (mCustomView != null) {
        callback.onCustomViewHidden();
        return;
    }
    
    // Store the view and its callback for later (to kill it properly)
    mCustomView = view;
    mCustomViewCallback = callback;
    
    // Add the custom view to its container.
    ViewGroup parent = (ViewGroup) this.getParent();
    parent.addView(view, COVER_SCREEN_GRAVITY_CENTER);
    
    // Hide the content view.
    this.setVisibility(View.GONE);
    
    // Finally show the custom view container.
    parent.setVisibility(View.VISIBLE);
    parent.bringToFront();
}
 
Example 3
Source File: CordovaWebView.java    From bluemix-parking-meter with MIT License 6 votes vote down vote up
public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0
    Log.d(TAG, "showing Custom View");
    // if a view already exists then immediately terminate the new one
    if (mCustomView != null) {
        callback.onCustomViewHidden();
        return;
    }
    
    // Store the view and its callback for later (to kill it properly)
    mCustomView = view;
    mCustomViewCallback = callback;
    
    // Add the custom view to its container.
    ViewGroup parent = (ViewGroup) this.getParent();
    parent.addView(view, COVER_SCREEN_GRAVITY_CENTER);
    
    // Hide the content view.
    this.setVisibility(View.GONE);
    
    // Finally show the custom view container.
    parent.setVisibility(View.VISIBLE);
    parent.bringToFront();
}
 
Example 4
Source File: WebVideoActivity.java    From fvip with Apache License 2.0 6 votes vote down vote up
/** 视频播放全屏 **/
private void showCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    // if a view already exists then immediately terminate the new one
    if (customView != null) {
        callback.onCustomViewHidden();
        return;
    }

    WebVideoActivity.this.getWindow().getDecorView();

    FrameLayout decor = (FrameLayout) getWindow().getDecorView();
    fullscreenContainer = new FullscreenHolder(WebVideoActivity.this);
    fullscreenContainer.addView(view, COVER_SCREEN_PARAMS);
    decor.addView(fullscreenContainer, COVER_SCREEN_PARAMS);
    customView = view;
    setStatusBarVisibility(false);
    customViewCallback = callback;
}
 
Example 5
Source File: CordovaWebView.java    From L.TileLayer.Cordova with MIT License 6 votes vote down vote up
public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0
    Log.d(TAG, "showing Custom View");
    // if a view already exists then immediately terminate the new one
    if (mCustomView != null) {
        callback.onCustomViewHidden();
        return;
    }
    
    // Store the view and its callback for later (to kill it properly)
    mCustomView = view;
    mCustomViewCallback = callback;
    
    // Add the custom view to its container.
    ViewGroup parent = (ViewGroup) this.getParent();
    parent.addView(view, COVER_SCREEN_GRAVITY_CENTER);
    
    // Hide the content view.
    this.setVisibility(View.GONE);
    
    // Finally show the custom view container.
    parent.setVisibility(View.VISIBLE);
    parent.bringToFront();
}
 
Example 6
Source File: CordovaWebView.java    From phonegap-plugin-loading-spinner with Apache License 2.0 6 votes vote down vote up
public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0
    Log.d(TAG, "showing Custom View");
    // if a view already exists then immediately terminate the new one
    if (mCustomView != null) {
        callback.onCustomViewHidden();
        return;
    }
    
    // Store the view and its callback for later (to kill it properly)
    mCustomView = view;
    mCustomViewCallback = callback;
    
    // Add the custom view to its container.
    ViewGroup parent = (ViewGroup) this.getParent();
    parent.addView(view, COVER_SCREEN_GRAVITY_CENTER);
    
    // Hide the content view.
    this.setVisibility(View.GONE);
    
    // Finally show the custom view container.
    parent.setVisibility(View.VISIBLE);
    parent.bringToFront();
}
 
Example 7
Source File: CordovaWebViewImpl.java    From ultimate-cordova-webview-app with MIT License 5 votes vote down vote up
@Override
@Deprecated
public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0
    LOG.d(TAG, "showing Custom View");
    // if a view already exists then immediately terminate the new one
    if (mCustomView != null) {
        callback.onCustomViewHidden();
        return;
    }

    // Store the view and its callback for later (to kill it properly)
    mCustomView = view;
    mCustomViewCallback = callback;

    // Add the custom view to its container.
    ViewGroup parent = (ViewGroup) engine.getView().getParent();
    parent.addView(view, new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT,
            Gravity.CENTER));

    // Hide the content view.
    engine.getView().setVisibility(View.GONE);

    // Finally show the custom view container.
    parent.setVisibility(View.VISIBLE);
    parent.bringToFront();
}
 
Example 8
Source File: CordovaWebViewImpl.java    From pychat with MIT License 5 votes vote down vote up
@Override
@Deprecated
public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0
    LOG.d(TAG, "showing Custom View");
    // if a view already exists then immediately terminate the new one
    if (mCustomView != null) {
        callback.onCustomViewHidden();
        return;
    }

    // Store the view and its callback for later (to kill it properly)
    mCustomView = view;
    mCustomViewCallback = callback;

    // Add the custom view to its container.
    ViewGroup parent = (ViewGroup) engine.getView().getParent();
    parent.addView(view, new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT,
            Gravity.CENTER));

    // Hide the content view.
    engine.getView().setVisibility(View.GONE);

    // Finally show the custom view container.
    parent.setVisibility(View.VISIBLE);
    parent.bringToFront();
}
 
Example 9
Source File: SystemWebChromeClient.java    From BigDataPlatform with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    parentEngine.getCordovaWebView().showCustomView(view, callback);
}
 
Example 10
Source File: AwContentsClient.java    From android-chromium with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    onShowCustomView(view, ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED, callback);
}
 
Example 11
Source File: HolderService.java    From Ninja with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onShowCustomView(View view, int requestedOrientation, WebChromeClient.CustomViewCallback callback) {
    return true;
}
 
Example 12
Source File: HolderService.java    From Ninja with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    return true;
}
 
Example 13
Source File: CordovaChromeClient.java    From phonegapbootcampsite with MIT License 4 votes vote down vote up
@Override
public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    this.appView.showCustomView(view, callback);
}
 
Example 14
Source File: BrowserActivity.java    From Ninja with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onShowCustomView(View view, int requestedOrientation, WebChromeClient.CustomViewCallback callback) {
    return onShowCustomView(view, callback);
}
 
Example 15
Source File: RobotiumWebClient.java    From AndroidRipper with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) {
	if (originalWebChromeClient != null) {
		originalWebChromeClient.onShowCustomView(view, callback);
	} 
}
 
Example 16
Source File: AwContentsClient.java    From android-chromium with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void onShowCustomView(View view,
       int requestedOrientation, WebChromeClient.CustomViewCallback callback) {
}
 
Example 17
Source File: BrowserController.java    From Ninja with Apache License 2.0 votes vote down vote up
boolean onShowCustomView(View view, WebChromeClient.CustomViewCallback callback); 
Example 18
Source File: OnWebChromeClientListener.java    From JsBridge with MIT License votes vote down vote up
void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback); 
Example 19
Source File: IVideo.java    From AgentWeb with Apache License 2.0 votes vote down vote up
void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback); 
Example 20
Source File: BrowserController.java    From Ninja with Apache License 2.0 votes vote down vote up
boolean onShowCustomView(View view, int requestedOrientation, WebChromeClient.CustomViewCallback callback);