Skip to content

Consti10/prefs-plus

 
 

Repository files navigation

github ci Release

Prefs-plusX

An extension for Android preferences that creates additional preference types including EditIntPreference, EditFloatPreference, IntListPreference and ColorPreference. The code originated from prefs-plus and colorpreference but has been updated to use the new androidx.preference implementation.

Usage

preferences.xml

<androidx.preference.PreferenceScreen xmlns:android="https://schemas.android.com/apk/res/android"
    xmlns:app="https://schemas.android.com/apk/res-auto">

    <com.mapzen.prefsplusx.EditIntPreference
        android:key="@string/integer_key"
        android:title="@string/integer_title"
        android:dialogTitle="@string/integer_dialog_title"
        android:defaultValue="@integer/integer_default_value"
        app:minIntValue="-1000"
        app:maxIntValue="1000"/>

    <com.mapzen.prefsplusx.EditFloatPreference
        android:key="@string/float_key"
        android:title="@string/float_title"
        android:dialogTitle="@string/float_dialog_title"
        android:defaultValue="@integer/float_default_value"
        app:minFloatValue="-1000.0"
        app:maxFloatValue="1000.0" />

    <com.mapzen.prefsplusx.IntListPreference
        android:key="@string/integer_list_key"
        android:title="@string/integer_list_title"
        android:dialogTitle="@string/integer_list_dialog_title"
        android:entries="@array/int_list_entries"
        android:defaultValue="@integer/integer_list_default_value"/>
    <!--optional android:entryValues="@array/int_list_entry_values"-->

    <com.mapzen.prefsplusx.EditTextPlusPreference
        android:key="@string/text_key"
        android:title="@string/text_title"
        android:dialogTitle="@string/text_dialog_title"
        android:defaultValue="@string/text_default_value" />


    <com.kizitonwose.colorpreference.ColorPreference
        android:key="@string/color_key"
        android:title="@string/color_key"
        android:summary="Select text background color"
        app:colorShape="circle"
        android:defaultValue="@color/DEFAULT_TV_BACKGROUND_COLOR"/>

</androidx.preference.PreferenceScreen>

androidx.preference.PreferenceScreen

PreferenceFragment

EditIntPreference

EditIntPreference

EditFloatPreference

EditFloatPreference

IntListPreference

IntListPreference

EditTextPlusPreference

EditTextPlusPreference

EditTextPlusPreference

ColorPreference

Install

    allprojects {
        repositories {
            jcenter()
            maven { url "https://jitpack.io" }
        }
   }
   dependencies {
	        implementation 'com.github.Consti10:prefs-plus:Tag'
	}

About

Android preferences extension

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%