-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[webview_flutter_android] Added the functionality to fullscreen html5 video #3879
Merged
auto-submit
merged 64 commits into
flutter:main
from
paulppn:feature/add_fullscreen_video
Sep 8, 2023
Merged
Changes from 59 commits
Commits
Show all changes
64 commits
Select commit
Hold shift + click to select a range
1bbd61f
Added fullscreen capabilities to the android webview
paulppn 279a678
Fixed the formatting
paulppn 6649aa8
Fixed some more formatting + added a nonnull
paulppn fbc3f57
Removed empty line
paulppn 06935c9
Adjusted another nonnull
paulppn ff9137f
Fixed two lint warnings
paulppn bef6c2a
customviewcallback dart impl
bparrishMines 0cd62d0
view dart impl
bparrishMines 6ca452a
Merge branch 'main' of github.com:flutter/packages into feature/add_f…
bparrishMines ba03b6b
formatting
bparrishMines 9f0dbe1
dart side of webchromeclient wrap
bparrishMines e9295b2
implement java side
bparrishMines d547039
fix java side
bparrishMines 59a0da4
formatting
bparrishMines f3693b8
fix pubspec
bparrishMines 47c7d98
Merge branch 'main' of github.com:flutter/packages into feature/add_f…
bparrishMines 8151750
remove unneeded lines
bparrishMines 759f19b
remove unneeded mocks
bparrishMines bdb0806
fix lint
bparrishMines 47e3108
Merge remote-tracking branch 'origin/main' into feature/add_fullscree…
mvanbeusekom 5ea042d
Adds Dart implementation fullscreen video
mvanbeusekom 216757e
Adds Android fullscreen functionality
mvanbeusekom 4ff9e75
Merge branch 'main' into feature/add_fullscreen_video
mvanbeusekom 76c02cc
Merge remote-tracking branch 'origin/main' into feature/add_fullscree…
mvanbeusekom b899cb0
Merge branch 'feature/add_fullscreen_video' of github.com:paulppn/flu…
mvanbeusekom 24bc43e
Merge remote-tracking branch 'origin/main' into feature/add_fullscree…
mvanbeusekom afe0b8f
Apply review feedback
mvanbeusekom e9d418a
Merge branch 'main' into feature/add_fullscreen_video
mvanbeusekom e347a49
Merge branch 'main' into feature/add_fullscreen_video
mvanbeusekom ab876f2
Applied PR feedback
mvanbeusekom 9323791
Merge branch 'feature/add_fullscreen_video' of github.com:paulppn/flu…
mvanbeusekom 4cb8746
Merge branch 'main' into feature/add_fullscreen_video
mvanbeusekom 8baca49
Merge branch 'main' into feature/add_fullscreen_video
mvanbeusekom f385bcc
Merge branch 'main' into feature/add_fullscreen_video
mvanbeusekom 178c5e7
Merge branch 'main' into feature/add_fullscreen_video
mvanbeusekom 37edbf1
Merge remote-tracking branch 'upstream/main' into feature/add_fullscr…
mvanbeusekom 7219770
Merge branch 'feature/add_fullscreen_video' of github.com:paulppn/flu…
mvanbeusekom c612ef5
Adds integration test to validate fullscreen
mvanbeusekom 9d06cae
Merge branch 'main' into feature/add_fullscreen_video
mvanbeusekom 041441d
Ensure the CustomViewHostApi is setup correctly
mvanbeusekom d4359d5
Merge branch 'feature/add_fullscreen_video' of github.com:paulppn/flu…
mvanbeusekom 5169000
Merge branch 'main' into feature/add_fullscreen_video
mvanbeusekom 87443f5
Merge remote-tracking branch 'upstream/main' into feature/add_fullscr…
mvanbeusekom 1f1ee82
Merge branch 'main' of https://github.com/flutter/packages into featu…
mvanbeusekom 5ef97bc
Remove obsolete file
mvanbeusekom ba39519
Merge branch 'main' into feature/add_fullscreen_video
mvanbeusekom 269ad02
Merge branch 'feature/add_fullscreen_video' of github.com:paulppn/flu…
mvanbeusekom 6347f98
Fixed analysis warning
mvanbeusekom b319604
Formatted JAVA files
mvanbeusekom aa35251
Merge remote-tracking branch 'upstream/main' into feature/add_fullscr…
mvanbeusekom d9f9812
Merge branch 'main' of https://github.com/flutter/packages into featu…
mvanbeusekom 3e39dd2
Explain the tapAt statement in integration test
mvanbeusekom 3e74540
Update packages/webview_flutter/webview_flutter_android/example/integ…
bparrishMines 289cccd
update dartdocs and changelog
bparrishMines 1e63109
Merge branch 'main' of github.com:flutter/packages into feature/add_f…
bparrishMines 5d45ea0
provide example for fullscreen
bparrishMines 6ca8d15
require callbacks
bparrishMines 0b7361a
formatting
bparrishMines cdcff55
Merge branch 'main' of github.com:flutter/packages into feature/add_f…
bparrishMines 45720e4
add a default handler
bparrishMines 67d660d
Merge branch 'main' of github.com:flutter/packages into feature/add_f…
bparrishMines acfd11d
add integration test
bparrishMines 7744529
switch to unit test
bparrishMines 1a65e0f
Merge branch 'main' of github.com:flutter/packages into feature/add_f…
bparrishMines File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...oid/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackFlutterApiImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package io.flutter.plugins.webviewflutter; | ||
|
||
import android.webkit.WebChromeClient.CustomViewCallback; | ||
import androidx.annotation.NonNull; | ||
import androidx.annotation.VisibleForTesting; | ||
import io.flutter.plugin.common.BinaryMessenger; | ||
import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CustomViewCallbackFlutterApi; | ||
|
||
/** | ||
* Flutter API implementation for `CustomViewCallback`. | ||
* | ||
* <p>This class may handle adding native instances that are attached to a Dart instance or passing | ||
* arguments of callbacks methods to a Dart instance. | ||
*/ | ||
public class CustomViewCallbackFlutterApiImpl { | ||
// To ease adding additional methods, this value is added prematurely. | ||
@SuppressWarnings({"unused", "FieldCanBeLocal"}) | ||
private final BinaryMessenger binaryMessenger; | ||
|
||
private final InstanceManager instanceManager; | ||
private CustomViewCallbackFlutterApi api; | ||
|
||
/** | ||
* Constructs a {@link CustomViewCallbackFlutterApiImpl}. | ||
* | ||
* @param binaryMessenger used to communicate with Dart over asynchronous messages | ||
* @param instanceManager maintains instances stored to communicate with attached Dart objects | ||
*/ | ||
public CustomViewCallbackFlutterApiImpl( | ||
@NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { | ||
this.binaryMessenger = binaryMessenger; | ||
this.instanceManager = instanceManager; | ||
api = new CustomViewCallbackFlutterApi(binaryMessenger); | ||
} | ||
|
||
/** | ||
* Stores the `CustomViewCallback` instance and notifies Dart to create and store a new | ||
* `CustomViewCallback` instance that is attached to this one. If `instance` has already been | ||
* added, this method does nothing. | ||
*/ | ||
public void create( | ||
@NonNull CustomViewCallback instance, | ||
@NonNull CustomViewCallbackFlutterApi.Reply<Void> callback) { | ||
if (!instanceManager.containsInstance(instance)) { | ||
api.create(instanceManager.addHostCreatedInstance(instance), callback); | ||
} | ||
} | ||
|
||
/** | ||
* Sets the Flutter API used to send messages to Dart. | ||
* | ||
* <p>This is only visible for testing. | ||
*/ | ||
@VisibleForTesting | ||
void setApi(@NonNull CustomViewCallbackFlutterApi api) { | ||
this.api = api; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...ndroid/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackHostApiImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package io.flutter.plugins.webviewflutter; | ||
|
||
import android.webkit.WebChromeClient.CustomViewCallback; | ||
import androidx.annotation.NonNull; | ||
import io.flutter.plugin.common.BinaryMessenger; | ||
import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CustomViewCallbackHostApi; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Host API implementation for `CustomViewCallback`. | ||
* | ||
* <p>This class may handle instantiating and adding native object instances that are attached to a | ||
* Dart instance or handle method calls on the associated native class or an instance of the class. | ||
*/ | ||
public class CustomViewCallbackHostApiImpl implements CustomViewCallbackHostApi { | ||
// To ease adding additional methods, this value is added prematurely. | ||
@SuppressWarnings({"unused", "FieldCanBeLocal"}) | ||
private final BinaryMessenger binaryMessenger; | ||
|
||
private final InstanceManager instanceManager; | ||
|
||
/** | ||
* Constructs a {@link CustomViewCallbackHostApiImpl}. | ||
* | ||
* @param binaryMessenger used to communicate with Dart over asynchronous messages | ||
* @param instanceManager maintains instances stored to communicate with attached Dart objects | ||
*/ | ||
public CustomViewCallbackHostApiImpl( | ||
@NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { | ||
this.binaryMessenger = binaryMessenger; | ||
this.instanceManager = instanceManager; | ||
} | ||
|
||
@Override | ||
public void onCustomViewHidden(@NonNull Long identifier) { | ||
getCustomViewCallbackInstance(identifier).onCustomViewHidden(); | ||
} | ||
|
||
private CustomViewCallback getCustomViewCallbackInstance(@NonNull Long identifier) { | ||
return Objects.requireNonNull(instanceManager.getInstance(identifier)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't this correct before? This section seems to be Android-only as written.