예제 #1
0
  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();
  }
예제 #2
0
 @Override
 public void onHideCustomView() {
   if (mCustomView == null) return;
   setFullscreen(false);
   FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView();
   decor.removeView(mFullscreenContainer);
   mFullscreenContainer = null;
   mCustomView = null;
   mCustomViewCallback.onCustomViewHidden();
   // Show the content view.
   mActivity.setRequestedOrientation(mOriginalOrientation);
 }
예제 #3
0
    @Override
    public void onHideCustomView() {
      if (mCustomView != null) {
        getDisplayController().hideCustomView(mCustomView);
        mCustomViewCallback.onCustomViewHidden();
        mCustomView = null;
      }

      /*((Activity)getContext()).getWindow().clearFlags(
      	WindowManager.LayoutParams.FLAG_FULLSCREEN
      );*/
    }
예제 #4
0
  public void hideCustomView() {
    // This code is adapted from the original Android Browser code, licensed under the Apache
    // License, Version 2.0
    Log.d(TAG, "Hiding Custom View");
    if (mCustomView == null) return;

    // Hide the custom view.
    mCustomView.setVisibility(View.GONE);

    // Remove the custom view from its container.
    ViewGroup parent = (ViewGroup) this.getParent();
    parent.removeView(mCustomView);
    mCustomView = null;
    mCustomViewCallback.onCustomViewHidden();

    // Show the content view.
    this.setVisibility(View.VISIBLE);
  }
예제 #5
0
  @Override
  public void showCustomView(
      View view, int requestedOrientation, WebChromeClient.CustomViewCallback callback) {
    // if a view already exists then immediately terminate the new one
    if (mCustomView != null) {
      callback.onCustomViewHidden();
      return;
    }

    mOriginalOrientation = mActivity.getRequestedOrientation();
    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;
    mActivity.setRequestedOrientation(requestedOrientation);
  }