This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree 3 files changed +12
-8
lines changed
shell/platform/android/io/flutter/plugin/platform
testing/scenario_app/android/app/src/main/java/dev/flutter/scenarios 3 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -16,9 +16,8 @@ public interface PlatformView {
16
16
View getView ();
17
17
18
18
/**
19
- * Called by the {@link io.flutter.embedding.engine.FlutterEngine} that owns this {@code
20
- * PlatformView} when the Android {@link View} responsible for rendering a Flutter UI is
21
- * associated with the {@link io.flutter.embedding.engine.FlutterEngine}.
19
+ * Called when the {@link View} responsible for rendering a Flutter UI has been attached to a
20
+ * {@link io.flutter.embedding.engine.FlutterEngine}.
22
21
*
23
22
* <p>This means that our associated {@link io.flutter.embedding.engine.FlutterEngine} can now
24
23
* render a UI and interact with the user.
@@ -34,9 +33,8 @@ public interface PlatformView {
34
33
default void onFlutterViewAttached (@ NonNull View flutterView ) {}
35
34
36
35
/**
37
- * Called by the {@link io.flutter.embedding.engine.FlutterEngine} that owns this {@code
38
- * PlatformView} when the Android {@link View} responsible for rendering a Flutter UI is detached
39
- * and disassociated from the {@link io.flutter.embedding.engine.FlutterEngine}.
36
+ * Called when the {@link View} responsible for rendering a Flutter UI has been detached from the
37
+ * {@link io.flutter.embedding.engine.FlutterEngine}.
40
38
*
41
39
* <p>This means that our associated {@link io.flutter.embedding.engine.FlutterEngine} no longer
42
40
* has a rendering surface, or a user interaction surface of any kind.
Original file line number Diff line number Diff line change @@ -255,6 +255,7 @@ public long createForTextureLayer(
255
255
});
256
256
flutterView .addView (wrapperView );
257
257
viewWrappers .append (viewId , wrapperView );
258
+ platformView .onFlutterViewAttached (flutterView );
258
259
return txId ;
259
260
}
260
261
@@ -794,6 +795,7 @@ void initializePlatformViewIfNeeded(int viewId) {
794
795
795
796
parentView .addView (embeddedView );
796
797
flutterView .addView (parentView );
798
+ platformView .onFlutterViewAttached (flutterView );
797
799
}
798
800
799
801
public void attachToFlutterRenderer (@ NonNull FlutterRenderer flutterRenderer ) {
Original file line number Diff line number Diff line change @@ -22,16 +22,20 @@ public class TextPlatformView implements PlatformView {
22
22
textView .setTextSize (72 );
23
23
textView .setBackgroundColor (Color .rgb (255 , 255 , 255 ));
24
24
textView .setText (params );
25
+ }
25
26
27
+ @ Override
28
+ public void onFlutterViewAttached (@ NonNull View flutterView ) {
26
29
// Investigate why this is needed to make some gold tests pass.
27
30
Choreographer .getInstance ()
28
- .postFrameCallback (
31
+ .postFrameCallbackDelayed (
29
32
new Choreographer .FrameCallback () {
30
33
@ Override
31
34
public void doFrame (long frameTimeNanos ) {
32
35
textView .invalidate ();
33
36
}
34
- });
37
+ },
38
+ 500 );
35
39
}
36
40
37
41
@ Override
You can’t perform that action at this time.
0 commit comments