From 2e3b7f56cfa1ce227d58fcad5229e365df50bda6 Mon Sep 17 00:00:00 2001
From: justin <noborder@qq.com>
Date: Tue, 7 Apr 2020 11:37:25 +0800
Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3fragment=E7=8A=B6=E6=80=81?=
 =?UTF-8?q?=E6=A0=8F=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../FitSystemWindowFrameLayout.java           | 55 +++++++++++++++++++
 .../main/res/layout/flutter_fragment_page.xml |  2 +-
 2 files changed, 56 insertions(+), 1 deletion(-)
 create mode 100644 example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/FitSystemWindowFrameLayout.java

diff --git a/example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/FitSystemWindowFrameLayout.java b/example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/FitSystemWindowFrameLayout.java
new file mode 100644
index 0000000..3129ce6
--- /dev/null
+++ b/example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/FitSystemWindowFrameLayout.java
@@ -0,0 +1,55 @@
+package com.taobao.idlefish.flutterboostexample;
+
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.os.Build;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.support.annotation.RequiresApi;
+import android.support.v4.view.ViewCompat;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.WindowInsets;
+import android.widget.FrameLayout;
+
+
+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);
+    }
+    
+}
diff --git a/example/android/app/src/main/res/layout/flutter_fragment_page.xml b/example/android/app/src/main/res/layout/flutter_fragment_page.xml
index 2e17232..14f4896 100755
--- a/example/android/app/src/main/res/layout/flutter_fragment_page.xml
+++ b/example/android/app/src/main/res/layout/flutter_fragment_page.xml
@@ -5,7 +5,7 @@
     android:orientation="vertical"
     android:background="@android:color/white">
 
-    <FrameLayout
+    <com.taobao.idlefish.flutterboostexample.FitSystemWindowFrameLayout
         android:layout_width="match_parent"
         android:layout_height="0dp"
         android:layout_weight="1"
-- 
2.26.2