You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> **Note:** in v4.0.0 the library was migrated to Jetpack Compose. If you need to old Android View based version, please keep using v3.1.0 instead.
34
+
> **Note:** in v4.0.0 the library was migrated to Jetpack Compose. If you need to old Android View based version, please keep using [v3.1.0](https://github.com/davidmigloz/number-keyboard/tree/3.1.0) instead.
35
35
36
-
####Step 3
36
+
### Step 3
37
37
38
-
Use `NumberKeyboard`composable in your layout:
38
+
#### Use `NumberKeyboard`Composable in your layout:
39
39
40
40
```kotlin
41
41
NumberKeyboard(
@@ -74,6 +74,227 @@ NumberKeyboard(
74
74
)
75
75
```
76
76
77
+
##### Attribute
78
+
79
+
-`maxAllowedAmount` - Double (default: 10_000.0): Maximum amount allowed for the `NumberKeyboard` output
80
+
-`maxAllowedDecimals` - Int (default: 2): Maximum decimal points allowed for the `NumberKeyboard` output
81
+
-`currencySymbol` - String (default: "$"): Currency symbol for the `NumberKeyboardData` currency format output
82
+
-`isInverted` - Boolean (default: false): Default number sequence is the phone number pad sequence, inverted is the calculator number pad sequence
83
+
-`roundUpToMax` - Boolean (default: true): Behaviour to round up to the max allowed amount if amount has exceeded
84
+
-`verticalArrangement` - Arrangement.HorizontalOrVertical (default: 8.dp): Vertical spacing between the buttons
85
+
-`horizontalArrangement` - Arrangement.HorizontalOrVertical (default: 8.dp): Horizontal spacing between the buttons
86
+
-`decimalSeparator` - Char (default: DecimalFormat.decimalFormatSymbols.decimalSeparator): Character for decimal separator
87
+
-`groupingSeparator` - Char (default: DecimalFormat.decimalFormatSymbols.groupingSeparator): Character for grouping separator
88
+
89
+
##### Composable
90
+
91
+
To harness the power and flexibility of Jetpack Compose, `NumberKeyboard` now provides `@Composable` lambdas that gives you control over all the button layouts.
92
+
Thus, you can easily customise it with shadows, different shapes or even different locales!
This listener is _optional_, but if you want to utilise this. Make sure that the `NumberKeyboardClickedListener` is configured properly when you are building your button layouts.
146
+
After configuration, it will provide `NumberKeyboardData` that has the `rawAmount` from the `NumberKeyboard` inout and it's variation of Integer and Float variable types.
-`keyboard:numberkeyboard_numberKeyBackground="[reference]"` (default: circle): number keys background drawable.
247
+
-`keyboard:numberkeyboard_numberKeyTextColor="[reference]"` (default: dark blue): number keys text color.
248
+
-`keyboard:numberkeyboard_numberKeyTypeface="[reference]"` (default: dark blue): number keys text color.
249
+
-`keyboard:numberkeyboard_numberKeyTypeface="[reference]"` (default: none): number keys text typeface.
250
+
-`keyboard:numberkeyboard_numberKeyTextSize="[dimension]"` (default: none): number keys text size (if it is not set, the text auto scales to fit the key).
251
+
-`keyboard:numberkeyboard_leftAuxBtnBackground="[reference]"` (default: none): if `keyboardType="custom"`, left auxiliary button background.
252
+
-`keyboard:numberkeyboard_rightAuxBtnIcon="[reference]"` (default: none): if `keyboardType="custom"`, icon shown in right auxiliary button.
253
+
-`keyboard:numberkeyboard_rightAuxBtnBackground="[reference]"` (default: none): if `keyboardType="custom"`, right auxiliary button background.
254
+
255
+
##### Methods
256
+
257
+
-`hideLeftAuxButton()`: hides left auxiliary button.
258
+
-`showLeftAuxButton()`: shows left auxiliary button.
259
+
-`hideRightAuxButton()`: hides right auxiliary button.
260
+
-`showRightAuxButton()`: shows right auxiliary button.
261
+
-`setKeyWidth()`: sets key width in px.
262
+
-`setKeyHeight()`: sets key height in px.
263
+
-`setKeyPadding()`: sets key padding in px.
264
+
-`setNumberKeyBackground()`: sets number keys background.
265
+
-`setNumberKeyTextColor()`: sets number keys text color.
266
+
-`setNumberKeyTypeface()`: sets number keys text typeface.
267
+
-`setNumberKeyTextSize()`: sets number keys text size in pixels.
268
+
-`setLeftAuxButtonIcon()`: sets left auxiliary button icon.
269
+
-`setRightAuxButtonIcon()`: sets right auxiliary button icon.
270
+
-`setLeftAuxButtonBackground()`: sets left auxiliary button background.
271
+
-`setRightAuxButtonBackground()`: sets right auxiliary button background.
272
+
273
+
##### Callback
274
+
275
+
To listen to keyboard events, you have to use `NumberKeyboardListener`:
276
+
277
+
-`onNumberClicked()`: invoked when a number key is clicked.
278
+
-`onLeftAuxButtonClicked()`: invoked when the left auxiliary button is clicked.
279
+
-`onRightAuxButtonClicked()`: invoked when the right auxiliary button is clicked.
0 commit comments