Skip to content

Commit

Permalink
Merge pull request #5814 from seadowg/outlined-button
Browse files Browse the repository at this point in the history
Fallback to Material 2 OutlinedButton on API 22
  • Loading branch information
grzesiek2010 authored Oct 31, 2023
2 parents 7dff22a + 533a00b commit b8d4cc8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion collect_app/src/main/res/layout/form_entry_end.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ the specific language governing permissions and limitations under the License.

<com.google.android.material.button.MaterialButton
android:id="@+id/save_as_draft"
style="@style/Widget.Material3.Button.OutlinedButton"
style="@style/Widget.Collect.Material3.Button.OutlinedButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/save_as_draft"
Expand Down
4 changes: 2 additions & 2 deletions collect_app/src/main/res/layout/quit_form_dialog_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<com.google.android.material.button.MaterialButton
android:id="@+id/discard_changes"
style="@style/Widget.Material3.Button.OutlinedButton.Icon"
style="@style/Widget.Collect.Material3.Button.OutlinedButton.Icon"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/margin"
Expand All @@ -35,7 +35,7 @@

<com.google.android.material.button.MaterialButton
android:id="@+id/keep_editing_outlined"
style="@style/Widget.Material3.Button.OutlinedButton.Icon"
style="@style/Widget.Collect.Material3.Button.OutlinedButton.Icon"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/margin_small"
Expand Down
7 changes: 7 additions & 0 deletions collect_app/src/main/res/values-v23/outlined_button.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="Widget.Collect.Material3.Button.OutlinedButton" parent="Widget.Material3.Button.OutlinedButton"></style>

<style name="Widget.Collect.Material3.Button.OutlinedButton.Icon" parent="Widget.Material3.Button.OutlinedButton.Icon"></style>
</resources>
7 changes: 7 additions & 0 deletions collect_app/src/main/res/values/outlined_button.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Material3.Button.OutlinedButton` doesn't work properly on older API levels (22 and under) without a Material 3 theme so we fall back to Material 2 -->
<style name="Widget.Collect.Material3.Button.OutlinedButton" parent="Widget.MaterialComponents.Button.OutlinedButton"></style>

<style name="Widget.Collect.Material3.Button.OutlinedButton.Icon" parent="Widget.MaterialComponents.Button.OutlinedButton"></style>
</resources>

0 comments on commit b8d4cc8

Please sign in to comment.