Commit 8d103553 authored by Yacumima's avatar Yacumima

improve

parent a84df93a
......@@ -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 = "FlutterBoostPlugin"
artifactId = "FlutterBoost"
}
<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>
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);
}
}
......@@ -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 = FlutterBoostPlugin.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 = FlutterBoostPlugin.singleton().engineProvider().tryGetEngine();
final BoostFlutterEngine engine = FlutterBoost.singleton().engineProvider().tryGetEngine();
if(engine == null || !engine.isRunning()) {
throw new RuntimeException("engine is not running yet!");
}
......
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 = FlutterBoostPlugin.sInstance.mStateListener;
final IStateListener stateListener = FlutterBoost.sInstance.mStateListener;
if(stateListener != null) {
stateListener.onEngineStarted(this);
}
FlutterBoostPlugin.singleton().platform().registerPlugins(mBoostPluginRegistry);
FlutterBoost.singleton().platform().registerPlugins(mBoostPluginRegistry);
}
}
......@@ -92,13 +92,13 @@ public class BoostFlutterEngine extends FlutterEngine {
Activity activity;
IContainerRecord record;
record = FlutterBoostPlugin.singleton().containerManager().getCurrentTopRecord();
record = FlutterBoost.singleton().containerManager().getCurrentTopRecord();
if(record == null) {
record = FlutterBoostPlugin.singleton().containerManager().getLastGenerateRecord();
record = FlutterBoost.singleton().containerManager().getLastGenerateRecord();
}
if(record == null){
activity = FlutterBoostPlugin.singleton().currentActivity();
activity = FlutterBoost.singleton().currentActivity();
}else{
activity = record.getContainer().getContextActivity();
}
......
......@@ -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 = FlutterBoostPlugin.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 FlutterBoostPlugin.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 = FlutterBoostPlugin.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 = FlutterBoostPlugin.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
......
......@@ -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);
FlutterBoostPlugin.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);
FlutterBoostPlugin.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);
FlutterBoostPlugin.singleton().channel().invokeMethodUnsafe(method, args);
FlutterBoost.singleton().channel().invokeMethodUnsafe(method, args);
}
}
}
......@@ -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 FlutterBoostPlugin.singleton().platform().isDebug();
return FlutterBoost.singleton().platform().isDebug();
}catch (Throwable t){
return false;
}
......
......@@ -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 FlutterBoostPlugin(platform);
sInstance = new FlutterBoost(platform);
}
if (platform.whenEngineStart() == IPlatform.IMMEDIATELY) {
......@@ -60,32 +58,33 @@ public class FlutterBoostPlugin {
}
}
public static FlutterBoostPlugin 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 FlutterBoostPlugin(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;
}
......
......@@ -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 = FlutterBoostPlugin.singleton().currentActivity();
Context context = FlutterBoost.singleton().currentActivity();
if(context == null) {
context = FlutterBoostPlugin.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);
}
FlutterBoostPlugin.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);
}
FlutterBoostPlugin.singleton().platform().closeContainer(targetRecord,result,exts);
FlutterBoost.singleton().platform().closeContainer(targetRecord,result,exts);
return targetRecord;
}
......
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;
......
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");
......
......@@ -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 {
......
......@@ -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 = FlutterBoostPlugin.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 FlutterBoostPlugin.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.surface)
.renderMode(FlutterView.RenderMode.texture)
.transparencyMode(isBackgroundTransparent() ?
FlutterView.TransparencyMode.transparent :
FlutterView.TransparencyMode.opaque)
......
......@@ -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 = FlutterBoostPlugin.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 FlutterBoostPlugin.singleton().engineProvider().createEngine(getContext());
return FlutterBoost.singleton().engineProvider().createEngine(getContext());
}
protected BoostFlutterView createFlutterView(BoostFlutterEngine engine){
......
......@@ -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;
......
......@@ -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
......
......@@ -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
*/
......
......@@ -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;
......
package com.taobao.idlefish.flutterboost.interfaces;
package com.idlefish.flutterboost.interfaces;
import android.content.Intent;
......
......@@ -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;
......
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);
......
......@@ -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
......
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层有注册函数:
* FlutterBoostPlugin.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层有注册函数:
* FlutterBoostPlugin.singleton.registerPageBuilders({
* FlutterBoost.singleton.registerPageBuilders({
* 'first': (pageName, params, _) => FirstRouteWidget(),
* 'second': (pageName, params, _) => SecondRouteWidget(),
* ...
......
......@@ -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();
FlutterBoostPlugin.init(new Platform() {
FlutterBoost.init(new Platform() {
@Override
public Application getApplication() {
......
......@@ -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"]];
}
......
......@@ -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:
......
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