Skip to content

Commit

Permalink
Merge branch 'feature/example' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinGong2013 committed Nov 27, 2020
2 parents 7fb3e1a + 168388e commit b80cb85
Show file tree
Hide file tree
Showing 65 changed files with 1,263 additions and 1,263 deletions.
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"cSpell.words": [
"ARGB",
"BUPT",
"Dealloc",
"Podfile",
"Scrollable",
"cocoapod",
"cocoapods",
"executables",
"fullscreen",
"recase"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import io.flutter.embedding.android.RenderMode
import io.flutter.embedding.android.SplashScreen
import io.flutter.embedding.android.TransparencyMode
import io.flutter.embedding.android.XFlutterFragment
Expand Down Expand Up @@ -64,10 +65,12 @@ class FaradayFragment : XFlutterFragment(), ResultProvider {
Faraday.plugin?.onPageShow(pageId)
}

override fun getRenderMode(): RenderMode {
return RenderMode.texture
}

override fun getTransparencyMode(): TransparencyMode {
val bm = arguments?.getString(ARG_FLUTTERVIEW_TRANSPARENCY_MODE)
return if (bm == TransparencyMode.transparent.name)
TransparencyMode.transparent else TransparencyMode.opaque
return TransparencyMode.transparent
}

override fun provideFlutterEngine(context: Context): FlutterEngine? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import android.content.Intent;
import android.graphics.Color;
import android.graphics.PixelFormat;
import android.net.IpSecManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
Expand Down Expand Up @@ -183,10 +184,8 @@ void detach() {

reattachView = reAttachSplashScreen.createSplashView(getAppComponent(), null);

flutterView.convertToImageView();

flutterSplashView.addView(reattachView);
// flutterSplashView.removeView(flutterView);
flutterSplashView.removeView(flutterView);
}

boolean isDetached() {
Expand All @@ -199,23 +198,26 @@ void reattach() {
assert flutterSplashView != null;
assert flutterEngine != null;

Log.i(TAG, "reattach " + flutterView.toString());
Log.w(TAG, "reattach " + flutterView.toString());

flutterView.revertImageView(new Runnable() {
@Override
public void run() {
flutterSplashView.removeView(reattachView);
}
});
flutterSplashView.displayFlutterViewWithSplash(flutterView, host.provideSplashScreen());
flutterSplashView.displayFlutterViewWithSplash(flutterView, reAttachSplashScreen);

onAttach(host.getContext());
flutterEngine.getLifecycleChannel().appIsResumed();

flutterView.addOnFirstFrameRenderedListener(flutterUiDisplayListener);
flutterView.attachToFlutterEngine(flutterEngine);

flutterEngine.getLifecycleChannel().appIsResumed();

if (reattachView != null) {
// 减少 fragment 切换时的黑屏, 如果你的页面在1s 钟还没有渲染完成,请检查页面逻辑
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
flutterSplashView.removeView(reattachView);
}
}, 1000);
}
}

/**
Expand Down Expand Up @@ -661,27 +663,29 @@ void onDetach() {
assert flutterEngine != null;
host.cleanUpFlutterEngine(flutterEngine);

if (host.shouldAttachEngineToActivity()) {
// Notify plugins that they are no longer attached to an Activity.
Log.v(TAG, "Detaching FlutterEngine from the Activity that owns this Fragment.");
if (Objects.requireNonNull(host.getActivity()).isChangingConfigurations()) {
flutterEngine.getActivityControlSurface().detachFromActivityForConfigChanges();
} else {
flutterEngine.getActivityControlSurface().detachFromActivity();
}
}
// if (host.shouldAttachEngineToActivity()) {
// // Notify plugins that they are no longer attached to an Activity.
// Log.v(TAG, "Detaching FlutterEngine from the Activity that owns this Fragment.");
// if (Objects.requireNonNull(host.getActivity()).isChangingConfigurations()) {
// flutterEngine.getActivityControlSurface().detachFromActivityForConfigChanges();
// } else {
// flutterEngine.getActivityControlSurface().detachFromActivity();
// }
// }

// Null out the platformPlugin to avoid a possible retain cycle between the plugin, this
// Fragment,
// and this Fragment's Activity.
if (platformPlugin != null) {
platformPlugin.destroy();
// platformPlugin.destroy();
platformPlugin = null;
}

flutterEngine.getLifecycleChannel().appIsDetached();

// Destroy our FlutterEngine if we're not set to retain it.
// flutterEngine.getLifecycleChannel().appIsDetached();


// Destroy our FlutterEngine if we're not set to retain it.
if (host.shouldDestroyEngineWithHost()) {
flutterEngine.destroy();

Expand Down
Loading

0 comments on commit b80cb85

Please sign in to comment.