Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
158256b5
Unverified
Commit
158256b5
authored
Jul 13, 2020
by
Emmanuel Garcia
Committed by
GitHub
Jul 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate Android views e2e to the new embedding (#61205)
parent
eadc35f6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
16 deletions
+37
-16
AndroidManifest.xml
...ts/android_views/android/app/src/main/AndroidManifest.xml
+5
-0
MainActivity.java
...ava/io/flutter/integration/androidviews/MainActivity.java
+22
-7
SimplePlatformView.java
.../flutter/integration/androidviews/SimplePlatformView.java
+4
-2
SimpleViewFactory.java
...o/flutter/integration/androidviews/SimpleViewFactory.java
+5
-5
motion_event_diff.dart
...ntegration_tests/android_views/lib/motion_event_diff.dart
+1
-2
No files found.
dev/integration_tests/android_views/android/app/src/main/AndroidManifest.xml
View file @
158256b5
...
...
@@ -25,5 +25,10 @@ found in the LICENSE file. -->
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name=
"flutterEmbedding"
android:value=
"2"
/>
</application>
</manifest>
dev/integration_tests/android_views/android/app/src/main/java/io/flutter/integration/androidviews/MainActivity.java
View file @
158256b5
...
...
@@ -9,10 +9,14 @@ import android.content.pm.PackageManager;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.view.MotionEvent
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
java.util.HashMap
;
import
io.flutter.app.FlutterActivity
;
import
io.flutter.embedding.android.FlutterActivity
;
import
io.flutter.embedding.engine.dart.DartExecutor
;
import
io.flutter.embedding.engine.FlutterEngine
;
import
io.flutter.plugin.common.MethodCall
;
import
io.flutter.plugin.common.MethodChannel
;
import
io.flutter.plugins.GeneratedPluginRegistrant
;
...
...
@@ -27,18 +31,29 @@ public class MainActivity extends FlutterActivity implements MethodChannel.Metho
// This is null when not waiting for the Android permission request;
private
MethodChannel
.
Result
permissionResult
;
private
View
getFlutterView
()
{
// TODO(egarciad): Set an unique ID in FlutterView, so it's easier to look it up.
ViewGroup
root
=
(
ViewGroup
)
findViewById
(
android
.
R
.
id
.
content
);
return
((
ViewGroup
)
root
.
getChildAt
(
0
)).
getChildAt
(
0
);
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
GeneratedPluginRegistrant
.
registerWith
(
this
);
getFlutterView
().
getPluginRegistry
()
.
registrarFor
(
"io.flutter.integration.platform_views"
).
platformViewRegistry
()
.
registerViewFactory
(
"simple_view"
,
new
SimpleViewFactory
(
getFlutterView
()));
mMethodChannel
=
new
MethodChannel
(
this
.
getFlutterView
(),
"android_views_integration"
);
mMethodChannel
.
setMethodCallHandler
(
this
);
mFlutterViewTouchPipe
=
new
TouchPipe
(
mMethodChannel
,
getFlutterView
());
}
@Override
public
void
configureFlutterEngine
(
FlutterEngine
flutterEngine
)
{
DartExecutor
executor
=
flutterEngine
.
getDartExecutor
();
flutterEngine
.
getPlatformViewsController
()
.
getRegistry
()
.
registerViewFactory
(
"simple_view"
,
new
SimpleViewFactory
(
executor
));
mMethodChannel
=
new
MethodChannel
(
executor
,
"android_views_integration"
);
mMethodChannel
.
setMethodCallHandler
(
this
);
}
@Override
public
void
onMethodCall
(
MethodCall
methodCall
,
MethodChannel
.
Result
result
)
{
switch
(
methodCall
.
method
)
{
...
...
dev/integration_tests/android_views/android/app/src/main/java/io/flutter/integration/androidviews/SimplePlatformView.java
View file @
158256b5
...
...
@@ -20,19 +20,21 @@ import io.flutter.plugin.common.MethodChannel;
import
io.flutter.plugin.platform.PlatformView
;
public
class
SimplePlatformView
implements
PlatformView
,
MethodChannel
.
MethodCallHandler
{
private
final
View
view
;
private
final
Text
View
view
;
private
final
MethodChannel
methodChannel
;
private
final
io
.
flutter
.
integration
.
platformviews
.
TouchPipe
touchPipe
;
SimplePlatformView
(
Context
context
,
MethodChannel
methodChannel
)
{
this
.
methodChannel
=
methodChannel
;
view
=
new
View
(
context
)
{
view
=
new
Text
View
(
context
)
{
@Override
public
boolean
onTouchEvent
(
MotionEvent
event
)
{
return
true
;
}
};
view
.
setTextSize
(
72
);
view
.
setBackgroundColor
(
0xff0000ff
);
view
.
setText
(
"Hello from Android view"
);
this
.
methodChannel
.
setMethodCallHandler
(
this
);
touchPipe
=
new
io
.
flutter
.
integration
.
platformviews
.
TouchPipe
(
this
.
methodChannel
,
view
);
}
...
...
dev/integration_tests/android_views/android/app/src/main/java/io/flutter/integration/androidviews/SimpleViewFactory.java
View file @
158256b5
...
...
@@ -6,22 +6,22 @@ package io.flutter.integration.platformviews;
import
android.content.Context
;
import
io.flutter.
plugin.common.BinaryMessenge
r
;
import
io.flutter.
embedding.engine.dart.DartExecuto
r
;
import
io.flutter.plugin.common.MethodChannel
;
import
io.flutter.plugin.platform.PlatformView
;
import
io.flutter.plugin.platform.PlatformViewFactory
;
public
class
SimpleViewFactory
extends
PlatformViewFactory
{
final
BinaryMessenger
messenge
r
;
final
DartExecutor
executo
r
;
public
SimpleViewFactory
(
BinaryMessenger
messenge
r
)
{
public
SimpleViewFactory
(
DartExecutor
executo
r
)
{
super
(
null
);
this
.
messenger
=
messenge
r
;
this
.
executor
=
executo
r
;
}
@Override
public
PlatformView
create
(
Context
context
,
int
id
,
Object
params
)
{
MethodChannel
methodChannel
=
new
MethodChannel
(
messenge
r
,
"simple_view/"
+
id
);
MethodChannel
methodChannel
=
new
MethodChannel
(
executo
r
,
"simple_view/"
+
id
);
return
new
SimplePlatformView
(
context
,
methodChannel
);
}
}
dev/integration_tests/android_views/lib/motion_event_diff.dart
View file @
158256b5
...
...
@@ -3,7 +3,6 @@
// found in the LICENSE file.
import
'package:collection/collection.dart'
;
import
'package:flutter/foundation.dart'
;
// Android MotionEvent actions for which a pointer index is encoded in the
// unmasked action code.
...
...
@@ -14,7 +13,7 @@ const List<int> kPointerActions = <int>[
6
,
// POINTER_UP
];
const
double
kDoubleErrorMargin
=
precisionErrorTolerance
;
const
double
kDoubleErrorMargin
=
1
e
-
4
;
String
diffMotionEvents
(
Map
<
String
,
dynamic
>
originalEvent
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment