Skip to content

Commit

Permalink
Fixed web browser full screen.
Browse files Browse the repository at this point in the history
Fixes #321
  • Loading branch information
AndreyPavlenko committed Jan 10, 2024
1 parent aac96b6 commit f929ade
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ public boolean onJsBeforeUnload(WebView view, String url, String message, JsResu

@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
if (view instanceof ViewGroup) {
ViewGroup g = (ViewGroup) view;
if (view instanceof ViewGroup g) {
View focus = g.getFocusedChild();

if (focus != null) {
Expand All @@ -117,7 +116,6 @@ public void onShowCustomView(View view, CustomViewCallback callback) {
customView = view;
customViewCallback = callback;
addCustomView(view);
getWebView().setVisibility(GONE);
MainActivityDelegate a = MainActivityDelegate.get(view.getContext());
setFullScreen(a, true);

Expand Down Expand Up @@ -263,15 +261,13 @@ public void onPermissionRequest(PermissionRequest request) {

for (String p : resources) {
switch (p) {
case PermissionRequest.RESOURCE_AUDIO_CAPTURE:
perms.put(Manifest.permission.RECORD_AUDIO, p);
break;
case PermissionRequest.RESOURCE_VIDEO_CAPTURE:
perms.put(Manifest.permission.CAMERA, p);
break;
case PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID:
case PermissionRequest.RESOURCE_AUDIO_CAPTURE ->
perms.put(Manifest.permission.RECORD_AUDIO, p);
case PermissionRequest.RESOURCE_VIDEO_CAPTURE -> perms.put(Manifest.permission.CAMERA, p);
case PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID -> {
request.grant(resources);
return;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ protected void setFullScreen(MainActivityDelegate a, boolean fullScreen) {
a.setVideoMode(fullScreen, getFullScreenView());
}

@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
getWebView().setVisibility(GONE);
super.onShowCustomView(view, callback);
}

@Override
public boolean canEnterFullScreen() {
MainActivityDelegate a = MainActivityDelegate.get(getWebView().getContext());
Expand Down

0 comments on commit f929ade

Please sign in to comment.