Skip to content

Commit

Permalink
[FAB] Combined Small, Regular, and Large styles in one catalog fragment.
Browse files Browse the repository at this point in the history
Cleaned up unused string res.

PiperOrigin-RevId: 453304787
  • Loading branch information
pekingme committed Jun 7, 2022
1 parent c5b37e6 commit ab04c9c
Show file tree
Hide file tree
Showing 12 changed files with 221 additions and 369 deletions.
Expand Up @@ -93,6 +93,6 @@ public View onCreateDemoView(

@LayoutRes
protected int getExtendedFabContent() {
return R.layout.mtrl_extended_fabs;
return R.layout.m3_extended_fabs;
}
}
7 changes: 0 additions & 7 deletions catalog/java/io/material/catalog/fab/FabFragment.java
Expand Up @@ -70,13 +70,6 @@ public Fragment createFragment() {
return new ExtendedFabBehaviorDemoFragment();
}
});
additionalDemos.add(
new Demo(R.string.m3_large_fab_demo_title) {
@Override
public Fragment createFragment() {
return new LargeFabDemoFragment();
}
});
return additionalDemos;
}

Expand Down
4 changes: 2 additions & 2 deletions catalog/java/io/material/catalog/fab/FabMainDemoFragment.java
Expand Up @@ -95,11 +95,11 @@ public View onCreateDemoView(

@LayoutRes
protected int getFabsContent() {
return R.layout.mtrl_fabs;
return R.layout.m3_fabs;
}

@LayoutRes
protected int getThemeFabLayoutResId() {
return R.layout.theme_fab;
return R.layout.m3_theme_fab;
}
}
36 changes: 0 additions & 36 deletions catalog/java/io/material/catalog/fab/LargeFabDemoFragment.java

This file was deleted.

Expand Up @@ -24,15 +24,16 @@
android:orientation="vertical">

<ScrollView
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<GridLayout
android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:columnCount="3"
android:rowCount="5">
android:rowCount="12">
</GridLayout>
</ScrollView>

Expand Down
Expand Up @@ -30,7 +30,7 @@
android:layout_height="wrap_content"
android:layout_marginRight="24dp"
android:layout_gravity="start|center"
android:text="@string/m3_surface_fab_label" />
android:text="@string/m3_surface_extended_fab_label" />
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
style="?attr/extendedFloatingActionButtonSurfaceStyle"
android:layout_width="wrap_content"
Expand All @@ -46,7 +46,7 @@
android:layout_height="wrap_content"
android:layout_marginRight="24dp"
android:layout_gravity="start|center"
android:text="@string/m3_primary_fab_label" />
android:text="@string/m3_primary_extended_fab_label" />
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
style="?attr/extendedFloatingActionButtonPrimaryStyle"
android:layout_width="wrap_content"
Expand All @@ -62,7 +62,7 @@
android:layout_height="wrap_content"
android:layout_marginRight="24dp"
android:layout_gravity="start|center"
android:text="@string/m3_secondary_fab_label" />
android:text="@string/m3_secondary_extended_fab_label" />
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
style="?extendedFloatingActionButtonSecondaryStyle"
android:layout_width="wrap_content"
Expand All @@ -78,7 +78,7 @@
android:layout_height="wrap_content"
android:layout_marginRight="24dp"
android:layout_gravity="start|center"
android:text="@string/m3_tertiary_fab_label" />
android:text="@string/m3_tertiary_extended_fab_label" />
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
style="?attr/extendedFloatingActionButtonTertiaryStyle"
android:layout_width="wrap_content"
Expand Down
157 changes: 157 additions & 0 deletions catalog/java/io/material/catalog/fab/res/layout/m3_fabs.xml
@@ -0,0 +1,157 @@
<?xml version="1.0" encoding="utf-8"?>

<!--
Copyright 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!-- Padding is used to avoid clipping the FAB's shadows. This is not normally necessary for
full-screen containers. -->


<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clipToPadding="false"
tools:parentTag="android.widget.GridLayout">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_columnSpan="3"
android:text="@string/m3_surface_fab_label"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
style="?attr/floatingActionButtonSurfaceStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_gravity="center"
android:contentDescription="@string/m3_surface_fab_content_desc"
app:srcCompat="@drawable/ic_add_24px"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
style="?attr/floatingActionButtonSmallSurfaceStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_gravity="center"
android:contentDescription="@string/m3_surface_small_fab_content_desc"
app:srcCompat="@drawable/ic_add_24px"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
style="?attr/floatingActionButtonLargeSurfaceStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_gravity="center"
android:contentDescription="@string/m3_surface_large_fab_content_desc"
app:srcCompat="@drawable/ic_add_24px" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_gravity="center"
android:layout_columnSpan="3"
android:text="@string/m3_primary_fab_label"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
style="?attr/floatingActionButtonPrimaryStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_gravity="center"
android:contentDescription="@string/m3_primary_fab_content_desc"
app:srcCompat="@drawable/ic_add_24px"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
style="?attr/floatingActionButtonSmallPrimaryStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_gravity="center"
android:contentDescription="@string/m3_primary_small_fab_content_desc"
app:srcCompat="@drawable/ic_add_24px"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
style="?attr/floatingActionButtonLargePrimaryStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_gravity="center"
android:contentDescription="@string/m3_primary_large_fab_content_desc"
app:srcCompat="@drawable/ic_add_24px" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_gravity="center"
android:layout_columnSpan="3"
android:text="@string/m3_secondary_fab_label"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
style="?attr/floatingActionButtonSecondaryStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_gravity="center"
android:contentDescription="@string/m3_secondary_fab_content_desc"
app:srcCompat="@drawable/ic_add_24px"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
style="?attr/floatingActionButtonSmallSecondaryStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_gravity="center"
android:contentDescription="@string/m3_secondary_small_fab_content_desc"
app:srcCompat="@drawable/ic_add_24px"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
style="?attr/floatingActionButtonLargeSecondaryStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_gravity="center"
android:contentDescription="@string/m3_secondary_large_fab_content_desc"
app:srcCompat="@drawable/ic_add_24px" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_gravity="center"
android:layout_columnSpan="3"
android:text="@string/m3_tertiary_fab_label"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
style="?attr/floatingActionButtonTertiaryStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_gravity="center"
android:contentDescription="@string/m3_tertiary_fab_content_desc"
app:srcCompat="@drawable/ic_add_24px"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
style="?attr/floatingActionButtonSmallTertiaryStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_gravity="center"
android:contentDescription="@string/m3_tertiary_small_fab_content_desc"
app:srcCompat="@drawable/ic_add_24px"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
style="?attr/floatingActionButtonLargeTertiaryStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_gravity="center"
android:contentDescription="@string/m3_tertiary_large_fab_content_desc"
app:srcCompat="@drawable/ic_add_24px" />
</merge>
92 changes: 0 additions & 92 deletions catalog/java/io/material/catalog/fab/res/layout/m3_large_fabs.xml

This file was deleted.

0 comments on commit ab04c9c

Please sign in to comment.