You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/08/26 16:51:47 UTC

[GitHub] [cordova-plugin-inappbrowser] NotThatGregGuy opened a new issue #770: Update pages opened by InAppBrowser to allow for full screen elements

NotThatGregGuy opened a new issue #770:
URL: https://github.com/apache/cordova-plugin-inappbrowser/issues/770


   # Feature Request
   
   ## Motivation Behind Feature
   Currently, a web pages opened via the InAppBrowser has document.fullscreenEnabled always set to false which means a user cannot view an item in a full screen mode (e.g. video, map, image, etc.).
   
   
   
   ## Feature Description
   For Android:
   The web view client should be updated to set the onShowCustomView and onHideCustomView methods so the document.fullscreenEnabled flag is set to true
   
   For ios:
   This feature looks to be disabled/not supported on the mobile safari browser (WKWebView engine), but I could be mistaken.
   On the normal safari browser it sets the document.webkitFullscreenEnabled to true
   
   
   
   
   ## Alternatives or Workarounds
   For Android:
   To have the opened web pages allow full screen elements the web view client must have the onShowCustomView and onHideCustomView methods.
   
   Adding the following/something similar (with the dependent imports) to the initialized InAppChromeClient in InAppBorwser showWebPage runnable's run method (where you are declaring the onShowFileChooser/openFileChooser methods)
   (code taken from the cordova engine's SystemWebCromeClient and modified to work)
   ````
   private View mCustomView;
   private WebChromeClient.CustomViewCallback mCustomViewCallback;
   
   public void onShowCustomView(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(LOG_TAG, "showing Custom InAppBrowser 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) inAppWebView.getParent();
   	parent.addView(view, new FrameLayout.LayoutParams(
   			WindowManager.LayoutParams.MATCH_PARENT,
   			WindowManager.LayoutParams.MATCH_PARENT,
   			Gravity.CENTER));
   
   	// Hide the content view.
   	inAppWebView.setVisibility(View.GONE);
   
   	// Finally show the custom view container.
   	parent.setVisibility(View.VISIBLE);
   	parent.bringToFront();
   }
   
   public void onHideCustomView() {
   	// This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0
   	if (mCustomView == null) return;
   	LOG.d(LOG_TAG, "Hiding Custom InAppBrowser View");
   
   	// Hide the custom view.
   	mCustomView.setVisibility(View.GONE);
   
   	// Remove the custom view from its container.
   	ViewGroup parent = (ViewGroup) inAppWebView.getParent();
   	parent.removeView(mCustomView);
   	mCustomView = null;
   	mCustomViewCallback.onCustomViewHidden();
   
   	// Show the content view.
   	inAppWebView.setVisibility(View.VISIBLE);
   }
   ````
   
   For ios:
   Good luck?
   
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org