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
903b9f7a
Commit
903b9f7a
authored
Nov 13, 2019
by
yangwu.jia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更改名字
parent
8e651945
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
64 additions
and
78 deletions
+64
-78
android/src/main/java/com/idlefish/flutterboost/BoostRegistrar.java
...c/main/java/com/idlefish/flutterboost/BoostRegistrar.java
+2
-3
android/src/main/java/com/idlefish/flutterboost/ContainerRecord.java
.../main/java/com/idlefish/flutterboost/ContainerRecord.java
+3
-3
android/src/main/java/com/idlefish/flutterboost/Debuger.java
android/src/main/java/com/idlefish/flutterboost/Debuger.java
+1
-1
android/src/main/java/com/idlefish/flutterboost/FlutterBoost.java
...src/main/java/com/idlefish/flutterboost/FlutterBoost.java
+4
-6
android/src/main/java/com/idlefish/flutterboost/FlutterBoostPlugin.java
...in/java/com/idlefish/flutterboost/FlutterBoostPlugin.java
+2
-3
android/src/main/java/com/idlefish/flutterboost/FlutterViewContainerManager.java
...om/idlefish/flutterboost/FlutterViewContainerManager.java
+6
-8
android/src/main/java/com/idlefish/flutterboost/Platform.java
...oid/src/main/java/com/idlefish/flutterboost/Platform.java
+1
-3
android/src/main/java/com/idlefish/flutterboost/containers/BoostFlutterActivity.java
...dlefish/flutterboost/containers/BoostFlutterActivity.java
+7
-9
android/src/main/java/com/idlefish/flutterboost/containers/FlutterActivityAndFragmentDelegate.java
...rboost/containers/FlutterActivityAndFragmentDelegate.java
+8
-9
android/src/main/java/com/idlefish/flutterboost/containers/FlutterFragment.java
...com/idlefish/flutterboost/containers/FlutterFragment.java
+11
-13
android/src/main/java/com/idlefish/flutterboost/containers/FlutterSplashView.java
...m/idlefish/flutterboost/containers/FlutterSplashView.java
+3
-3
example/android/app/src/main/AndroidManifest.xml
example/android/app/src/main/AndroidManifest.xml
+1
-1
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/FlutterFragmentPageActivity.java
...fish/flutterboostexample/FlutterFragmentPageActivity.java
+6
-6
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/MyApplication.java
...om/taobao/idlefish/flutterboostexample/MyApplication.java
+6
-6
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/PageRouter.java
...a/com/taobao/idlefish/flutterboostexample/PageRouter.java
+3
-4
No files found.
android/src/main/java/com/idlefish/flutterboost/BoostRegistrar.java
View file @
903b9f7a
...
...
@@ -5,7 +5,6 @@ import android.content.Context;
import
android.support.annotation.NonNull
;
import
io.flutter.Log
;
import
io.flutter.embedding.engine.plugins.FlutterPlugin
;
import
io.flutter.embedding.engine.plugins.FlutterPlugin.FlutterPluginBinding
;
import
io.flutter.embedding.engine.plugins.activity.ActivityAware
;
import
io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
;
import
io.flutter.plugin.common.BinaryMessenger
;
...
...
@@ -46,8 +45,8 @@ class BoostRegistrar implements Registrar, FlutterPlugin, ActivityAware {
if
(
this
.
activityPluginBinding
!=
null
){
return
this
.
activityPluginBinding
.
getActivity
();
}
if
(
New
FlutterBoost
.
instance
().
currentActivity
()!=
null
){
return
New
FlutterBoost
.
instance
().
currentActivity
();
if
(
FlutterBoost
.
instance
().
currentActivity
()!=
null
){
return
FlutterBoost
.
instance
().
currentActivity
();
}
return
null
;
}
...
...
android/src/main/java/com/idlefish/flutterboost/ContainerRecord.java
View file @
903b9f7a
...
...
@@ -154,7 +154,7 @@ public class ContainerRecord implements IContainerRecord {
map
.
put
(
"name"
,
mContainer
.
getContainerUrl
());
map
.
put
(
"uniqueId"
,
mUniqueId
);
New
FlutterBoost
.
instance
().
channel
().
sendEvent
(
"lifecycle"
,
map
);
FlutterBoost
.
instance
().
channel
().
sendEvent
(
"lifecycle"
,
map
);
// mContainer.getBoostFlutterView().onBackPressed();
}
...
...
@@ -253,7 +253,7 @@ public class ContainerRecord implements IContainerRecord {
args
.
put
(
"pageName"
,
url
);
args
.
put
(
"params"
,
params
);
args
.
put
(
"uniqueId"
,
uniqueId
);
New
FlutterBoost
.
instance
().
channel
().
invokeMethod
(
method
,
args
);
FlutterBoost
.
instance
().
channel
().
invokeMethod
(
method
,
args
);
}
public
void
invokeChannelUnsafe
(
String
method
,
String
url
,
Map
params
,
String
uniqueId
)
{
...
...
@@ -261,7 +261,7 @@ public class ContainerRecord implements IContainerRecord {
args
.
put
(
"pageName"
,
url
);
args
.
put
(
"params"
,
params
);
args
.
put
(
"uniqueId"
,
uniqueId
);
New
FlutterBoost
.
instance
().
channel
().
invokeMethodUnsafe
(
method
,
args
);
FlutterBoost
.
instance
().
channel
().
invokeMethodUnsafe
(
method
,
args
);
}
}
...
...
android/src/main/java/com/idlefish/flutterboost/Debuger.java
View file @
903b9f7a
...
...
@@ -60,7 +60,7 @@ public class Debuger {
public
static
boolean
isDebug
(){
try
{
return
New
FlutterBoost
.
instance
().
platform
().
isDebug
();
return
FlutterBoost
.
instance
().
platform
().
isDebug
();
}
catch
(
Throwable
t
){
return
false
;
}
...
...
android/src/main/java/com/idlefish/flutterboost/
New
FlutterBoost.java
→
android/src/main/java/com/idlefish/flutterboost/FlutterBoost.java
View file @
903b9f7a
...
...
@@ -12,8 +12,6 @@ import io.flutter.embedding.android.FlutterView;
import
io.flutter.embedding.engine.FlutterEngine
;
import
io.flutter.embedding.engine.FlutterShellArgs
;
import
io.flutter.embedding.engine.dart.DartExecutor
;
import
io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
;
import
io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry
;
import
io.flutter.plugin.common.PluginRegistry
;
import
io.flutter.view.FlutterMain
;
...
...
@@ -21,7 +19,7 @@ import java.lang.reflect.Method;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
New
FlutterBoost
{
public
class
FlutterBoost
{
private
Platform
mPlatform
;
...
...
@@ -29,7 +27,7 @@ public class NewFlutterBoost {
private
FlutterEngine
mEngine
;
private
Activity
mCurrentActiveActivity
;
private
PluginRegistry
mRegistry
;
static
New
FlutterBoost
sInstance
=
null
;
static
FlutterBoost
sInstance
=
null
;
private
long
FlutterPostFrameCallTime
=
0
;
...
...
@@ -40,9 +38,9 @@ public class NewFlutterBoost {
public
void
setFlutterPostFrameCallTime
(
long
FlutterPostFrameCallTime
){
this
.
FlutterPostFrameCallTime
=
FlutterPostFrameCallTime
;
}
public
static
New
FlutterBoost
instance
()
{
public
static
FlutterBoost
instance
()
{
if
(
sInstance
==
null
)
{
sInstance
=
new
New
FlutterBoost
();
sInstance
=
new
FlutterBoost
();
}
return
sInstance
;
}
...
...
android/src/main/java/com/idlefish/flutterboost/FlutterBoostPlugin.java
View file @
903b9f7a
package
com.idlefish.flutterboost
;
import
android.os.Handler
;
import
android.support.annotation.Nullable
;
import
com.idlefish.flutterboost.interfaces.IContainerRecord
;
...
...
@@ -196,7 +195,7 @@ public class FlutterBoostPlugin {
@Override
public
void
onMethodCall
(
MethodCall
methodCall
,
final
MethodChannel
.
Result
result
)
{
FlutterViewContainerManager
mManager
=
(
FlutterViewContainerManager
)
New
FlutterBoost
.
instance
().
containerManager
();
FlutterViewContainerManager
mManager
=
(
FlutterViewContainerManager
)
FlutterBoost
.
instance
().
containerManager
();
switch
(
methodCall
.
method
)
{
case
"pageOnStart"
:
{
Map
<
String
,
Object
>
pageInfo
=
new
HashMap
<>();
...
...
@@ -215,7 +214,7 @@ public class FlutterBoostPlugin {
}
result
.
success
(
pageInfo
);
New
FlutterBoost
.
instance
().
setFlutterPostFrameCallTime
(
new
Date
().
getTime
());
FlutterBoost
.
instance
().
setFlutterPostFrameCallTime
(
new
Date
().
getTime
());
}
catch
(
Throwable
t
)
{
...
...
android/src/main/java/com/idlefish/flutterboost/FlutterViewContainerManager.java
View file @
903b9f7a
...
...
@@ -25,7 +25,6 @@ package com.idlefish.flutterboost;
import
android.content.Context
;
import
android.text.TextUtils
;
import
android.util.SparseArray
;
import
com.idlefish.flutterboost.interfaces.IContainerManager
;
import
com.idlefish.flutterboost.interfaces.IContainerRecord
;
...
...
@@ -41,7 +40,6 @@ import java.util.LinkedHashMap;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Stack
;
import
java.util.concurrent.atomic.AtomicInteger
;
public
class
FlutterViewContainerManager
implements
IContainerManager
{
...
...
@@ -85,8 +83,8 @@ public class FlutterViewContainerManager implements IContainerManager {
mRecordStack
.
remove
(
record
);
mRecordMap
.
remove
(
record
.
getContainer
());
if
(
mRecordStack
.
empty
()){
if
(
NewFlutterBoost
.
instance
().
platform
().
whenEngineDestroy
()==
New
FlutterBoost
.
ConfigBuilder
.
All_FLUTTER_ACTIVITY_DESTROY
){
New
FlutterBoost
.
instance
().
boostDestroy
();
if
(
FlutterBoost
.
instance
().
platform
().
whenEngineDestroy
()==
FlutterBoost
.
ConfigBuilder
.
All_FLUTTER_ACTIVITY_DESTROY
){
FlutterBoost
.
instance
().
boostDestroy
();
}
}
...
...
@@ -118,9 +116,9 @@ public class FlutterViewContainerManager implements IContainerManager {
}
void
openContainer
(
String
url
,
Map
<
String
,
Object
>
urlParams
,
Map
<
String
,
Object
>
exts
,
OnResult
onResult
)
{
Context
context
=
New
FlutterBoost
.
instance
().
currentActivity
();
Context
context
=
FlutterBoost
.
instance
().
currentActivity
();
if
(
context
==
null
)
{
context
=
New
FlutterBoost
.
instance
().
platform
().
getApplication
();
context
=
FlutterBoost
.
instance
().
platform
().
getApplication
();
}
if
(
urlParams
==
null
)
{
...
...
@@ -141,7 +139,7 @@ public class FlutterViewContainerManager implements IContainerManager {
mOnResults
.
put
(
currentTopRecord
.
uniqueId
(),
onResult
);
}
New
FlutterBoost
.
instance
().
platform
().
openContainer
(
context
,
url
,
urlParams
,
requestCode
,
exts
);
FlutterBoost
.
instance
().
platform
().
openContainer
(
context
,
url
,
urlParams
,
requestCode
,
exts
);
}
IContainerRecord
closeContainer
(
String
uniqueId
,
Map
<
String
,
Object
>
result
,
Map
<
String
,
Object
>
exts
)
{
...
...
@@ -157,7 +155,7 @@ public class FlutterViewContainerManager implements IContainerManager {
Debuger
.
exception
(
"closeContainer can not find uniqueId:"
+
uniqueId
);
}
New
FlutterBoost
.
instance
().
platform
().
closeContainer
(
targetRecord
,
result
,
exts
);
FlutterBoost
.
instance
().
platform
().
closeContainer
(
targetRecord
,
result
,
exts
);
return
targetRecord
;
}
...
...
android/src/main/java/com/idlefish/flutterboost/Platform.java
View file @
903b9f7a
...
...
@@ -4,11 +4,9 @@ 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
{
...
...
@@ -25,7 +23,7 @@ public abstract class Platform {
public
abstract
String
initialRoute
();
public
New
FlutterBoost
.
BoostLifecycleListener
lifecycleListener
;
public
FlutterBoost
.
BoostLifecycleListener
lifecycleListener
;
public
void
closeContainer
(
IContainerRecord
record
,
Map
<
String
,
Object
>
result
,
Map
<
String
,
Object
>
exts
)
{
if
(
record
==
null
)
return
;
...
...
android/src/main/java/com/idlefish/flutterboost/containers/
New
BoostFlutterActivity.java
→
android/src/main/java/com/idlefish/flutterboost/containers/BoostFlutterActivity.java
View file @
903b9f7a
...
...
@@ -19,8 +19,7 @@ import android.support.annotation.NonNull;
import
android.support.annotation.Nullable
;
import
android.view.*
;
import
android.widget.*
;
import
com.idlefish.flutterboost.NewFlutterBoost
;
import
com.idlefish.flutterboost.Utils
;
import
com.idlefish.flutterboost.FlutterBoost
;
import
com.idlefish.flutterboost.XFlutterView
;
import
io.flutter.Log
;
import
io.flutter.embedding.android.DrawableSplashScreen
;
...
...
@@ -29,13 +28,12 @@ import io.flutter.embedding.android.SplashScreen;
import
io.flutter.embedding.engine.FlutterEngine
;
import
io.flutter.embedding.engine.FlutterShellArgs
;
import
io.flutter.plugin.platform.PlatformPlugin
;
import
io.flutter.view.FlutterMain
;
import
java.io.Serializable
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
New
BoostFlutterActivity
extends
Activity
public
class
BoostFlutterActivity
extends
Activity
implements
FlutterActivityAndFragmentDelegate
.
Host
,
LifecycleOwner
{
...
...
@@ -64,19 +62,19 @@ public class NewBoostFlutterActivity extends Activity
public
static
NewEngineIntentBuilder
withNewEngine
()
{
return
new
NewEngineIntentBuilder
(
New
BoostFlutterActivity
.
class
);
return
new
NewEngineIntentBuilder
(
BoostFlutterActivity
.
class
);
}
public
static
class
NewEngineIntentBuilder
{
private
final
Class
<?
extends
New
BoostFlutterActivity
>
activityClass
;
private
final
Class
<?
extends
BoostFlutterActivity
>
activityClass
;
private
String
backgroundMode
=
DEFAULT_BACKGROUND_MODE
;
private
String
url
=
""
;
private
Map
params
=
new
HashMap
();
protected
NewEngineIntentBuilder
(
@NonNull
Class
<?
extends
New
BoostFlutterActivity
>
activityClass
)
{
protected
NewEngineIntentBuilder
(
@NonNull
Class
<?
extends
BoostFlutterActivity
>
activityClass
)
{
this
.
activityClass
=
activityClass
;
}
...
...
@@ -133,7 +131,7 @@ public class NewBoostFlutterActivity extends Activity
@NonNull
private
LifecycleRegistry
lifecycle
;
public
New
BoostFlutterActivity
()
{
public
BoostFlutterActivity
()
{
lifecycle
=
new
LifecycleRegistry
(
this
);
}
...
...
@@ -432,7 +430,7 @@ public class NewBoostFlutterActivity extends Activity
@Override
public
FlutterEngine
provideFlutterEngine
(
@NonNull
Context
context
)
{
// No-op. Hook for subclasses.
return
New
FlutterBoost
.
instance
().
engineProvider
();
return
FlutterBoost
.
instance
().
engineProvider
();
}
/**
...
...
android/src/main/java/com/idlefish/flutterboost/containers/FlutterActivityAndFragmentDelegate.java
View file @
903b9f7a
...
...
@@ -21,7 +21,7 @@ import java.util.Map;
import
com.idlefish.flutterboost.BoostPluginRegistry
;
import
com.idlefish.flutterboost.
New
FlutterBoost
;
import
com.idlefish.flutterboost.FlutterBoost
;
import
com.idlefish.flutterboost.Utils
;
import
com.idlefish.flutterboost.XFlutterView
;
import
com.idlefish.flutterboost.interfaces.IFlutterViewContainer
;
...
...
@@ -33,7 +33,6 @@ import io.flutter.embedding.engine.FlutterEngine;
import
io.flutter.embedding.engine.FlutterShellArgs
;
import
io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
;
import
io.flutter.plugin.platform.PlatformPlugin
;
import
io.flutter.view.FlutterMain
;
import
static
android
.
content
.
ComponentCallbacks2
.
TRIM_MEMORY_RUNNING_LOW
;
...
...
@@ -84,8 +83,8 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContaine
void
onAttach
(
@NonNull
Context
context
)
{
ensureAlive
();
if
(
NewFlutterBoost
.
instance
().
platform
().
whenEngineStart
()
==
New
FlutterBoost
.
ConfigBuilder
.
FLUTTER_ACTIVITY_CREATED
)
{
New
FlutterBoost
.
instance
().
doInitialFlutter
();
if
(
FlutterBoost
.
instance
().
platform
().
whenEngineStart
()
==
FlutterBoost
.
ConfigBuilder
.
FLUTTER_ACTIVITY_CREATED
)
{
FlutterBoost
.
instance
().
doInitialFlutter
();
}
// When "retain instance" is true, the FlutterEngine will survive configuration
// changes. Therefore, we create a new one only if one does not already exist.
...
...
@@ -139,10 +138,10 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContaine
);
mSyncer
=
New
FlutterBoost
.
instance
().
containerManager
().
generateSyncer
(
this
);
mSyncer
=
FlutterBoost
.
instance
().
containerManager
().
generateSyncer
(
this
);
ensureAlive
();
flutterView
=
new
XFlutterView
(
host
.
getActivity
(),
New
FlutterBoost
.
instance
().
platform
().
renderMode
(),
host
.
getTransparencyMode
());
flutterView
=
new
XFlutterView
(
host
.
getActivity
(),
FlutterBoost
.
instance
().
platform
().
renderMode
(),
host
.
getTransparencyMode
());
flutterSplashView
=
new
FlutterSplashView
(
host
.
getContext
());
...
...
@@ -181,7 +180,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContaine
ensureAlive
();
flutterEngine
.
getLifecycleChannel
().
appIsResumed
();
BoostPluginRegistry
registry
=
(
BoostPluginRegistry
)
New
FlutterBoost
.
instance
().
getPluginRegistry
();
BoostPluginRegistry
registry
=
(
BoostPluginRegistry
)
FlutterBoost
.
instance
().
getPluginRegistry
();
ActivityPluginBinding
binding
=
registry
.
getRegistrarAggregate
().
getActivityPluginBinding
();
if
(
binding
!=
null
&&(
binding
.
getActivity
()!=
this
.
host
.
getActivity
())){
flutterEngine
.
getActivityControlSurface
().
attachToActivity
(
...
...
@@ -222,7 +221,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContaine
mSyncer
.
onDestroy
();
ensureAlive
();
BoostPluginRegistry
registry
=
(
BoostPluginRegistry
)
New
FlutterBoost
.
instance
().
getPluginRegistry
();
BoostPluginRegistry
registry
=
(
BoostPluginRegistry
)
FlutterBoost
.
instance
().
getPluginRegistry
();
ActivityPluginBinding
binding
=
registry
.
getRegistrarAggregate
().
getActivityPluginBinding
();
if
(
binding
!=
null
&&(
binding
.
getActivity
()==
this
.
host
.
getActivity
())){
registry
.
getRegistrarAggregate
().
onDetachedFromActivityForConfigChanges
();
...
...
@@ -413,7 +412,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContaine
}
/**
* The {@link FlutterActivity} or {@link
New
FlutterFragment} that owns this
* The {@link FlutterActivity} or {@link FlutterFragment} that owns this
* {@code FlutterActivityAndFragmentDelegate}.
*/
/* package */
interface
Host
extends
SplashScreenProvider
,
FlutterEngineProvider
,
FlutterEngineConfigurator
{
...
...
android/src/main/java/com/idlefish/flutterboost/containers/
New
FlutterFragment.java
→
android/src/main/java/com/idlefish/flutterboost/containers/FlutterFragment.java
View file @
903b9f7a
...
...
@@ -14,20 +14,18 @@ import android.view.LayoutInflater;
import
android.view.View
;
import
android.view.ViewGroup
;
import
com.idlefish.flutterboost.
New
FlutterBoost
;
import
com.idlefish.flutterboost.FlutterBoost
;
import
com.idlefish.flutterboost.XFlutterView
;
import
io.flutter.embedding.android.*
;
import
io.flutter.embedding.engine.FlutterEngine
;
import
io.flutter.embedding.engine.FlutterShellArgs
;
import
io.flutter.embedding.engine.renderer.OnFirstFrameRenderedListener
;
import
io.flutter.plugin.platform.PlatformPlugin
;
import
io.flutter.view.FlutterMain
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
New
FlutterFragment
extends
Fragment
implements
FlutterActivityAndFragmentDelegate
.
Host
{
public
class
FlutterFragment
extends
Fragment
implements
FlutterActivityAndFragmentDelegate
.
Host
{
private
static
final
String
TAG
=
"NewFlutterFragment"
;
...
...
@@ -94,7 +92,7 @@ public class NewFlutterFragment extends Fragment implements FlutterActivityAndFr
* To use a cached {@link FlutterEngine} instead of creating a new one, use
*/
@NonNull
public
static
New
FlutterFragment
createDefault
()
{
public
static
FlutterFragment
createDefault
()
{
return
new
NewEngineFragmentBuilder
().
build
();
}
...
...
@@ -109,7 +107,7 @@ public class NewFlutterFragment extends Fragment implements FlutterActivityAndFr
public
static
class
NewEngineFragmentBuilder
{
private
final
Class
<?
extends
New
FlutterFragment
>
fragmentClass
;
private
final
Class
<?
extends
FlutterFragment
>
fragmentClass
;
private
FlutterShellArgs
shellArgs
=
null
;
private
FlutterView
.
RenderMode
renderMode
=
FlutterView
.
RenderMode
.
surface
;
...
...
@@ -122,14 +120,14 @@ public class NewFlutterFragment extends Fragment implements FlutterActivityAndFr
* {@code NewFlutterFragment}.
*/
public
NewEngineFragmentBuilder
()
{
fragmentClass
=
New
FlutterFragment
.
class
;
fragmentClass
=
FlutterFragment
.
class
;
}
/**
* Constructs a {@code NewEngineFragmentBuilder} that is configured to construct an instance of
* {@code subclass}, which extends {@code NewFlutterFragment}.
*/
public
NewEngineFragmentBuilder
(
@NonNull
Class
<?
extends
New
FlutterFragment
>
subclass
)
{
public
NewEngineFragmentBuilder
(
@NonNull
Class
<?
extends
FlutterFragment
>
subclass
)
{
fragmentClass
=
subclass
;
}
...
...
@@ -190,7 +188,7 @@ public class NewFlutterFragment extends Fragment implements FlutterActivityAndFr
args
.
putStringArray
(
ARG_FLUTTER_INITIALIZATION_ARGS
,
shellArgs
.
toArray
());
}
NewBoostFlutterActivity
.
SerializableMap
serializableMap
=
new
New
BoostFlutterActivity
.
SerializableMap
();
BoostFlutterActivity
.
SerializableMap
serializableMap
=
new
BoostFlutterActivity
.
SerializableMap
();
serializableMap
.
setMap
(
params
);
args
.
putString
(
EXTRA_URL
,
url
);
...
...
@@ -208,7 +206,7 @@ public class NewFlutterFragment extends Fragment implements FlutterActivityAndFr
* properties set on this {@code Builder}.
*/
@NonNull
public
<
T
extends
New
FlutterFragment
>
T
build
()
{
public
<
T
extends
FlutterFragment
>
T
build
()
{
try
{
@SuppressWarnings
(
"unchecked"
)
T
frag
=
(
T
)
fragmentClass
.
getDeclaredConstructor
().
newInstance
();
...
...
@@ -238,7 +236,7 @@ public class NewFlutterFragment extends Fragment implements FlutterActivityAndFr
return
delegate
.
getFlutterView
();
}
public
New
FlutterFragment
()
{
public
FlutterFragment
()
{
// Ensure that we at least have an empty Bundle of arguments so that we don't
// need to continually check for null arguments before grabbing one.
setArguments
(
new
Bundle
());
...
...
@@ -435,7 +433,7 @@ public class NewFlutterFragment extends Fragment implements FlutterActivityAndFr
@Nullable
public
FlutterEngine
provideFlutterEngine
(
@NonNull
Context
context
)
{
return
New
FlutterBoost
.
instance
().
engineProvider
();
return
FlutterBoost
.
instance
().
engineProvider
();
}
/**
...
...
@@ -507,7 +505,7 @@ public class NewFlutterFragment extends Fragment implements FlutterActivityAndFr
@Override
public
Map
getContainerUrlParams
()
{
NewBoostFlutterActivity
.
SerializableMap
serializableMap
=
(
New
BoostFlutterActivity
.
SerializableMap
)
getArguments
().
getSerializable
(
EXTRA_PARAMS
);
BoostFlutterActivity
.
SerializableMap
serializableMap
=
(
BoostFlutterActivity
.
SerializableMap
)
getArguments
().
getSerializable
(
EXTRA_PARAMS
);
return
serializableMap
.
getMap
();
}
...
...
android/src/main/java/com/idlefish/flutterboost/containers/FlutterSplashView.java
View file @
903b9f7a
...
...
@@ -64,9 +64,9 @@ public class FlutterSplashView extends FrameLayout {
@Override
public
void
onFirstFrameRendered
()
{
if
(
NewFlutterBoost
.
instance
().
platform
().
whenEngineStart
()==
New
FlutterBoost
.
ConfigBuilder
.
FLUTTER_ACTIVITY_CREATED
){
if
(
FlutterBoost
.
instance
().
platform
().
whenEngineStart
()==
FlutterBoost
.
ConfigBuilder
.
FLUTTER_ACTIVITY_CREATED
){
long
now
=
new
Date
().
getTime
();
long
flutterPostFrameCallTime
=
New
FlutterBoost
.
instance
().
getFlutterPostFrameCallTime
();
long
flutterPostFrameCallTime
=
FlutterBoost
.
instance
().
getFlutterPostFrameCallTime
();
if
(
flutterPostFrameCallTime
!=
0
&&
(
now
-
flutterPostFrameCallTime
)>
800
){
if
(
splashScreen
!=
null
)
{
...
...
@@ -119,7 +119,7 @@ public class FlutterSplashView extends FrameLayout {
setSaveEnabled
(
true
);
if
(
mFlutterEngine
==
null
)
{
mFlutterEngine
=
New
FlutterBoost
.
instance
().
engineProvider
();
mFlutterEngine
=
FlutterBoost
.
instance
().
engineProvider
();
}
}
...
...
example/android/app/src/main/AndroidManifest.xml
View file @
903b9f7a
...
...
@@ -36,7 +36,7 @@
<activity
android:name=
"com.idlefish.flutterboost.containers.
New
BoostFlutterActivity"
android:name=
"com.idlefish.flutterboost.containers.BoostFlutterActivity"
android:theme=
"@style/Theme.AppCompat"
android:configChanges=
"orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:hardwareAccelerated=
"true"
...
...
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/FlutterFragmentPageActivity.java
View file @
903b9f7a
...
...
@@ -13,7 +13,7 @@ import android.view.View;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.widget.ImageView
;
import
com.idlefish.flutterboost.containers.
New
FlutterFragment
;
import
com.idlefish.flutterboost.containers.FlutterFragment
;
import
io.flutter.embedding.android.DrawableSplashScreen
;
import
io.flutter.embedding.android.SplashScreen
;
import
io.flutter.embedding.android.SplashScreenProvider
;
...
...
@@ -22,7 +22,7 @@ import io.flutter.plugin.platform.PlatformPlugin;
public
class
FlutterFragmentPageActivity
extends
AppCompatActivity
implements
View
.
OnClickListener
,
SplashScreenProvider
{
protected
static
final
String
SPLASH_SCREEN_META_DATA_KEY
=
"io.flutter.embedding.android.SplashScreenDrawable"
;
private
New
FlutterFragment
mFragment
;
private
FlutterFragment
mFragment
;
private
View
mTab1
;
private
View
mTab2
;
...
...
@@ -70,17 +70,17 @@ public class FlutterFragmentPageActivity extends AppCompatActivity implements Vi
if
(
mTab1
==
v
)
{
mTab1
.
setBackgroundColor
(
Color
.
YELLOW
);
mFragment
=
new
New
FlutterFragment
.
NewEngineFragmentBuilder
().
url
(
"flutterFragment"
).
build
();
mFragment
=
new
FlutterFragment
.
NewEngineFragmentBuilder
().
url
(
"flutterFragment"
).
build
();
}
else
if
(
mTab2
==
v
)
{
mTab2
.
setBackgroundColor
(
Color
.
YELLOW
);
mFragment
=
new
New
FlutterFragment
.
NewEngineFragmentBuilder
().
url
(
"flutterFragment"
).
build
();
mFragment
=
new
FlutterFragment
.
NewEngineFragmentBuilder
().
url
(
"flutterFragment"
).
build
();
}
else
if
(
mTab3
==
v
)
{
mTab3
.
setBackgroundColor
(
Color
.
YELLOW
);
mFragment
=
new
New
FlutterFragment
.
NewEngineFragmentBuilder
().
url
(
"flutterFragment"
).
build
();
mFragment
=
new
FlutterFragment
.
NewEngineFragmentBuilder
().
url
(
"flutterFragment"
).
build
();
}
else
{
mTab4
.
setBackgroundColor
(
Color
.
YELLOW
);
mFragment
=
new
New
FlutterFragment
.
NewEngineFragmentBuilder
().
url
(
"flutterFragment"
).
build
();
mFragment
=
new
FlutterFragment
.
NewEngineFragmentBuilder
().
url
(
"flutterFragment"
).
build
();
}
getSupportFragmentManager
()
...
...
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/MyApplication.java
View file @
903b9f7a
...
...
@@ -27,7 +27,7 @@ public class MyApplication extends Application {
};
NewFlutterBoost
.
BoostLifecycleListener
lifecycleListener
=
new
New
FlutterBoost
.
BoostLifecycleListener
()
{
FlutterBoost
.
BoostLifecycleListener
lifecycleListener
=
new
FlutterBoost
.
BoostLifecycleListener
()
{
@Override
public
void
onEngineCreated
()
{
...
...
@@ -35,9 +35,9 @@ public class MyApplication extends Application {
@Override
public
void
onPluginsRegistered
()
{
MethodChannel
mMethodChannel
=
new
MethodChannel
(
New
FlutterBoost
.
instance
().
engineProvider
().
getDartExecutor
(),
"methodChannel"
);
MethodChannel
mMethodChannel
=
new
MethodChannel
(
FlutterBoost
.
instance
().
engineProvider
().
getDartExecutor
(),
"methodChannel"
);
Log
.
e
(
"MyApplication"
,
"MethodChannel create"
);
TextPlatformViewPlugin
.
register
(
New
FlutterBoost
.
instance
().
getPluginRegistry
().
registrarFor
(
"TextPlatformViewPlugin"
));
TextPlatformViewPlugin
.
register
(
FlutterBoost
.
instance
().
getPluginRegistry
().
registrarFor
(
"TextPlatformViewPlugin"
));
}
...
...
@@ -46,15 +46,15 @@ public class MyApplication extends Application {
}
};
Platform
platform
=
new
New
FlutterBoost
Platform
platform
=
new
FlutterBoost
.
ConfigBuilder
(
this
,
router
)
.
isDebug
(
true
)
.
whenEngineStart
(
New
FlutterBoost
.
ConfigBuilder
.
ANY_ACTIVITY_CREATED
)
.
whenEngineStart
(
FlutterBoost
.
ConfigBuilder
.
ANY_ACTIVITY_CREATED
)
.
renderMode
(
FlutterView
.
RenderMode
.
texture
)
.
lifecycleListener
(
lifecycleListener
)
.
build
();
New
FlutterBoost
.
instance
().
init
(
platform
);
FlutterBoost
.
instance
().
init
(
platform
);
...
...
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/PageRouter.java
View file @
903b9f7a
...
...
@@ -2,9 +2,8 @@ package com.taobao.idlefish.flutterboostexample;
import
android.content.Context
;
import
android.content.Intent
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
com.idlefish.flutterboost.containers.
New
BoostFlutterActivity
;
import
com.idlefish.flutterboost.containers.BoostFlutterActivity
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -37,8 +36,8 @@ public class PageRouter {
try
{
if
(
pageName
.
containsKey
(
path
))
{
Intent
intent
=
New
BoostFlutterActivity
.
withNewEngine
().
url
(
pageName
.
get
(
path
)).
params
(
params
)
.
backgroundMode
(
New
BoostFlutterActivity
.
BackgroundMode
.
opaque
).
build
(
context
);
Intent
intent
=
BoostFlutterActivity
.
withNewEngine
().
url
(
pageName
.
get
(
path
)).
params
(
params
)
.
backgroundMode
(
BoostFlutterActivity
.
BackgroundMode
.
opaque
).
build
(
context
);
context
.
startActivity
(
intent
);
...
...
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