Skip to content

Commit

Permalink
Merge pull request #510 from fluttercommunity/revert-503-mschneider/f…
Browse files Browse the repository at this point in the history
…ullscreen_video

Revert "Allow video players in Android WebView to maximize from Widget mode"
  • Loading branch information
charafau authored Aug 15, 2019
2 parents 2f9b2cd + f7f110e commit 70ca06c
Showing 1 changed file with 0 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,60 +244,9 @@ public void onProgressChanged(WebView view, int progress) {
FlutterWebviewPlugin.channel.invokeMethod("onProgressChanged", args);
}

// Allow switching to fullscreen e.g when playing a video

private View customView;
private CustomViewCallback customViewCallback;

@Override
public void onShowCustomView(View view, int requestedOrientation, CustomViewCallback callback) {
onShowCustomView(view, callback);
}

@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
// if a view already exists then immediately terminate the new one
if (customView != null) {
callback.onCustomViewHidden();
return;
}

// add custom view to container and save reference
customView = view;
customViewCallback = callback;

FrameLayout rootView = (FrameLayout)webView.getRootView();
rootView.addView(customView);

// hide webview and show custom view
customView.setVisibility(View.VISIBLE);
FrameLayout contentView = (FrameLayout)rootView.findViewById(android.R.id.content);
contentView.setVisibility(View.GONE);
}

@Override
public void onHideCustomView() {
super.onHideCustomView();
if (customView == null)
return;

// Hide the custom view and show Webview
FrameLayout rootView = (FrameLayout)webView.getRootView();
FrameLayout contentView = (FrameLayout)rootView.findViewById(android.R.id.content);
contentView.setVisibility(View.VISIBLE);
customView.setVisibility(View.GONE);

// Remove the custom view from its container and clear reference
rootView.removeView(customView);
customViewCallback.onCustomViewHidden();
customView = null;
}

public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
callback.invoke(origin, true, false);

}

});
}

Expand Down

0 comments on commit 70ca06c

Please sign in to comment.