Commit eb70610b authored by justin's avatar justin

Merge branch 'master' into v1.12.13-hotfixes

parents 9c0fda37 1e5631a5
...@@ -133,7 +133,7 @@ public class FlutterViewContainerManager implements IContainerManager { ...@@ -133,7 +133,7 @@ public class FlutterViewContainerManager implements IContainerManager {
urlParams.put(IContainerRecord.UNIQ_KEY,uniqueId); urlParams.put(IContainerRecord.UNIQ_KEY,uniqueId);
IContainerRecord currentTopRecord = getCurrentTopRecord(); IContainerRecord currentTopRecord = getCurrentTopRecord();
if(onResult != null) { if(onResult != null&&currentTopRecord!=null) {
mOnResults.put(currentTopRecord.uniqueId(),onResult); mOnResults.put(currentTopRecord.uniqueId(),onResult);
} }
......
...@@ -127,12 +127,15 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer ...@@ -127,12 +127,15 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
@NonNull @NonNull
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
Log.v(TAG, "Creating FlutterView."); Log.v(TAG, "Creating FlutterView.");
flutterEngine.getActivityControlSurface().attachToActivity( flutterEngine.getActivityControlSurface().attachToActivity(
host.getActivity(), host.getActivity(),
host.getLifecycle() host.getLifecycle()
); );
mSyncer = FlutterBoost.instance().containerManager().generateSyncer(this); mSyncer = FlutterBoost.instance().containerManager().generateSyncer(this);
ensureAlive(); ensureAlive();
...@@ -188,7 +191,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer ...@@ -188,7 +191,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
public void onPostResume() { public void onPostResume() {
Log.v(TAG, "onPostResume()"); Log.v(TAG, "onPostResume()");
ensureAlive(); ensureAlive();
Utils.setStatusBarLightMode(host.getActivity(), true); // Utils.setStatusBarLightMode(host.getActivity(), true);
} }
......
...@@ -14,6 +14,7 @@ import androidx.fragment.app.Fragment; ...@@ -14,6 +14,7 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
import com.idlefish.flutterboost.FlutterBoost; import com.idlefish.flutterboost.FlutterBoost;
import com.idlefish.flutterboost.Utils;
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;
...@@ -252,17 +253,9 @@ public class FlutterFragment extends Fragment implements FlutterActivityAndFragm ...@@ -252,17 +253,9 @@ public class FlutterFragment extends Fragment implements FlutterActivityAndFragm
@Nullable @Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
configureStatusBarForFullscreenFlutterExperience();
return delegate.onCreateView(inflater, container, savedInstanceState); return delegate.onCreateView(inflater, container, savedInstanceState);
} }
private void configureStatusBarForFullscreenFlutterExperience() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = this.getActivity().getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
window.getDecorView().setSystemUiVisibility(PlatformPlugin.DEFAULT_SYSTEM_UI | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
}
@Override @Override
public void onStart() { public void onStart() {
...@@ -278,6 +271,7 @@ public class FlutterFragment extends Fragment implements FlutterActivityAndFragm ...@@ -278,6 +271,7 @@ public class FlutterFragment extends Fragment implements FlutterActivityAndFragm
if (!isHidden()) { if (!isHidden()) {
delegate.onResume(); delegate.onResume();
} }
} }
// TODO(mattcarroll): determine why this can't be in onResume(). Comment reason, or move if possible. // TODO(mattcarroll): determine why this can't be in onResume(). Comment reason, or move if possible.
......
package com.taobao.idlefish.flutterboostexample;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import androidx.annotation.NonNull;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowInsets;
import android.widget.FrameLayout;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.core.view.ViewCompat;
public class FitSystemWindowFrameLayout extends FrameLayout {
public FitSystemWindowFrameLayout( @NonNull Context context) {
super(context);
}
public FitSystemWindowFrameLayout( @NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public FitSystemWindowFrameLayout( @NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public FitSystemWindowFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public WindowInsets dispatchApplyWindowInsets(WindowInsets insets) {
WindowInsets result = super.dispatchApplyWindowInsets(insets);
if (!insets.isConsumed()) {
final int count = getChildCount();
for (int i = 0; i < count; i++)
result = getChildAt(i).dispatchApplyWindowInsets(insets);
}
return result;
}
@Override
public void addView(View child, int index, ViewGroup.LayoutParams params) {
super.addView(child, index, params);
ViewCompat.requestApplyInsets(child);
}
}
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
android:orientation="vertical" android:orientation="vertical"
android:background="@android:color/white"> android:background="@android:color/white">
<FrameLayout <com.taobao.idlefish.flutterboostexample.FitSystemWindowFrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
......
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