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
1
Merge Requests
1
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
8d103553
Commit
8d103553
authored
Jun 27, 2019
by
Yacumima
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve
parent
a84df93a
Changes
27
Show whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
165 additions
and
148 deletions
+165
-148
android/build.gradle
android/build.gradle
+1
-2
android/src/main/AndroidManifest.xml
android/src/main/AndroidManifest.xml
+1
-9
android/src/main/java/com/idlefish/flutterboost/BoostChannel.java
...src/main/java/com/idlefish/flutterboost/BoostChannel.java
+47
-4
android/src/main/java/com/idlefish/flutterboost/BoostEngineProvider.java
...n/java/com/idlefish/flutterboost/BoostEngineProvider.java
+5
-5
android/src/main/java/com/idlefish/flutterboost/BoostFlutterEngine.java
...in/java/com/idlefish/flutterboost/BoostFlutterEngine.java
+8
-8
android/src/main/java/com/idlefish/flutterboost/BoostFlutterView.java
...main/java/com/idlefish/flutterboost/BoostFlutterView.java
+6
-9
android/src/main/java/com/idlefish/flutterboost/ContainerRecord.java
.../main/java/com/idlefish/flutterboost/ContainerRecord.java
+6
-6
android/src/main/java/com/idlefish/flutterboost/Debuger.java
android/src/main/java/com/idlefish/flutterboost/Debuger.java
+2
-2
android/src/main/java/com/idlefish/flutterboost/FlutterBoost.java
...src/main/java/com/idlefish/flutterboost/FlutterBoost.java
+24
-34
android/src/main/java/com/idlefish/flutterboost/FlutterViewContainerManager.java
...om/idlefish/flutterboost/FlutterViewContainerManager.java
+9
-10
android/src/main/java/com/idlefish/flutterboost/Platform.java
...oid/src/main/java/com/idlefish/flutterboost/Platform.java
+3
-3
android/src/main/java/com/idlefish/flutterboost/StateListener.java
...rc/main/java/com/idlefish/flutterboost/StateListener.java
+9
-2
android/src/main/java/com/idlefish/flutterboost/Utils.java
android/src/main/java/com/idlefish/flutterboost/Utils.java
+1
-4
android/src/main/java/com/idlefish/flutterboost/containers/BoostFlutterActivity.java
...dlefish/flutterboost/containers/BoostFlutterActivity.java
+9
-9
android/src/main/java/com/idlefish/flutterboost/containers/BoostFlutterFragment.java
...dlefish/flutterboost/containers/BoostFlutterFragment.java
+8
-8
android/src/main/java/com/idlefish/flutterboost/interfaces/IContainerManager.java
...m/idlefish/flutterboost/interfaces/IContainerManager.java
+1
-1
android/src/main/java/com/idlefish/flutterboost/interfaces/IContainerRecord.java
...om/idlefish/flutterboost/interfaces/IContainerRecord.java
+1
-1
android/src/main/java/com/idlefish/flutterboost/interfaces/IFlutterEngineProvider.java
...efish/flutterboost/interfaces/IFlutterEngineProvider.java
+2
-5
android/src/main/java/com/idlefish/flutterboost/interfaces/IFlutterViewContainer.java
...lefish/flutterboost/interfaces/IFlutterViewContainer.java
+2
-2
android/src/main/java/com/idlefish/flutterboost/interfaces/IOperateSyncer.java
.../com/idlefish/flutterboost/interfaces/IOperateSyncer.java
+1
-1
android/src/main/java/com/idlefish/flutterboost/interfaces/IPlatform.java
.../java/com/idlefish/flutterboost/interfaces/IPlatform.java
+1
-1
android/src/main/java/com/idlefish/flutterboost/interfaces/IStateListener.java
.../com/idlefish/flutterboost/interfaces/IStateListener.java
+7
-3
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/FlutterFragment.java
.../taobao/idlefish/flutterboostexample/FlutterFragment.java
+1
-4
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/FlutterPageActivity.java
...bao/idlefish/flutterboostexample/FlutterPageActivity.java
+3
-6
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/MyApplication.java
...om/taobao/idlefish/flutterboostexample/MyApplication.java
+3
-3
example/ios/Runner/GeneratedPluginRegistrant.m
example/ios/Runner/GeneratedPluginRegistrant.m
+2
-2
pubspec.yaml
pubspec.yaml
+2
-4
No files found.
android/build.gradle
View file @
8d103553
...
...
@@ -37,11 +37,10 @@ dependencies {
implementation
'com.alibaba:fastjson:1.2.41'
implementation
'com.android.support:support-v4:26.1.0'
implementation
'com.android.support:appcompat-v7:26.1.0'
provided
rootProject
.
findProject
(
":xservice_kit"
)
}
ext
{
groupId
=
'com.taobao.fleamarket'
artifactId
=
"FlutterBoost
Plugin
"
artifactId
=
"FlutterBoost"
}
android/src/main/AndroidManifest.xml
View file @
8d103553
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.taobao.idlefish.flutterboost"
>
<application
android:allowBackup=
"false"
>
<activity
android:name=
"com.taobao.idlefish.flutterboost.BoostFlutterActivity"
android:launchMode=
"standard"
android:screenOrientation=
"portrait"
android:configChanges=
"orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:hardwareAccelerated=
"true"
android:windowSoftInputMode=
"adjustResize"
/>
<application
android:allowBackup=
"false"
>
</application>
</manifest>
android/src/main/java/com/
taobao/
idlefish/flutterboost/BoostChannel.java
→
android/src/main/java/com/idlefish/flutterboost/BoostChannel.java
View file @
8d103553
package
com.
taobao.
idlefish.flutterboost
;
package
com.idlefish.flutterboost
;
import
android.support.annotation.Nullable
;
import
com.idlefish.flutterboost.interfaces.IStateListener
;
import
java.io.Serializable
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Map
;
import
java.util.Set
;
import
io.flutter.plugin.common.EventChannel
;
import
io.flutter.plugin.common.MethodCall
;
import
io.flutter.plugin.common.MethodChannel
;
import
io.flutter.plugin.common.PluginRegistry
;
public
class
BoostChannel
{
private
static
BoostChannel
sInstance
;
private
final
MethodChannel
mMethodChannel
;
private
final
Set
<
MethodChannel
.
MethodCallHandler
>
mMethodCallHandlers
=
new
HashSet
<>();
private
final
Map
<
String
,
Set
<
EventListener
>>
mEventListeners
=
new
HashMap
<>();
BoostChannel
(
MethodChannel
methodChannel
){
mMethodChannel
=
methodChannel
;
private
static
final
Set
<
ActionAfterRegistered
>
sActions
=
new
HashSet
<>();
public
static
BoostChannel
singleton
()
{
if
(
sInstance
==
null
)
{
throw
new
RuntimeException
(
"BoostChannel not register yet"
);
}
return
sInstance
;
}
public
static
void
addActionAfterRegistered
(
ActionAfterRegistered
action
)
{
if
(
action
==
null
)
return
;
if
(
sInstance
==
null
)
{
sActions
.
add
(
action
);
}
else
{
action
.
onChannelRegistered
(
sInstance
);
}
}
public
static
void
registerWith
(
PluginRegistry
.
Registrar
registrar
)
{
sInstance
=
new
BoostChannel
(
registrar
);
for
(
ActionAfterRegistered
a
:
sActions
)
{
a
.
onChannelRegistered
(
sInstance
);
}
final
IStateListener
stateListener
=
FlutterBoost
.
sInstance
.
mStateListener
;
if
(
stateListener
!=
null
)
{
stateListener
.
onChannelRegistered
(
registrar
,
sInstance
);
}
sActions
.
clear
();
}
private
BoostChannel
(
PluginRegistry
.
Registrar
registrar
){
mMethodChannel
=
new
MethodChannel
(
registrar
.
messenger
(),
"flutter_boost"
);
mMethodChannel
.
setMethodCallHandler
(
new
MethodChannel
.
MethodCallHandler
()
{
@Override
...
...
@@ -143,4 +182,8 @@ public class BoostChannel {
public
interface
EventListener
{
void
onEvent
(
String
name
,
Map
args
);
}
public
interface
ActionAfterRegistered
{
void
onChannelRegistered
(
BoostChannel
channel
);
}
}
android/src/main/java/com/
taobao/
idlefish/flutterboost/BoostEngineProvider.java
→
android/src/main/java/com/idlefish/flutterboost/BoostEngineProvider.java
View file @
8d103553
...
...
@@ -21,12 +21,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
com.
taobao.
idlefish.flutterboost
;
package
com.idlefish.flutterboost
;
import
android.content.Context
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IFlutterEngineProvider
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IStateListener
;
import
com.idlefish.flutterboost.interfaces.IFlutterEngineProvider
;
import
com.idlefish.flutterboost.interfaces.IStateListener
;
import
io.flutter.embedding.engine.FlutterShellArgs
;
import
io.flutter.view.FlutterMain
;
...
...
@@ -50,7 +50,7 @@ public class BoostEngineProvider implements IFlutterEngineProvider {
mEngine
=
new
BoostFlutterEngine
(
context
.
getApplicationContext
());
final
IStateListener
stateListener
=
FlutterBoost
Plugin
.
sInstance
.
mStateListener
;
final
IStateListener
stateListener
=
FlutterBoost
.
sInstance
.
mStateListener
;
if
(
stateListener
!=
null
)
{
stateListener
.
onEngineCreated
(
mEngine
);
}
...
...
@@ -64,7 +64,7 @@ public class BoostEngineProvider implements IFlutterEngineProvider {
}
public
static
void
assertEngineRunning
(){
final
BoostFlutterEngine
engine
=
FlutterBoost
Plugin
.
singleton
().
engineProvider
().
tryGetEngine
();
final
BoostFlutterEngine
engine
=
FlutterBoost
.
singleton
().
engineProvider
().
tryGetEngine
();
if
(
engine
==
null
||
!
engine
.
isRunning
())
{
throw
new
RuntimeException
(
"engine is not running yet!"
);
}
...
...
android/src/main/java/com/
taobao/
idlefish/flutterboost/BoostFlutterEngine.java
→
android/src/main/java/com/idlefish/flutterboost/BoostFlutterEngine.java
View file @
8d103553
package
com.
taobao.
idlefish.flutterboost
;
package
com.idlefish.flutterboost
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.support.annotation.NonNull
;
import
android.support.annotation.Nullable
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IContainerRecord
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IStateListener
;
import
com.idlefish.flutterboost.interfaces.IContainerRecord
;
import
com.idlefish.flutterboost.interfaces.IStateListener
;
import
java.lang.ref.WeakReference
;
...
...
@@ -47,12 +47,12 @@ public class BoostFlutterEngine extends FlutterEngine {
"main"
);
getDartExecutor
().
executeDartEntrypoint
(
entryPoint
);
final
IStateListener
stateListener
=
FlutterBoost
Plugin
.
sInstance
.
mStateListener
;
final
IStateListener
stateListener
=
FlutterBoost
.
sInstance
.
mStateListener
;
if
(
stateListener
!=
null
)
{
stateListener
.
onEngineStarted
(
this
);
}
FlutterBoost
Plugin
.
singleton
().
platform
().
registerPlugins
(
mBoostPluginRegistry
);
FlutterBoost
.
singleton
().
platform
().
registerPlugins
(
mBoostPluginRegistry
);
}
}
...
...
@@ -92,13 +92,13 @@ public class BoostFlutterEngine extends FlutterEngine {
Activity
activity
;
IContainerRecord
record
;
record
=
FlutterBoost
Plugin
.
singleton
().
containerManager
().
getCurrentTopRecord
();
record
=
FlutterBoost
.
singleton
().
containerManager
().
getCurrentTopRecord
();
if
(
record
==
null
)
{
record
=
FlutterBoost
Plugin
.
singleton
().
containerManager
().
getLastGenerateRecord
();
record
=
FlutterBoost
.
singleton
().
containerManager
().
getLastGenerateRecord
();
}
if
(
record
==
null
){
activity
=
FlutterBoost
Plugin
.
singleton
().
currentActivity
();
activity
=
FlutterBoost
.
singleton
().
currentActivity
();
}
else
{
activity
=
record
.
getContainer
().
getContextActivity
();
}
...
...
android/src/main/java/com/
taobao/
idlefish/flutterboost/BoostFlutterView.java
→
android/src/main/java/com/idlefish/flutterboost/BoostFlutterView.java
View file @
8d103553
...
...
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
com.
taobao.
idlefish.flutterboost
;
package
com.idlefish.flutterboost
;
import
android.app.Activity
;
import
android.content.Context
;
...
...
@@ -29,7 +29,6 @@ import android.content.Intent;
import
android.graphics.Bitmap
;
import
android.graphics.Color
;
import
android.os.Bundle
;
import
android.os.SystemClock
;
import
android.support.v4.view.ViewCompat
;
import
android.view.Gravity
;
import
android.view.View
;
...
...
@@ -40,7 +39,7 @@ import android.widget.LinearLayout;
import
android.widget.ProgressBar
;
import
android.widget.TextView
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IStateListener
;
import
com.idlefish.flutterboost.interfaces.IStateListener
;
import
java.util.LinkedList
;
import
java.util.List
;
...
...
@@ -134,7 +133,7 @@ public class BoostFlutterView extends FrameLayout {
mFlutterEngine
.
startRun
((
Activity
)
getContext
());
final
IStateListener
stateListener
=
FlutterBoost
Plugin
.
sInstance
.
mStateListener
;
final
IStateListener
stateListener
=
FlutterBoost
.
sInstance
.
mStateListener
;
if
(
stateListener
!=
null
)
{
stateListener
.
onFlutterViewInited
(
mFlutterEngine
,
this
);
}
...
...
@@ -168,7 +167,7 @@ public class BoostFlutterView extends FrameLayout {
}
protected
BoostFlutterEngine
createFlutterEngine
(
Context
context
)
{
return
FlutterBoost
Plugin
.
singleton
().
engineProvider
().
createEngine
(
context
);
return
FlutterBoost
.
singleton
().
engineProvider
().
createEngine
(
context
);
}
public
void
addFirstFrameRendered
(
OnFirstFrameRenderedListener
listener
)
{
...
...
@@ -224,7 +223,7 @@ public class BoostFlutterView extends FrameLayout {
public
void
onAttach
()
{
Debuger
.
log
(
"BoostFlutterView onAttach"
);
final
IStateListener
stateListener
=
FlutterBoost
Plugin
.
sInstance
.
mStateListener
;
final
IStateListener
stateListener
=
FlutterBoost
.
sInstance
.
mStateListener
;
if
(
stateListener
!=
null
)
{
stateListener
.
beforeEngineAttach
(
mFlutterEngine
,
this
);
}
...
...
@@ -255,7 +254,7 @@ public class BoostFlutterView extends FrameLayout {
}
}
final
IStateListener
stateListener
=
FlutterBoost
Plugin
.
sInstance
.
mStateListener
;
final
IStateListener
stateListener
=
FlutterBoost
.
sInstance
.
mStateListener
;
if
(
stateListener
!=
null
)
{
stateListener
.
beforeEngineDetach
(
mFlutterEngine
,
this
);
}
...
...
@@ -269,8 +268,6 @@ public class BoostFlutterView extends FrameLayout {
Debuger
.
log
(
"BoostFlutterView onDestroy"
);
mFlutterView
.
removeOnFirstFrameRenderedListener
(
mOnFirstFrameRenderedListener
);
mPlatformPlugin
=
null
;
mFlutterEngine
=
null
;
}
@Override
...
...
android/src/main/java/com/
taobao/
idlefish/flutterboost/ContainerRecord.java
→
android/src/main/java/com/idlefish/flutterboost/ContainerRecord.java
View file @
8d103553
...
...
@@ -21,12 +21,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
com.
taobao.
idlefish.flutterboost
;
package
com.idlefish.flutterboost
;
import
android.content.Intent
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IContainerRecord
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IFlutterViewContainer
;
import
com.idlefish.flutterboost.interfaces.IContainerRecord
;
import
com.idlefish.flutterboost.interfaces.IFlutterViewContainer
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -143,7 +143,7 @@ public class ContainerRecord implements IContainerRecord {
map
.
put
(
"name"
,
mContainer
.
getContainerUrl
());
map
.
put
(
"uniqueId"
,
mUniqueId
);
FlutterBoost
Plugin
.
singleton
().
channel
().
sendEvent
(
"lifecycle"
,
map
);
FlutterBoost
.
singleton
().
channel
().
sendEvent
(
"lifecycle"
,
map
);
mContainer
.
getBoostFlutterView
().
onBackPressed
();
}
...
...
@@ -241,7 +241,7 @@ public class ContainerRecord implements IContainerRecord {
args
.
put
(
"pageName"
,
url
);
args
.
put
(
"params"
,
params
);
args
.
put
(
"uniqueId"
,
uniqueId
);
FlutterBoost
Plugin
.
singleton
().
channel
().
invokeMethod
(
method
,
args
);
FlutterBoost
.
singleton
().
channel
().
invokeMethod
(
method
,
args
);
}
public
void
invokeChannelUnsafe
(
String
method
,
String
url
,
Map
params
,
String
uniqueId
)
{
...
...
@@ -249,7 +249,7 @@ public class ContainerRecord implements IContainerRecord {
args
.
put
(
"pageName"
,
url
);
args
.
put
(
"params"
,
params
);
args
.
put
(
"uniqueId"
,
uniqueId
);
FlutterBoost
Plugin
.
singleton
().
channel
().
invokeMethodUnsafe
(
method
,
args
);
FlutterBoost
.
singleton
().
channel
().
invokeMethodUnsafe
(
method
,
args
);
}
}
}
android/src/main/java/com/
taobao/
idlefish/flutterboost/Debuger.java
→
android/src/main/java/com/idlefish/flutterboost/Debuger.java
View file @
8d103553
...
...
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
com.
taobao.
idlefish.flutterboost
;
package
com.idlefish.flutterboost
;
import
android.util.Log
;
...
...
@@ -60,7 +60,7 @@ public class Debuger {
public
static
boolean
isDebug
(){
try
{
return
FlutterBoost
Plugin
.
singleton
().
platform
().
isDebug
();
return
FlutterBoost
.
singleton
().
platform
().
isDebug
();
}
catch
(
Throwable
t
){
return
false
;
}
...
...
android/src/main/java/com/
taobao/idlefish/flutterboost/FlutterBoostPlugin
.java
→
android/src/main/java/com/
idlefish/flutterboost/FlutterBoost
.java
View file @
8d103553
...
...
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
com.
taobao.
idlefish.flutterboost
;
package
com.idlefish.flutterboost
;
import
android.app.Activity
;
import
android.app.Application
;
...
...
@@ -29,28 +29,26 @@ import android.content.Intent;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IContainerManager
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IContainerRecord
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IFlutterEngineProvider
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IFlutterViewContainer
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IPlatform
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IStateListener
;
import
com.idlefish.flutterboost.interfaces.IContainerManager
;
import
com.idlefish.flutterboost.interfaces.IContainerRecord
;
import
com.idlefish.flutterboost.interfaces.IFlutterEngineProvider
;
import
com.idlefish.flutterboost.interfaces.IFlutterViewContainer
;
import
com.idlefish.flutterboost.interfaces.IPlatform
;
import
com.idlefish.flutterboost.interfaces.IStateListener
;
import
java.util.HashMap
;
import
java.util.Map
;
import
io.flutter.plugin.common.MethodCall
;
import
io.flutter.plugin.common.MethodChannel
;
import
io.flutter.plugin.common.PluginRegistry
;
public
class
FlutterBoost
{
public
class
FlutterBoostPlugin
{
static
FlutterBoostPlugin
sInstance
=
null
;
static
FlutterBoost
sInstance
=
null
;
public
static
synchronized
void
init
(
IPlatform
platform
)
{
if
(
sInstance
==
null
)
{
sInstance
=
new
FlutterBoost
Plugin
(
platform
);
sInstance
=
new
FlutterBoost
(
platform
);
}
if
(
platform
.
whenEngineStart
()
==
IPlatform
.
IMMEDIATELY
)
{
...
...
@@ -60,32 +58,33 @@ public class FlutterBoostPlugin {
}
}
public
static
FlutterBoost
Plugin
singleton
()
{
public
static
FlutterBoost
singleton
()
{
if
(
sInstance
==
null
)
{
Debuger
.
exception
(
"FlutterBoostPlugin
not init yet"
);
throw
new
RuntimeException
(
"FlutterBoost
not init yet"
);
}
return
sInstance
;
}
public
static
void
registerWith
(
PluginRegistry
.
Registrar
registrar
)
{
final
MethodChannel
method
=
new
MethodChannel
(
registrar
.
messenger
(),
"flutter_boost"
);
singleton
().
registerChannel
(
method
);
}
private
final
IPlatform
mPlatform
;
private
final
IContainerManager
mManager
;
private
final
IFlutterEngineProvider
mEngineProvider
;
IStateListener
mStateListener
;
Activity
mCurrentActiveActivity
;
BoostChannel
mBoostChannel
;
private
FlutterBoost
Plugin
(
IPlatform
platform
)
{
private
FlutterBoost
(
IPlatform
platform
)
{
mPlatform
=
platform
;
mManager
=
new
FlutterViewContainerManager
();
mEngineProvider
=
new
BoostEngineProvider
();
platform
.
getApplication
().
registerActivityLifecycleCallbacks
(
new
ActivityLifecycleCallbacks
());
BoostChannel
.
addActionAfterRegistered
(
new
BoostChannel
.
ActionAfterRegistered
()
{
@Override
public
void
onChannelRegistered
(
BoostChannel
channel
)
{
channel
.
addMethodCallHandler
(
new
BoostMethodHandler
());
}
});
}
public
IFlutterEngineProvider
engineProvider
()
{
...
...
@@ -101,10 +100,7 @@ public class FlutterBoostPlugin {
}
public
BoostChannel
channel
()
{
if
(
mBoostChannel
==
null
)
{
Debuger
.
exception
(
"channel not register yet!"
);
}
return
mBoostChannel
;
return
BoostChannel
.
singleton
();
}
public
Activity
currentActivity
()
{
...
...
@@ -119,12 +115,6 @@ public class FlutterBoostPlugin {
mStateListener
=
listener
;
}
private
void
registerChannel
(
MethodChannel
method
)
{
mBoostChannel
=
new
BoostChannel
(
method
);
mBoostChannel
.
addMethodCallHandler
(
new
BoostMethodHandler
());
}
class
ActivityLifecycleCallbacks
implements
Application
.
ActivityLifecycleCallbacks
{
@Override
public
void
onActivityCreated
(
Activity
activity
,
Bundle
savedInstanceState
)
{
...
...
@@ -143,7 +133,7 @@ public class FlutterBoostPlugin {
if
(
mEngineProvider
.
tryGetEngine
()
!=
null
)
{
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
"foreground"
);
mBoostChannel
.
sendEvent
(
"lifecycle"
,
map
);
channel
()
.
sendEvent
(
"lifecycle"
,
map
);
}
}
mCurrentActiveActivity
=
activity
;
...
...
@@ -167,7 +157,7 @@ public class FlutterBoostPlugin {
if
(
mEngineProvider
.
tryGetEngine
()
!=
null
)
{
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
"background"
);
mBoostChannel
.
sendEvent
(
"lifecycle"
,
map
);
channel
()
.
sendEvent
(
"lifecycle"
,
map
);
}
mCurrentActiveActivity
=
null
;
}
...
...
@@ -186,7 +176,7 @@ public class FlutterBoostPlugin {
if
(
mEngineProvider
.
tryGetEngine
()
!=
null
)
{
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
"background"
);
mBoostChannel
.
sendEvent
(
"lifecycle"
,
map
);
channel
()
.
sendEvent
(
"lifecycle"
,
map
);
}
mCurrentActiveActivity
=
null
;
}
...
...
android/src/main/java/com/
taobao/
idlefish/flutterboost/FlutterViewContainerManager.java
→
android/src/main/java/com/idlefish/flutterboost/FlutterViewContainerManager.java
View file @
8d103553
...
...
@@ -21,21 +21,20 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
com.
taobao.
idlefish.flutterboost
;
package
com.idlefish.flutterboost
;
import
android.content.Context
;
import
android.text.TextUtils
;
import
android.util.SparseArray
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IContainerManager
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IContainerRecord
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IFlutterViewContainer
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IOperateSyncer
;
import
com.idlefish.flutterboost.interfaces.IContainerManager
;
import
com.idlefish.flutterboost.interfaces.IContainerRecord
;
import
com.idlefish.flutterboost.interfaces.IFlutterViewContainer
;
import
com.idlefish.flutterboost.interfaces.IOperateSyncer
;
import
java.lang.ref.WeakReference
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
...
...
@@ -103,9 +102,9 @@ public class FlutterViewContainerManager implements IContainerManager {
@Override
public
void
openContainer
(
String
url
,
Map
<
String
,
Object
>
urlParams
,
Map
<
String
,
Object
>
exts
,
OnResult
onResult
)
{
Context
context
=
FlutterBoost
Plugin
.
singleton
().
currentActivity
();
Context
context
=
FlutterBoost
.
singleton
().
currentActivity
();
if
(
context
==
null
)
{
context
=
FlutterBoost
Plugin
.
singleton
().
platform
().
getApplication
();
context
=
FlutterBoost
.
singleton
().
platform
().
getApplication
();
}
int
requestCode
=
mRequestCode
.
addAndGet
(
3
);
...
...
@@ -113,7 +112,7 @@ public class FlutterViewContainerManager implements IContainerManager {
mOnResults
.
put
(
requestCode
,
onResult
);
}
FlutterBoost
Plugin
.
singleton
().
platform
().
openContainer
(
context
,
url
,
urlParams
,
requestCode
,
exts
);
FlutterBoost
.
singleton
().
platform
().
openContainer
(
context
,
url
,
urlParams
,
requestCode
,
exts
);
}
@Override
...
...
@@ -130,7 +129,7 @@ public class FlutterViewContainerManager implements IContainerManager {
Debuger
.
exception
(
"closeContainer can not find uniqueId:"
+
uniqueId
);
}
FlutterBoost
Plugin
.
singleton
().
platform
().
closeContainer
(
targetRecord
,
result
,
exts
);
FlutterBoost
.
singleton
().
platform
().
closeContainer
(
targetRecord
,
result
,
exts
);
return
targetRecord
;
}
...
...
android/src/main/java/com/
taobao/
idlefish/flutterboost/Platform.java
→
android/src/main/java/com/idlefish/flutterboost/Platform.java
View file @
8d103553
package
com.
taobao.
idlefish.flutterboost
;
package
com.idlefish.flutterboost
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IContainerRecord
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IPlatform
;
import
com.idlefish.flutterboost.interfaces.IContainerRecord
;
import
com.idlefish.flutterboost.interfaces.IPlatform
;
import
java.util.Map
;
...
...
android/src/main/java/com/
taobao/
idlefish/flutterboost/StateListener.java
→
android/src/main/java/com/idlefish/flutterboost/StateListener.java
View file @
8d103553
package
com.
taobao.
idlefish.flutterboost
;
package
com.idlefish.flutterboost
;
import
com.taobao.idlefish.flutterboost.interfaces.IStateListener
;
import
com.idlefish.flutterboost.interfaces.IStateListener
;
import
io.flutter.plugin.common.PluginRegistry
;
public
class
StateListener
implements
IStateListener
{
@Override
...
...
@@ -13,6 +15,11 @@ public class StateListener implements IStateListener {
Debuger
.
log
(
">>onEngineStarted"
);
}
@Override
public
void
onChannelRegistered
(
PluginRegistry
.
Registrar
registrar
,
BoostChannel
channel
)
{
Debuger
.
log
(
">>onFlutterViewInited"
);
}
@Override
public
void
onFlutterViewInited
(
BoostFlutterEngine
engine
,
BoostFlutterView
flutterView
)
{
Debuger
.
log
(
">>onFlutterViewInited"
);
...
...
android/src/main/java/com/
taobao/
idlefish/flutterboost/Utils.java
→
android/src/main/java/com/idlefish/flutterboost/Utils.java
View file @
8d103553
...
...
@@ -21,17 +21,14 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
com.
taobao.
idlefish.flutterboost
;
package
com.idlefish.flutterboost
;
import
android.graphics.Bitmap
;
import
android.graphics.Color
;
import
android.os.Looper
;
import
android.util.Log
;
import
java.io.File
;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
public
class
Utils
{
...
...
android/src/main/java/com/
taobao/
idlefish/flutterboost/containers/BoostFlutterActivity.java
→
android/src/main/java/com/idlefish/flutterboost/containers/BoostFlutterActivity.java
View file @
8d103553
...
...
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
com.
taobao.
idlefish.flutterboost.containers
;
package
com.idlefish.flutterboost.containers
;
import
android.app.Activity
;
import
android.content.Context
;
...
...
@@ -40,11 +40,11 @@ import android.widget.LinearLayout;
import
android.widget.ProgressBar
;
import
android.widget.TextView
;
import
com.
taobao.
idlefish.flutterboost.BoostFlutterEngine
;
import
com.
taobao.
idlefish.flutterboost.BoostFlutterView
;
import
com.
taobao.idlefish.flutterboost.FlutterBoostPlugin
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IFlutterViewContainer
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IOperateSyncer
;
import
com.idlefish.flutterboost.BoostFlutterEngine
;
import
com.idlefish.flutterboost.BoostFlutterView
;
import
com.
idlefish.flutterboost.FlutterBoost
;
import
com.idlefish.flutterboost.interfaces.IFlutterViewContainer
;
import
com.idlefish.flutterboost.interfaces.IOperateSyncer
;
import
java.io.Serializable
;
import
java.util.HashMap
;
...
...
@@ -65,7 +65,7 @@ public abstract class BoostFlutterActivity extends Activity implements IFlutterV
configureWindowForTransparency
();
mSyncer
=
FlutterBoost
Plugin
.
singleton
().
containerManager
().
generateSyncer
(
this
);
mSyncer
=
FlutterBoost
.
singleton
().
containerManager
().
generateSyncer
(
this
);
mFlutterEngine
=
createFlutterEngine
();
...
...
@@ -98,14 +98,14 @@ public abstract class BoostFlutterActivity extends Activity implements IFlutterV
}
protected
BoostFlutterEngine
createFlutterEngine
(){
return
FlutterBoost
Plugin
.
singleton
().
engineProvider
().
createEngine
(
this
);
return
FlutterBoost
.
singleton
().
engineProvider
().
createEngine
(
this
);
}
protected
BoostFlutterView
createFlutterView
(
BoostFlutterEngine
engine
){
BoostFlutterView
.
Builder
builder
=
new
BoostFlutterView
.
Builder
(
this
);
return
builder
.
flutterEngine
(
engine
)
.
renderMode
(
FlutterView
.
RenderMode
.
surfac
e
)
.
renderMode
(
FlutterView
.
RenderMode
.
textur
e
)
.
transparencyMode
(
isBackgroundTransparent
()
?
FlutterView
.
TransparencyMode
.
transparent
:
FlutterView
.
TransparencyMode
.
opaque
)
...
...
android/src/main/java/com/
taobao/
idlefish/flutterboost/containers/BoostFlutterFragment.java
→
android/src/main/java/com/idlefish/flutterboost/containers/BoostFlutterFragment.java
View file @
8d103553
...
...
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
com.
taobao.
idlefish.flutterboost.containers
;
package
com.idlefish.flutterboost.containers
;
import
android.app.Activity
;
import
android.content.Intent
;
...
...
@@ -32,11 +32,11 @@ import android.view.LayoutInflater;
import
android.view.View
;
import
android.view.ViewGroup
;
import
com.
taobao.
idlefish.flutterboost.BoostFlutterEngine
;
import
com.
taobao.
idlefish.flutterboost.BoostFlutterView
;
import
com.
taobao.idlefish.flutterboost.FlutterBoostPlugin
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IFlutterViewContainer
;
import
com.
taobao.
idlefish.flutterboost.interfaces.IOperateSyncer
;
import
com.idlefish.flutterboost.BoostFlutterEngine
;
import
com.idlefish.flutterboost.BoostFlutterView
;
import
com.
idlefish.flutterboost.FlutterBoost
;
import
com.idlefish.flutterboost.interfaces.IFlutterViewContainer
;
import
com.idlefish.flutterboost.interfaces.IOperateSyncer
;
import
java.util.Map
;
...
...
@@ -51,7 +51,7 @@ abstract public class BoostFlutterFragment extends Fragment implements IFlutterV
@Nullable
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
mSyncer
=
FlutterBoost
Plugin
.
singleton
().
containerManager
().
generateSyncer
(
this
);
mSyncer
=
FlutterBoost
.
singleton
().
containerManager
().
generateSyncer
(
this
);
mFlutterEngine
=
createFlutterEngine
();
mFlutterView
=
createFlutterView
(
mFlutterEngine
);
...
...
@@ -62,7 +62,7 @@ abstract public class BoostFlutterFragment extends Fragment implements IFlutterV
}
protected
BoostFlutterEngine
createFlutterEngine
(){
return
FlutterBoost
Plugin
.
singleton
().
engineProvider
().
createEngine
(
getContext
());
return
FlutterBoost
.
singleton
().
engineProvider
().
createEngine
(
getContext
());
}
protected
BoostFlutterView
createFlutterView
(
BoostFlutterEngine
engine
){
...
...
android/src/main/java/com/
taobao/
idlefish/flutterboost/interfaces/IContainerManager.java
→
android/src/main/java/com/idlefish/flutterboost/interfaces/IContainerManager.java
View file @
8d103553
...
...
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
com.
taobao.
idlefish.flutterboost.interfaces
;
package
com.idlefish.flutterboost.interfaces
;
import
java.util.Map
;
...
...
android/src/main/java/com/
taobao/
idlefish/flutterboost/interfaces/IContainerRecord.java
→
android/src/main/java/com/idlefish/flutterboost/interfaces/IContainerRecord.java
View file @
8d103553
...
...
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
com.
taobao.
idlefish.flutterboost.interfaces
;
package
com.idlefish.flutterboost.interfaces
;
/**
* a container record, which use map a flutter page
...
...
android/src/main/java/com/
taobao/
idlefish/flutterboost/interfaces/IFlutterEngineProvider.java
→
android/src/main/java/com/idlefish/flutterboost/interfaces/IFlutterEngineProvider.java
View file @
8d103553
...
...
@@ -21,14 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
com.
taobao.
idlefish.flutterboost.interfaces
;
package
com.idlefish.flutterboost.interfaces
;
import
android.content.Context
;
import
com.taobao.idlefish.flutterboost.BoostFlutterEngine
;
import
com.taobao.idlefish.flutterboost.BoostFlutterView
;
import
io.flutter.embedding.engine.FlutterEngine
;
import
com.idlefish.flutterboost.BoostFlutterEngine
;
/**
* a flutter engine provider
*/
...
...
android/src/main/java/com/
taobao/
idlefish/flutterboost/interfaces/IFlutterViewContainer.java
→
android/src/main/java/com/idlefish/flutterboost/interfaces/IFlutterViewContainer.java
View file @
8d103553
...
...
@@ -21,11 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
com.
taobao.
idlefish.flutterboost.interfaces
;
package
com.idlefish.flutterboost.interfaces
;
import
android.app.Activity
;
import
com.
taobao.
idlefish.flutterboost.BoostFlutterView
;
import
com.idlefish.flutterboost.BoostFlutterView
;
import
java.util.Map
;
...
...
android/src/main/java/com/
taobao/
idlefish/flutterboost/interfaces/IOperateSyncer.java
→
android/src/main/java/com/idlefish/flutterboost/interfaces/IOperateSyncer.java
View file @
8d103553
package
com.
taobao.
idlefish.flutterboost.interfaces
;
package
com.idlefish.flutterboost.interfaces
;
import
android.content.Intent
;
...
...
android/src/main/java/com/
taobao/
idlefish/flutterboost/interfaces/IPlatform.java
→
android/src/main/java/com/idlefish/flutterboost/interfaces/IPlatform.java
View file @
8d103553
...
...
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
com.
taobao.
idlefish.flutterboost.interfaces
;
package
com.idlefish.flutterboost.interfaces
;
import
android.app.Application
;
import
android.content.Context
;
...
...
android/src/main/java/com/
taobao/
idlefish/flutterboost/interfaces/IStateListener.java
→
android/src/main/java/com/idlefish/flutterboost/interfaces/IStateListener.java
View file @
8d103553
package
com.
taobao.
idlefish.flutterboost.interfaces
;
package
com.idlefish.flutterboost.interfaces
;
import
com.taobao.idlefish.flutterboost.BoostFlutterEngine
;
import
com.taobao.idlefish.flutterboost.BoostFlutterView
;
import
com.idlefish.flutterboost.BoostChannel
;
import
com.idlefish.flutterboost.BoostFlutterEngine
;
import
com.idlefish.flutterboost.BoostFlutterView
;
import
io.flutter.plugin.common.PluginRegistry
;
public
interface
IStateListener
{
void
onEngineCreated
(
BoostFlutterEngine
engine
);
void
onEngineStarted
(
BoostFlutterEngine
engine
);
void
onChannelRegistered
(
PluginRegistry
.
Registrar
registrar
,
BoostChannel
channel
);
void
onFlutterViewInited
(
BoostFlutterEngine
engine
,
BoostFlutterView
flutterView
);
void
beforeEngineAttach
(
BoostFlutterEngine
engine
,
BoostFlutterView
flutterView
);
void
afterEngineAttached
(
BoostFlutterEngine
engine
,
BoostFlutterView
flutterView
);
...
...
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/FlutterFragment.java
View file @
8d103553
...
...
@@ -3,14 +3,11 @@ package com.taobao.idlefish.flutterboostexample;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
com.
taobao.
idlefish.flutterboost.containers.BoostFlutterFragment
;
import
com.idlefish.flutterboost.containers.BoostFlutterFragment
;
import
java.util.HashMap
;
import
java.util.Map
;
import
io.flutter.plugin.common.PluginRegistry
;
import
io.flutter.plugins.GeneratedPluginRegistrant
;
public
class
FlutterFragment
extends
BoostFlutterFragment
{
@Override
...
...
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/FlutterPageActivity.java
View file @
8d103553
package
com.taobao.idlefish.flutterboostexample
;
import
com.
taobao.
idlefish.flutterboost.containers.BoostFlutterActivity
;
import
com.idlefish.flutterboost.containers.BoostFlutterActivity
;
import
java.util.HashMap
;
import
java.util.Map
;
import
io.flutter.plugin.common.PluginRegistry
;
import
io.flutter.plugins.GeneratedPluginRegistrant
;
public
class
FlutterPageActivity
extends
BoostFlutterActivity
{
/**
...
...
@@ -15,7 +12,7 @@ public class FlutterPageActivity extends BoostFlutterActivity {
* 混合栈将会在flutter层根据这个名字,在注册的Route表中查找对应的Widget
*
* 在flutter层有注册函数:
* FlutterBoost
Plugin
.singleton.registerPageBuilders({
* FlutterBoost.singleton.registerPageBuilders({
* 'first': (pageName, params, _) => FirstRouteWidget(),
* 'second': (pageName, params, _) => SecondRouteWidget(),
* ...
...
...
@@ -34,7 +31,7 @@ public class FlutterPageActivity extends BoostFlutterActivity {
* 该方法返回的参数将会传递给上层的flutter对应的Widget
*
* 在flutter层有注册函数:
* FlutterBoost
Plugin
.singleton.registerPageBuilders({
* FlutterBoost.singleton.registerPageBuilders({
* 'first': (pageName, params, _) => FirstRouteWidget(),
* 'second': (pageName, params, _) => SecondRouteWidget(),
* ...
...
...
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/MyApplication.java
View file @
8d103553
...
...
@@ -3,8 +3,8 @@ package com.taobao.idlefish.flutterboostexample;
import
android.app.Application
;
import
android.content.Context
;
import
com.
taobao.idlefish.flutterboost.FlutterBoostPlugin
;
import
com.
taobao.
idlefish.flutterboost.Platform
;
import
com.
idlefish.flutterboost.FlutterBoost
;
import
com.idlefish.flutterboost.Platform
;
import
java.util.Map
;
...
...
@@ -17,7 +17,7 @@ public class MyApplication extends FlutterApplication {
public
void
onCreate
()
{
super
.
onCreate
();
FlutterBoost
Plugin
.
init
(
new
Platform
()
{
FlutterBoost
.
init
(
new
Platform
()
{
@Override
public
Application
getApplication
()
{
...
...
example/ios/Runner/GeneratedPluginRegistrant.m
View file @
8d103553
...
...
@@ -3,13 +3,13 @@
//
#import "GeneratedPluginRegistrant.h"
#import <flutter_boost/
FlutterBoostPlugin
.h>
#import <flutter_boost/
BoostChannel
.h>
#import <xservice_kit/XserviceKitPlugin.h>
@implementation
GeneratedPluginRegistrant
+
(
void
)
registerWithRegistry
:(
NSObject
<
FlutterPluginRegistry
>*
)
registry
{
[
FlutterBoostPlugin
registerWithRegistrar
:[
registry
registrarForPlugin
:
@"FlutterBoostPlugin
"
]];
[
BoostChannel
registerWithRegistrar
:[
registry
registrarForPlugin
:
@"BoostChannel
"
]];
[
XserviceKitPlugin
registerWithRegistrar
:[
registry
registrarForPlugin
:
@"XserviceKitPlugin"
]];
}
...
...
pubspec.yaml
View file @
8d103553
...
...
@@ -11,8 +11,6 @@ dependencies:
flutter
:
sdk
:
flutter
xservice_kit
:
^0.0.27
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
...
...
@@ -20,8 +18,8 @@ dependencies:
# The following section is specific to Flutter.
flutter
:
plugin
:
androidPackage
:
com.
taobao.
idlefish.flutterboost
pluginClass
:
FlutterBoostPlugin
androidPackage
:
com.idlefish.flutterboost
pluginClass
:
BoostChannel
# To add assets to your plugin package, add an assets section, like this:
# assets:
...
...
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