Skip to content

Commit 660230a

Browse files
committed
allow styling of buttons
1 parent 6fe5f8e commit 660230a

9 files changed

+36
-28
lines changed

ui/src/main/res/layout/snabble_dialog_product_confirmation.xml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -79,33 +79,34 @@
7979
tools:text="+ 0,45 € deposit" />
8080

8181
<Button
82-
style="@style/Widget.MaterialComponents.Button.TextButton"
8382
android:id="@+id/enterReducedPrice"
83+
style="@style/Snabble.Widget.MaterialComponents.Button.TextButton"
8484
android:layout_width="wrap_content"
8585
android:layout_height="wrap_content"
8686
android:layout_below="@+id/depositPrice"
8787
android:layout_centerHorizontal="true"
8888
android:layout_marginBottom="-16dp"
8989
android:textSize="14sp"
9090
tools:text="Reduzierten Preis eingeben"
91-
tools:textColor="#c40000"/>
91+
tools:textColor="#c40000" />
9292

93-
<Button style="@style/Widget.MaterialComponents.Button.OutlinedButton.Icon"
93+
<Button
9494
android:id="@+id/minus"
95+
style="@style/Snabble.Widget.MaterialComponents.Button.OutlinedButton.Icon"
9596
android:layout_width="48dp"
9697
android:layout_height="48dp"
9798
android:layout_below="@+id/enterReducedPrice"
9899
android:layout_centerHorizontal="true"
99-
android:layout_marginTop="24dp"
100+
android:layout_marginTop="16dp"
100101
android:layout_marginEnd="8dp"
101102
android:layout_toStartOf="@+id/quantity_text_input"
102103
android:insetLeft="0dp"
103-
android:insetRight="0dp"
104104
android:insetTop="0dp"
105+
android:insetRight="0dp"
105106
android:insetBottom="0dp"
107+
app:icon="@drawable/snabble_ic_minus_content"
106108
app:iconTint="?attr/colorOnSurface"
107-
app:strokeColor="@drawable/snabble_stroke"
108-
app:icon="@drawable/snabble_ic_minus_content" />
109+
app:strokeColor="@drawable/snabble_stroke" />
109110

110111
<com.google.android.material.textfield.TextInputLayout
111112
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
@@ -120,7 +121,7 @@
120121
app:boxStrokeColor="@drawable/snabble_stroke"
121122
android:layout_below="@+id/enterReducedPrice"
122123
android:layout_centerHorizontal="true"
123-
android:layout_marginTop="24dp">
124+
android:layout_marginTop="16dp">
124125

125126
<com.google.android.material.textfield.TextInputEditText
126127
android:id="@+id/quantity"
@@ -135,13 +136,13 @@
135136

136137
</com.google.android.material.textfield.TextInputLayout>
137138

138-
<Button style="@style/Widget.MaterialComponents.Button.OutlinedButton.Icon"
139+
<Button style="@style/Snabble.Widget.MaterialComponents.Button.OutlinedButton.Icon"
139140
android:id="@+id/plus"
140141
android:layout_width="48dp"
141142
android:layout_height="48dp"
142143
android:layout_below="@+id/enterReducedPrice"
143144
android:layout_centerHorizontal="true"
144-
android:layout_marginTop="24dp"
145+
android:layout_marginTop="16dp"
145146
android:layout_marginStart="8dp"
146147
android:insetLeft="0dp"
147148
android:insetRight="0dp"
@@ -169,17 +170,18 @@
169170

170171
<Button
171172
android:id="@+id/addToCart"
173+
style="@style/Snabble.Widget.MaterialComponents.Button"
172174
android:layout_width="match_parent"
173-
android:layout_height="56dp"
175+
android:layout_height="wrap_content"
176+
android:layout_below="@+id/quantity_text_input"
177+
android:layout_centerHorizontal="true"
174178
android:layout_marginLeft="16dp"
179+
android:layout_marginTop="16dp"
175180
android:layout_marginRight="16dp"
176-
android:layout_marginTop="24dp"
177-
app:autoSizeTextType="uniform"
178-
app:autoSizeMinTextSize="8sp"
181+
android:text="@string/Snabble.Scanner.addToCart"
179182
app:autoSizeMaxTextSize="14sp"
180-
android:layout_below="@+id/quantity_text_input"
181-
android:layout_centerHorizontal="true"
182-
android:text="@string/Snabble.Scanner.addToCart" />
183+
app:autoSizeMinTextSize="8sp"
184+
app:autoSizeTextType="uniform" />
183185

184186

185187
<!-- invisible view as a margin, marginBottom does not work on API 16-18 -->

ui/src/main/res/layout/snabble_item_shoppingcart_product.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494

9595
<Button
9696
android:id="@+id/minus"
97-
style="@style/Widget.MaterialComponents.Button.OutlinedButton.Icon"
97+
style="@style/Snabble.Widget.MaterialComponents.Button.OutlinedButton.Icon"
9898
android:layout_width="36dp"
9999
android:layout_height="36dp"
100100
android:insetLeft="0dp"
@@ -121,7 +121,7 @@
121121

122122
<Button
123123
android:id="@+id/plus"
124-
style="@style/Widget.MaterialComponents.Button.OutlinedButton.Icon"
124+
style="@style/Snabble.Widget.MaterialComponents.Button.OutlinedButton.Icon"
125125
android:layout_width="36dp"
126126
android:layout_height="36dp"
127127
android:insetLeft="0dp"
@@ -185,7 +185,7 @@
185185

186186
<Button
187187
android:id="@+id/quantity_edit_apply"
188-
style="@style/Widget.MaterialComponents.Button.Icon"
188+
style="@style/Snabble.Widget.MaterialComponents.Button.Icon"
189189
android:layout_width="36dp"
190190
android:layout_height="36dp"
191191
android:layout_gravity="center_vertical"

ui/src/main/res/layout/snabble_view_checkout_bar.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
android:clipChildren="false"
5050
android:layout_marginStart="16dp">
5151

52-
<Button style="@style/Widget.MaterialComponents.Button.OutlinedButton"
52+
<Button style="@style/Snabble.Widget.MaterialComponents.Button.OutlinedButton"
5353
android:id="@+id/payment_selector_button"
5454
android:layout_width="match_parent"
5555
android:layout_height="match_parent"
@@ -84,7 +84,7 @@
8484
</LinearLayout>
8585
</FrameLayout>
8686

87-
<Button
87+
<Button style="@style/Snabble.Widget.MaterialComponents.Button"
8888
android:id="@+id/pay"
8989
android:layout_width="match_parent"
9090
android:layout_height="48dp"

ui/src/main/res/layout/snabble_view_checkout_gatekeeper.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
android:layout_alignParentBottom="true"
8787
android:layout_centerHorizontal="true">
8888
<Button
89-
style="@style/Widget.MaterialComponents.Button.TextButton"
89+
style="@style/Snabble.Widget.MaterialComponents.Button.TextButton"
9090
android:id="@+id/cancel"
9191
android:layout_width="wrap_content"
9292
android:layout_height="wrap_content"

ui/src/main/res/layout/snabble_view_checkout_online.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
android:layout_alignParentBottom="true"
108108
android:layout_centerHorizontal="true">
109109
<Button
110-
style="@style/Widget.MaterialComponents.Button.TextButton"
110+
style="@style/Snabble.Widget.MaterialComponents.Button.TextButton"
111111
android:id="@+id/cancel"
112112
android:layout_width="wrap_content"
113113
android:layout_height="wrap_content"

ui/src/main/res/layout/snabble_view_checkout_pos.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
android:textSize="14sp" />
6868

6969
<Button
70-
style="@style/Widget.MaterialComponents.Button.TextButton"
70+
style="@style/Snabble.Widget.MaterialComponents.Button.TextButton"
7171
android:id="@+id/abort"
7272
android:layout_width="wrap_content"
7373
android:layout_height="wrap_content"

ui/src/main/res/layout/snabble_view_search_product.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
android:layout_below="@+id/search_bar_layout"
2929
android:id="@+id/recycler_view" />
3030

31-
<Button style="@style/Widget.MaterialComponents.Button.TextButton"
31+
<Button style="@style/Snabble.Widget.MaterialComponents.Button.TextButton"
3232
android:id="@+id/add_code_as_is"
3333
android:layout_width="wrap_content"
3434
android:layout_height="wrap_content"

ui/src/main/res/layout/snabble_view_shopping_cart.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@
6161
android:gravity="center"
6262
android:text="@string/Snabble.Shoppingcart.emptyState.description" />
6363

64-
<Button style="@style/Widget.MaterialComponents.Button.TextButton"
64+
<Button style="@style/Snabble.Widget.MaterialComponents.Button.TextButton"
6565
android:id="@+id/scan_products"
6666
android:layout_width="wrap_content"
6767
android:layout_height="wrap_content"
6868
android:layout_marginTop="16dp"
6969
android:gravity="center"
7070
android:text="@string/Snabble.Shoppingcart.emptyState.buttonTitle" />
7171

72-
<Button style="@style/Widget.MaterialComponents.Button.TextButton"
72+
<Button style="@style/Snabble.Widget.MaterialComponents.Button.TextButton"
7373
android:id="@+id/restore"
7474
android:layout_width="wrap_content"
7575
android:layout_height="wrap_content"

ui/src/main/res/values/styles.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,10 @@
44
<item name="cornerFamily">rounded</item>
55
<item name="cornerSize">4dp</item>
66
</style>
7+
8+
<style name="Snabble.Widget.MaterialComponents.Button" parent="Widget.MaterialComponents.Button" />
9+
<style name="Snabble.Widget.MaterialComponents.Button.TextButton" parent="Widget.MaterialComponents.Button.TextButton" />
10+
<style name="Snabble.Widget.MaterialComponents.Button.Icon" parent="Widget.MaterialComponents.Button.Icon" />
11+
<style name="Snabble.Widget.MaterialComponents.Button.OutlinedButton" parent="Widget.MaterialComponents.Button.OutlinedButton" />
12+
<style name="Snabble.Widget.MaterialComponents.Button.OutlinedButton.Icon" parent="Widget.MaterialComponents.Button.OutlinedButton.Icon" />
713
</resources>

0 commit comments

Comments
 (0)