Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
flutter_boost_1.22.4
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢冠章
flutter_boost_1.22.4
Commits
a376eb19
Commit
a376eb19
authored
Nov 13, 2019
by
yangwu.jia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pluginsRegister modify
parent
dd5de6ac
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
35 deletions
+50
-35
android/src/main/java/com/idlefish/flutterboost/FlutterBoost.java
...src/main/java/com/idlefish/flutterboost/FlutterBoost.java
+16
-19
android/src/main/java/com/idlefish/flutterboost/Platform.java
...oid/src/main/java/com/idlefish/flutterboost/Platform.java
+21
-0
android/src/main/java/com/idlefish/flutterboost/interfaces/IPluginsRegister.java
...om/idlefish/flutterboost/interfaces/IPluginsRegister.java
+4
-0
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/MyApplication.java
...om/taobao/idlefish/flutterboostexample/MyApplication.java
+9
-16
No files found.
android/src/main/java/com/idlefish/flutterboost/FlutterBoost.java
View file @
a376eb19
...
...
@@ -150,7 +150,7 @@ public class FlutterBoost {
flutterEngine
.
getDartExecutor
().
executeDartEntrypoint
(
entrypoint
);
mRegistry
=
new
BoostPluginRegistry
(
createEngine
());
registerPlugins
(
);
mPlatform
.
registerPlugins
(
mRegistry
);
}
...
...
@@ -185,6 +185,10 @@ public class FlutterBoost {
private
BoostLifecycleListener
lifecycleListener
;
private
BoostPluginsRegister
boostPluginsRegister
;
public
ConfigBuilder
(
Application
app
,
INativeRouter
router
)
{
this
.
router
=
router
;
this
.
mApp
=
app
;
...
...
@@ -224,7 +228,10 @@ public class FlutterBoost {
this
.
lifecycleListener
=
lifecycleListener
;
return
this
;
}
public
ConfigBuilder
pluginsRegister
(
BoostPluginsRegister
boostPluginsRegister
)
{
this
.
boostPluginsRegister
=
boostPluginsRegister
;
return
this
;
}
public
Platform
build
()
{
Platform
platform
=
new
Platform
()
{
...
...
@@ -263,7 +270,7 @@ public class FlutterBoost {
};
platform
.
lifecycleListener
=
this
.
lifecycleListener
;
platform
.
pluginsRegister
=
this
.
boostPluginsRegister
;
return
platform
;
}
...
...
@@ -309,22 +316,6 @@ public class FlutterBoost {
}
private
void
registerPlugins
()
{
try
{
Class
clz
=
Class
.
forName
(
"io.flutter.plugins.GeneratedPluginRegistrant"
);
Method
method
=
clz
.
getDeclaredMethod
(
"registerWith"
,
PluginRegistry
.
class
);
method
.
invoke
(
null
,
mRegistry
);
}
catch
(
Throwable
t
)
{
throw
new
RuntimeException
(
t
);
}
if
(
mPlatform
.
lifecycleListener
!=
null
)
{
mPlatform
.
lifecycleListener
.
onPluginsRegistered
();
}
}
public
FlutterEngine
engineProvider
()
{
return
mEngine
;
}
...
...
@@ -351,4 +342,10 @@ public class FlutterBoost {
void
onEngineDestroy
();
}
public
interface
BoostPluginsRegister
{
void
registerPlugins
(
PluginRegistry
mRegistry
);
}
}
android/src/main/java/com/idlefish/flutterboost/Platform.java
View file @
a376eb19
...
...
@@ -4,9 +4,11 @@ import android.app.Application;
import
android.content.Context
;
import
com.idlefish.flutterboost.interfaces.IContainerRecord
;
import
java.lang.reflect.Method
;
import
java.util.Map
;
import
io.flutter.embedding.android.FlutterView
;
import
io.flutter.plugin.common.PluginRegistry
;
public
abstract
class
Platform
{
...
...
@@ -26,6 +28,8 @@ public abstract class Platform {
public
FlutterBoost
.
BoostLifecycleListener
lifecycleListener
;
public
FlutterBoost
.
BoostPluginsRegister
pluginsRegister
;
public
void
closeContainer
(
IContainerRecord
record
,
Map
<
String
,
Object
>
result
,
Map
<
String
,
Object
>
exts
)
{
if
(
record
==
null
)
return
;
...
...
@@ -33,4 +37,21 @@ public abstract class Platform {
}
public
void
registerPlugins
(
PluginRegistry
mRegistry
)
{
try
{
Class
clz
=
Class
.
forName
(
"io.flutter.plugins.GeneratedPluginRegistrant"
);
Method
method
=
clz
.
getDeclaredMethod
(
"registerWith"
,
PluginRegistry
.
class
);
method
.
invoke
(
null
,
mRegistry
);
}
catch
(
Throwable
t
)
{
throw
new
RuntimeException
(
t
);
}
if
(
pluginsRegister
!=
null
){
pluginsRegister
.
registerPlugins
(
mRegistry
);
}
if
(
lifecycleListener
!=
null
)
{
lifecycleListener
.
onPluginsRegistered
();
}
}
}
android/src/main/java/com/idlefish/flutterboost/interfaces/IPluginsRegister.java
0 → 100644
View file @
a376eb19
package
com.idlefish.flutterboost.interfaces
;
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/MyApplication.java
View file @
a376eb19
...
...
@@ -11,6 +11,8 @@ import java.util.Map;
import
com.idlefish.flutterboost.interfaces.INativeRouter
;
import
io.flutter.embedding.android.FlutterView
;
import
io.flutter.plugin.common.MethodChannel
;
import
io.flutter.plugin.common.PluginRegistry
;
import
io.flutter.plugins.GeneratedPluginRegistrant
;
public
class
MyApplication
extends
Application
{
...
...
@@ -18,6 +20,7 @@ public class MyApplication extends Application {
@Override
public
void
onCreate
()
{
super
.
onCreate
();
INativeRouter
router
=
new
INativeRouter
()
{
@Override
public
void
openContainer
(
Context
context
,
String
url
,
Map
<
String
,
Object
>
urlParams
,
int
requestCode
,
Map
<
String
,
Object
>
exts
)
{
...
...
@@ -27,31 +30,21 @@ public class MyApplication extends Application {
};
FlutterBoost
.
BoostLifecycleListener
lifecycleListener
=
new
FlutterBoost
.
BoostLifecycleListener
()
{
@Override
public
void
onEngineCreated
()
{
}
@Override
public
void
onPluginsRegistered
()
{
MethodChannel
mMethodChannel
=
new
MethodChannel
(
FlutterBoost
.
instance
().
engineProvider
().
getDartExecutor
(),
"methodChannel"
);
Log
.
e
(
"MyApplication"
,
"MethodChannel create"
);
TextPlatformViewPlugin
.
register
(
FlutterBoost
.
instance
().
getPluginRegistry
().
registrarFor
(
"TextPlatformViewPlugin"
));
}
FlutterBoost
.
BoostPluginsRegister
pluginsRegister
=
new
FlutterBoost
.
BoostPluginsRegister
(){
@Override
public
void
onEngineDestroy
()
{
public
void
registerPlugins
(
PluginRegistry
mRegistry
)
{
GeneratedPluginRegistrant
.
registerWith
(
mRegistry
);
TextPlatformViewPlugin
.
register
(
mRegistry
.
registrarFor
(
"TextPlatformViewPlugin"
));
}
};
Platform
platform
=
new
FlutterBoost
.
ConfigBuilder
(
this
,
router
)
.
isDebug
(
true
)
.
whenEngineStart
(
FlutterBoost
.
ConfigBuilder
.
ANY_ACTIVITY_CREATED
)
.
renderMode
(
FlutterView
.
RenderMode
.
texture
)
.
lifecycleListener
(
lifecycleListen
er
)
.
pluginsRegister
(
pluginsRegist
er
)
.
build
();
FlutterBoost
.
instance
().
init
(
platform
);
...
...
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