/VNTNumberPickerPreference

NumberPicker Preference for Android

Primary LanguageJavaApache License 2.0Apache-2.0

VNTNumberPickerPreference

Build Status API License Android Arsenal Jit Pack

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.

<com.vanniktech.vntnumberpickerpreference.VNTNumberPickerPreference
    xmlns:vntnumberpickerpreference="http://schemas.android.com/apk/res-auto"
    android:defaultValue="@integer/font_size_default_value"
    android:key="preference_font_size"
    android:title="@string/font_size"
    vntnumberpickerpreference:maxValue="@integer/font_size_max_value"
    vntnumberpickerpreference:minValue="@integer/font_size_min_value"
	vntnumberpickerpreference:setWrapSelectorWheel="true"/>

Download

Get it on Google Play

or scan the code on your mobile

Google Play QR link

or download it directly

Setup

build.gradle

repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

dependencies {
    compile 'com.vanniktech:vntnumberpickerpreference:0.1.1-SNAPSHOT'
}

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

Get font size

final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
final int fonftSize = sharedPreferences.getInt("preference_font_size", this.getResources().getInteger(R.integer.font_size_default_value));

Preview

Image of VNTNumberPickerPreference

License

Copyright (C) 2014-2015 Vanniktech - Niklas Baudy

Licensed under the Apache License, Version 2.0