numberpickerpreference

Custom preference, which opens a dialog with a number picker

License

License

GroupId

GroupId

ch.poole.android
ArtifactId

ArtifactId

numberpickerpreference
Last Version

Last Version

2.0.1
Release Date

Release Date

Type

Type

aar
Description

Description

numberpickerpreference
Custom preference, which opens a dialog with a number picker
Project URL

Project URL

https://github.com/simonpoole/NumberPickerPreference
Source Code Management

Source Code Management

https://github.com/simonpoole/NumberPickerPreference

Download numberpickerpreference

How to add to project

<!-- https://jarcasting.com/artifacts/ch.poole.android/numberpickerpreference/ -->
<dependency>
    <groupId>ch.poole.android</groupId>
    <artifactId>numberpickerpreference</artifactId>
    <version>2.0.1</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/ch.poole.android/numberpickerpreference/
implementation 'ch.poole.android:numberpickerpreference:2.0.1'
// https://jarcasting.com/artifacts/ch.poole.android/numberpickerpreference/
implementation ("ch.poole.android:numberpickerpreference:2.0.1")
'ch.poole.android:numberpickerpreference:aar:2.0.1'
<dependency org="ch.poole.android" name="numberpickerpreference" rev="2.0.1">
  <artifact name="numberpickerpreference" type="aar" />
</dependency>
@Grapes(
@Grab(group='ch.poole.android', module='numberpickerpreference', version='2.0.1')
)
libraryDependencies += "ch.poole.android" % "numberpickerpreference" % "2.0.1"
[ch.poole.android/numberpickerpreference "2.0.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

NumberPickerPreference

This is a fork of com.vanniktech.vntnumberpickerpreference.VNTNumberPickerPreference that extends android.support.v7.preference.DialogPreference instead of the platform DialogPreference. It further adds a couple of bells and whistles.

This is an easy to use custom preference, which opens a dialog with a number picker. The value gets automatically saved and you can set the default-, min- and maxValue conveniently in the XML.

<ch.poole.android.numberpickerpreference.NumberPickerPreference
    android:defaultValue="@integer/font_size_default_value"
    android:key="preference_font_size"
    android:title="@string/font_size"
    app:spt_maxValue="@integer/font_size_max_value"
    app:spt_minValue="@integer/font_size_min_value"
    app:spt_increment="2"
    app:spt_currentValueText="@string/current_vales"
    app:spt_setWrapSelectorWheel="true"/>

If spt_increment is larger that one available values are incremented by it, for example spt_minValue="0" and spt_maxValue="100" and spt_increment="10", will display 10, 20, 30 .... spt_currentValueText is the resource id of a text that will display the current value, it is expected to contain one number format parameter example: %1$d MB If spt_currentValueText is not set the selected number will be displayed.

Setup

build.gradle

compile 'ch.poole.android:NumberPickerPreference:2.0.1'

The library is available from maven central.

Go to your preference XML file and insert the above mentioned XML tags. Afterwards you are good to go and can run your project!



Copyright (C) 2014-2016 Vanniktech - Niklas Baudy, 2017 Simon Poole

Licensed under the Apache License, Version 2.0

Versions

Version
2.0.1