Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
#	app/build.gradle
#	build.gradle
  • Loading branch information
invissvenska committed Apr 4, 2021
2 parents b5d47f1 + 70893ce commit 751f24e
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
<a href="https://github.com/invissvenska/NumberPickerPreference/actions"><img alt="Build Status" src="https://github.com/invissvenska/NumberPickerPreference/workflows/Android-Library%20CI/badge.svg"/></a>
<span class="badge-buymeacoffee"><a href="https://www.paypal.com/paypalme/svenvandentweel/3" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span>
[![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) <a href="https://github.com/invissvenska/NumberPickerPreference/actions"><img alt="Build Status" src="https://github.com/invissvenska/NumberPickerPreference/workflows/Android-Library%20CI/badge.svg"/></a> <span class="badge-buymeacoffee"><a href="https://www.paypal.com/paypalme/svenvandentweel/3" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span>

## Prerequisites

Expand Down Expand Up @@ -30,19 +27,19 @@ dependencies {

## Configuration

Add the NumberDialogPreference to the preferences.xml:
Add the NumberDialogPreference to the `preferences.xml`:

```xml
<nl.invissvenska.numberpickerpreference.NumberDialogPreference
android:key="preference_key"
android:title="Preference title"
app:defaultValue="20" // optional, default is 0
app:numberPickerPreference_minValue="10" // optional, default is 0
app:numberPickerPreference_maxValue="60" // optional, default is 100
app:numberPickerPreference_stepValue="1" // optional, default is 1
app:numberPickerPreference_unitText=" another quantity" /> // 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 {
Expand Down Expand Up @@ -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
<nl.invissvenska.numberpickerpreference.NumberDialogPreference
Expand All @@ -86,6 +81,15 @@ To create a NumberPickerPreference with default value of 20, min value of 10, ma
app:numberPickerPreference_unitText=" another quantity" />
```

## 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.**
Expand Down

0 comments on commit 751f24e

Please sign in to comment.