diff --git a/README.md b/README.md index 2ac8273..600089c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,5 @@ # NumberPickerPreference -[![API](https://img.shields.io/badge/API-19%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=19) -[![](https://jitpack.io/v/invissvenska/NumberPickerPreference.svg)](https://jitpack.io/#invissvenska/NumberPickerPreference) -Build Status -Buy Me A Coffee donate button +[![API](https://img.shields.io/badge/API-19%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=19) [![](https://jitpack.io/v/invissvenska/NumberPickerPreference.svg)](https://jitpack.io/#invissvenska/NumberPickerPreference) Build Status Buy Me A Coffee donate button ## Prerequisites @@ -30,19 +27,19 @@ dependencies { ## Configuration -Add the NumberDialogPreference to the preferences.xml: +Add the NumberDialogPreference to the `preferences.xml`: ```xml // optional, default is "" + app:numberPickerPreference_minValue="10" + app:numberPickerPreference_maxValue="60" + app:numberPickerPreference_unitText=" another quantity" /> ``` +## Usage + Override the OnDisplayPreferenceDialog method in your fragment which extends the PreferenceFragmentCompat class: ```java public class SettingsFragment extends PreferenceFragmentCompat { @@ -72,8 +69,6 @@ public class SettingsFragment extends PreferenceFragmentCompat { } ``` -## Usage - To create a NumberPickerPreference with default value of 20, min value of 10, max value of 60, increments of 2 and custom unit text: ```xml ``` +## NumberDialogPreference Attributes +Attributes | Type | Default | Mandatory | Description +--- | --- | --- | --- | --- +defaultValue | Integer | 0 | No | Sets the default value of the preference. +numberPickerPreference_minValue | Integer | 0 | No | Minimum value to select from preference. +numberPickerPreference_maxValue | Integer | 100 | No | Maximum value to select from preference. +numberPickerPreference_stepValue | Integer | 1 | No | Stepper value, minimum value should be 1. +numberPickerPreference_unitText | String | none | No | Suffix value, can be used to indicate the unit which will be selected. + ## Screenshots **Please click the image below to enlarge.**