Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
PlatformViewsActivity.java
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5package dev.flutter.scenarios;
6
7import androidx.annotation.NonNull;
8import io.flutter.embedding.engine.FlutterEngine;
9
10public class PlatformViewsActivity extends TestActivity {
11 // WARNING: These strings must all be exactly the same length to avoid
12 // breaking the 'create' method's manual encoding in the test. See the
13 // TODO(stuartmorgan) about encoding alignment in platform_view.dart
14 public static final String TEXT_VIEW_PV = "scenarios/textPlatformView";
15 public static final String SURFACE_VIEW_PV = "scenarios/surfacePlatformV";
16 public static final String SURFACE_VIEW_BAD_CONTEXT_PV = "scenarios/surfaceVBadCntxt";
17 public static final String TEXTURE_VIEW_PV = "scenarios/texturePlatformV";
18
19 @Override
20 public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
21 super.configureFlutterEngine(flutterEngine);
22 flutterEngine
23 .getPlatformViewsController()
24 .getRegistry()
25 .registerViewFactory(TEXT_VIEW_PV, new TextPlatformViewFactory());
26
27 flutterEngine
28 .getPlatformViewsController()
29 .getRegistry()
30 .registerViewFactory(SURFACE_VIEW_PV, new SurfacePlatformViewFactory(true));
31
32 flutterEngine
33 .getPlatformViewsController()
34 .getRegistry()
35 .registerViewFactory(SURFACE_VIEW_BAD_CONTEXT_PV, new SurfacePlatformViewFactory(false));
36
37 flutterEngine
38 .getPlatformViewsController()
39 .getRegistry()
40 .registerViewFactory(TEXTURE_VIEW_PV, new TexturePlatformViewFactory());
41 }
42}
void configureFlutterEngine(@NonNull FlutterEngine flutterEngine)