Skip to content

Commit 3042829

Browse files
hunterstichdrchen
authored andcommitted
[Catalog] Deleted BottomWindowInsetsView and replaced with setOnApplyWindowInsetsListener
PiperOrigin-RevId: 777568229
1 parent b84b335 commit 3042829

File tree

5 files changed

+22
-90
lines changed

5 files changed

+22
-90
lines changed

catalog/java/io/material/catalog/fab/ExtendedFabDemoFragment.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
import android.widget.Button;
2626
import androidx.annotation.LayoutRes;
2727
import androidx.annotation.Nullable;
28+
import androidx.core.graphics.Insets;
29+
import androidx.core.view.ViewCompat;
30+
import androidx.core.view.WindowInsetsCompat;
2831
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
2932
import com.google.android.material.snackbar.Snackbar;
3033
import io.material.catalog.feature.DemoFragment;
@@ -45,6 +48,14 @@ public View onCreateDemoView(
4548
layoutInflater.inflate(
4649
R.layout.cat_extended_fab_fragment, viewGroup, false /* attachToRoot */);
4750

51+
ViewCompat.setOnApplyWindowInsetsListener(
52+
root,
53+
(v, insets) -> {
54+
Insets navBarInsets = insets.getInsets(WindowInsetsCompat.Type.navigationBars());
55+
v.setPadding(0, 0, 0, navBarInsets.bottom);
56+
return insets;
57+
});
58+
4859
ViewGroup content = root.findViewById(R.id.content);
4960
View.inflate(getContext(), getExtendedFabContent(), content);
5061

catalog/java/io/material/catalog/fab/FabMainDemoFragment.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
import android.widget.Button;
2727
import androidx.annotation.LayoutRes;
2828
import androidx.annotation.Nullable;
29+
import androidx.core.graphics.Insets;
30+
import androidx.core.view.ViewCompat;
31+
import androidx.core.view.WindowInsetsCompat;
2932
import com.google.android.material.floatingactionbutton.FloatingActionButton;
3033
import com.google.android.material.snackbar.Snackbar;
3134
import io.material.catalog.feature.DemoFragment;
@@ -43,6 +46,14 @@ public View onCreateDemoView(
4346
View view =
4447
layoutInflater.inflate(R.layout.cat_fab_fragment, viewGroup, false /* attachToRoot */);
4548

49+
ViewCompat.setOnApplyWindowInsetsListener(
50+
view,
51+
(v, insets) -> {
52+
Insets navBarInsets = insets.getInsets(WindowInsetsCompat.Type.navigationBars());
53+
v.setPadding(0, 0, 0, navBarInsets.bottom);
54+
return insets;
55+
});
56+
4657
ViewGroup content = view.findViewById(R.id.content);
4758
View.inflate(getContext(), getFabsContent(), content);
4859
View.inflate(getContext(), getThemeFabLayoutResId(), content);

catalog/java/io/material/catalog/fab/res/layout/cat_extended_fab_fragment.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,4 @@
5454
android:layout_margin="8dp"
5555
android:text="@string/shrink_fabs_label"/>
5656
</LinearLayout>
57-
58-
<io.material.catalog.feature.BottomWindowInsetView
59-
android:layout_width="match_parent"
60-
android:layout_height="0dp" />
6157
</LinearLayout>

catalog/java/io/material/catalog/fab/res/layout/cat_fab_fragment.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,4 @@
6161
android:text="@string/rotate_fabs_label"/>
6262
</LinearLayout>
6363

64-
65-
<io.material.catalog.feature.BottomWindowInsetView
66-
android:layout_width="wrap_content"
67-
android:layout_height="0dp"
68-
/>
69-
7064
</LinearLayout>

catalog/java/io/material/catalog/feature/BottomWindowInsetView.java

Lines changed: 0 additions & 80 deletions
This file was deleted.

0 commit comments

Comments
 (0)