Commit 903b9f7a authored by yangwu.jia's avatar yangwu.jia

更改名字

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