Preference is an Android Kotlin library which builds upon Jetpack Preference and Material Components.
You can use it in your own Android project by adding it to your depenencies:
dependencies {
implementation "com.loamen.android:preference:1.0.0"
}
Make sure your preference fragments are derived from preference.PreferenceFragmentBase
.
This will notably take care of using a compatible preferenceTheme
if none was specified in your theme styles. Failing to do so or using an incompatible preferenceTheme
can lead to crashes.
You can define your own preferenceTheme
attribute in your theme styles. Like so:
<item name="preferenceTheme">@style/PreferenceThemeOverlay.Loamen.Custom</item>
Run and explore the demo application and code documentation for more information.
Extend the basic preference with convenient features and tricks.
Easily build a list preference from an enum.
Preference using a Material Slider.
Increase the library version number from lib/build.gradle.kts
.
Generate your upload package by running:
.\gradlew generateUploadPackage
It outputs a file named preference.zip
in the following folder lib\build\distributions
. You can directly upload this ZIP file for publication on Maven Central.