Skip to content

jwfsky/VNTNumberPickerPreference

 
 

Repository files navigation

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:vnt_maxValue="@integer/font_size_max_value"
    vntnumberpickerpreference:vnt_minValue="@integer/font_size_min_value"
    vntnumberpickerpreference:vnt_setWrapSelectorWheel="true"/>

Download Sample App

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.2.0-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));

Proguard

No configuration needed.

Preview

Image of VNTNumberPickerPreference

License

Copyright (C) 2014-2015 Vanniktech - Niklas Baudy

Licensed under the Apache License, Version 2.0

About

NumberPicker Preference for Android

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%