Kotpref - Android SharedPreferences delegation library for Kotlin

Overview

Kotpref

Android SharedPreference delegation for Kotlin.

kotlin codecov license

Install

repositories {
    mavenCentral()
}

dependencies {
    // core
    implementation 'com.chibatching.kotpref:kotpref:2.13.1'
  
    // optional, auto initialization module
    implementation 'com.chibatching.kotpref:initializer:2.13.1'
  
    // optional, support saving enum value and ordinal
    implementation 'com.chibatching.kotpref:enum-support:2.13.1'
  
    // optional, support saving json string through Gson
    implementation 'com.chibatching.kotpref:gson-support:2.13.1'
    implementation 'com.google.code.gson:gson:2.8.6'
  
    // optional, support LiveData observable preference
    implementation 'com.chibatching.kotpref:livedata-support:2.13.1'
    implementation 'androidx.lifecycle:lifecycle-livedata:2.2.0'

    // experimental, preference screen build dsl
    implementation 'com.chibatching.kotpref:preference-screen-dsl:2.13.1'
}

How to use

Declare preference model

object UserInfo : KotprefModel() {
    var name by stringPref()
    var code by nullableStringPref()
    var age by intPref(default = 14)
    var highScore by longPref()
    var rate by floatPref()
    val prizes by stringSetPref {
        val set = TreeSet<String>()
        set.add("Beginner")
        return@stringSetPref set
    }
}

enum class GameLevel {
    EASY,
    NORMAL,
    HARD
}

Set up

Pass the application context to Kotpref

Kotpref.init(context)

or use auto initializer module.

Injectable Context

If you don't want to use singleton context because of unit test or etc.., you can use secondary constructor of KotprefModel to inject context.

class InjectableContextSamplePref(context: Context) : KotprefModel(context) {
    var sampleData by stringPref()
}

If you set context to all your model, you don't need call Kotpref.init(context) and don't use auto initializer module.

Read and Write

UserInfo.gameLevel = GameLevel.HARD
UserInfo.name = "chibatching"
UserInfo.code = "DAEF2599-7FC9-49C5-9A11-3C12B14A6898"
UserInfo.age = 30
UserInfo.highScore = 49219902
UserInfo.rate = 49.21F
UserInfo.prizes.add("Bronze")
UserInfo.prizes.add("Silver")
UserInfo.prizes.add("Gold")

Log.d(TAG, "Game level: ${UserInfo.gameLevel}")
Log.d(TAG, "User name: ${UserInfo.name}")
Log.d(TAG, "User code: ${UserInfo.code}")
Log.d(TAG, "User age: ${UserInfo.age}")
Log.d(TAG, "User high score: ${UserInfo.highScore}")
Log.d(TAG, "User rate: ${UserInfo.rate}")
UserInfo.prizes.forEachIndexed { i, s -> Log.d(TAG, "prize[$i]: $s") }

Bulk edit

UserInfo.bulk {
    gameLevel = GameLevel.EASY
    name = "chibatching Jr"
    code = "451B65F6-EF95-4C2C-AE76-D34535F51B3B"
    age = 2
    highScore = 3901
    rate = 0.4F
    prizes.clear()
    prizes.add("New Born")
}

// Bulk edit uses Editor#apply() method internally.
// If you want to apply immediately, you can use blockingBulk instead.
UserInfo.blockingBulk {
    gameLevel = GameLevel.EASY
}

Result shared preference xml

XML file name equals model class name. If model class named UserInfo, XML file name is UserInfo.xml.

<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
    <long name="highScore" value="49219902" />
    <set name="prizes">
        <string>Beginner</string>
        <string>Bronze</string>
        <string>Gold</string>
        <string>Silver</string>
    </set>
    <string name="name">chibatching</string>
    <string name="code">DAEF2599-7FC9-49C5-9A11-3C12B14A6898</string>
    <int name="age" value="30" />
    <float name="rate" value="49.21" />
</map>

Options

Change default value

var age: Int by intPref(18)

or

var age: Int by intPref(default = 18)

Change preference key

You can custom preference key or use from string resources.

var useFunc1: Boolean by booleanPref(key = "use_func1")
var mode: Int by intPref(default = 1, key = R.string.pref_mode)

Change default save mode

Kotpref save all preference property by apply method. You can change method to commit for each property.

var age: Int by intPref(default = 18, commitByDefault = true)

Or change default for each KotprefModel.

object UserInfo : KotprefModel() {
    override val commitAllPropertiesByDefault: Boolean = true

Change XML file name

Override kotprefName property.

object UserInfo : KotprefModel() {
    override val kotprefName: String = "user_info"

Change SharedPreference mode

Override kotprefMode property. Default is Context.MODE_PRIVATE.

object UserInfo : KotprefModel() {
    override val kotprefMode: Int = Context.MODE_MULTI_PROCESS

API Docs

https://chibatching.github.io/Kotpref/docs/api/-modules.html

License

Copyright 2015-2021 Takao Chiba

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
Comments
  • java.lang.NoClassDefFoundError: com.chibatching.kotpref.KotprefPreferences$KotprefEditor$apply$1

    java.lang.NoClassDefFoundError: com.chibatching.kotpref.KotprefPreferences$KotprefEditor$apply$1

    After updating to kotpref 2.1.0 and Kotlin 1.1.1 my UI-Tests fail with:

    E/AndroidRuntime( 7659): Process: org.ligi.gobandroid_hd, PID: 7659
    E/AndroidRuntime( 7659): java.lang.NoClassDefFoundError: com.chibatching.kotpref.KotprefPreferences$KotprefEditor$apply$1
    E/AndroidRuntime( 7659): 	at com.chibatching.kotpref.KotprefPreferences$KotprefEditor.apply(KotprefPreferences.kt:21)
    E/AndroidRuntime( 7659): 	at com.chibatching.kotpref.KotprefModel.commitBulkEdit(KotprefModel.kt:199)
    E/AndroidRuntime( 7659): 	at org.ligi.gobandroid_hd.ui.game_setup.GameSetupFragment.refresh_ui(GameSetupFragment.kt:151)
    E/AndroidRuntime( 7659): 	at org.ligi.gobandroid_hd.ui.game_setup.GameSetupFragment.onProgressChanged(GameSetupFragment.kt:80)
    E/AndroidRuntime( 7659): 	at android.widget.SeekBar.onProgressRefresh(SeekBar.java:91)
    E/AndroidRuntime( 7659): 	at android.widget.ProgressBar.doRefreshProgress(ProgressBar.java:655)
    E/AndroidRuntime( 7659): 	at android.widget.ProgressBar.refreshProgress(ProgressBar.java:667)
    E/AndroidRuntime( 7659): 	at android.widget.ProgressBar.setProgress(ProgressBar.java:714)
    E/AndroidRuntime( 7659): 	at android.widget.ProgressBar.setProgress(ProgressBar.java:695)
    E/AndroidRuntime( 7659): 	at org.ligi.gobandroid_hd.ui.game_setup.GameSetupFragment.refresh_ui(GameSetupFragment.kt:109)
    E/AndroidRuntime( 7659): 	at org.ligi.gobandroid_hd.ui.game_setup.GameSetupFragment.onProgressChanged(GameSetupFragment.kt:80)
    E/AndroidRuntime( 7659): 	at android.widget.SeekBar.onProgressRefresh(SeekBar.java:91)
    E/AndroidRuntime( 7659): 	at android.widget.ProgressBar.doRefreshProgress(ProgressBar.java:655)
    E/AndroidRuntime( 7659): 	at android.widget.ProgressBar.refreshProgress(ProgressBar.java:667)
    E/AndroidRuntime( 7659): 	at android.widget.ProgressBar.setProgress(ProgressBar.java:714)
    E/AndroidRuntime( 7659): 	at android.widget.ProgressBar.setProgress(ProgressBar.java:695)
    E/AndroidRuntime( 7659): 	at org.ligi.gobandroid_hd.ui.game_setup.GameSetupFragment.refresh_ui(GameSetupFragment.kt:105)
    E/AndroidRuntime( 7659): 	at org.ligi.gobandroid_hd.ui.game_setup.GameSetupFragment.onStart(GameSetupFragment.kt:66)
    E/AndroidRuntime( 7659): 	at android.support.v4.app.Fragment.performStart(Fragment.java:2218)
    E/AndroidRuntime( 7659): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1340)
    E/AndroidRuntime( 7659): 	at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)
    E/AndroidRuntime( 7659): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
    E/AndroidRuntime( 7659): 	at android.support.v4.app.FragmentManagerImpl.dispatchStart(FragmentManager.java:2907)
    E/AndroidRuntime( 7659): 	at android.support.v4.app.FragmentController.dispatchStart(FragmentController.java:212)
    E/AndroidRuntime( 7659): 	at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:613)
    E/AndroidRuntime( 7659): 	at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178)
    E/AndroidRuntime( 7659): 	at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
    E/AndroidRuntime( 7659): 	at android.app.Activity.performStart(Activity.java:5241)
    E/AndroidRuntime( 7659): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2168)
    E/AndroidRuntime( 7659): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
    E/AndroidRuntime( 7659): 	at android.app.ActivityThread.access$800(ActivityThread.java:135)
    E/AndroidRuntime( 7659): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
    E/AndroidRuntime( 7659): 	at android.os.Handler.dispatchMessage(Handler.java:102)
    E/AndroidRuntime( 7659): 	at android.os.Looper.loop(Looper.java:136)
    E/AndroidRuntime( 7659): 	at android.app.ActivityThread.main(ActivityThread.java:5017)
    E/AndroidRuntime( 7659): 	at java.lang.reflect.Method.invokeNative(Native Method)
    E/AndroidRuntime( 7659): 	at java.lang.reflect.Method.invoke(Method.java:515)
    E/AndroidRuntime( 7659): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
    E/AndroidRuntime( 7659): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
    E/AndroidRuntime( 7659): 	at dalvik.system.NativeStart.main(Native Method)
    W/ActivityManager( 1549): Force-killing crashed app org.ligi.gobandroid_hd at watcher's request
    

    will have to digg a bit deeper - but dropping this here now as I guess the root is in kotpref and you might see whats wrong in a glance without digging.

    bug 
    opened by ligi 10
  • StringSetPref iterator

    StringSetPref iterator

    Hello. I've noticed that all mutating operations on a set are being applied immediately, e. g.

    val result = set.add(element)
    kotprefModel.kotprefPreference.edit().putStringSet(key, set).apply()
    return result
    

    but iterator() funciton just returns undecorated set.iterator(), and it's easy to call remove() on it without triggering SharedPreferences update. Am I right? Will this be fixed? Do you need help with it?

    bug 
    opened by Miha-x64 8
  • Crash on latest library version if I compose delegates

    Crash on latest library version if I compose delegates

    If I import the latest version

    implementation 'com.chibatching.kotpref:kotpref:2.10.0'
    implementation 'com.chibatching.kotpref:gson-support:2.10.0'
    

    And then

    object AppPreferences : KotprefModel()
    {
        var authToken : String? by nullableStringPref()
        var loggedInUser : User? by gsonNullablePref()
    }
    
    class App : Application()
    {
        override fun onCreate()
        {
            super.onCreate()
    
            Kotpref.init(context)
            Kotpref.gson=GsonFactory.gson
        }
    }
    

    Each time I set or get the AppPreferences.loggedInUser field or the AppPreferences.authToken, an exception is raised:

    kotlin.UninitializedPropertyAccessException: lateinit property property has not been initialized
            at com.chibatching.kotpref.pref.AbstractPref.getPreferenceKey(AbstractPref.kt:22)
            at com.chibatching.kotpref.pref.StringNullablePref.getFromPreference(StringNullablePref.kt:15)
            at com.chibatching.kotpref.pref.StringNullablePref.getFromPreference(StringNullablePref.kt:8)
            at com.chibatching.kotpref.pref.AbstractPref.getValue(AbstractPref.kt:35)
            at com.chibatching.kotpref.pref.AbstractPref.getValue(AbstractPref.kt:9)
            at my_namespace.utils.preferences.AppPreferences.getAuthorization(AppPreferences.kt)
            at my_namespace.App$Companion.isUserLoggedIn(App.kt:42)
            at my_namespace.notifications.PushNotificationsClient.onNewToken(PushNotificationsClient.kt:20)
            at com.google.firebase.messaging.FirebaseMessagingService.zzc(com.google.firebase:firebase-messaging@@20.1.0:104)
            at com.google.firebase.messaging.zze.run(com.google.firebase:firebase-messaging@@20.1.0:2)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
            at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source)
            at java.lang.Thread.run(Thread.java:761)
    

    If I downgrade to 2.9.2, it works fine.

    needs more information 
    opened by andob 7
  • support for commitByDefault

    support for commitByDefault

    Thankyou for such a wonderful library. Using it in many of my projects.

    in many cases app might need commit for some properties.

    commit/apply doesn't much depend on scenario, those rather depend on property. we can use blockingCommit but adding blockingCommit every time we access that property is difficult.

    Changes

    1. added support for commitByDefault
    2. added Parameterized unit tests for commitByDefault feature
    3. no breaking changes
    opened by Ashok-Varma 6
  • Add dsl for Preference

    Add dsl for Preference

    Hi, I recently started using the preference screen dsl and it's awesome, thanks for that. I encountered one problem though - I needed simple Preference with custom layout and there was no function for that. It makes kinda sense since it is not bound to kotpref property, but it will still be nice to have it, I think. I tried to create the Preference on my own then, but since the preferenceScreen is only set after calling the builder function, there is no way to use it to add the Preference to the screen from within that function, or at least I can't see it.

    So I created a function for building the Preference and moved the assignment so one can access the preferenceScreen in the builder function to do any custom stuff.

    experimental 
    opened by janbina 5
  • Commit changes

    Commit changes

    Hello. Thank you for a great library!

    I need a way to commit() some changes instead of apply()ing them to save some crash information and exit immediately in my uncaught exception handler.

    Here is my implementation: https://github.com/chibatching/Kotpref/pull/22

    opened by Miha-x64 5
  • Made all property delegation functions inline according to KT-14513

    Made all property delegation functions inline according to KT-14513

    As of Kotlin 1.3.60, inline property delegation functions are going to be optimized heavily. https://youtrack.jetbrains.com/issue/KT-14513

    This PR breaks API for custom delegates. Other ways:

    • rework API and stop implementing ReadWriteProperty, or
    • save API, implement KProperty, override only name and pass instances to abstract methods of AbstractPref
    opened by Miha-x64 4
  • What is the bast way to handle DropDownPreference integer values

    What is the bast way to handle DropDownPreference integer values

    I have a DropDownPreference with integer values. Android needs string-array for values to be used and that crates an issue where I have to define preference model member as var myPref: String by stringPref.

    Is there a correct way of of accessing this preference apart from converting it to Int in my code?

    question 
    opened by NLLAPPS 4
  • KotprefModel.asLiveData has some issue

    KotprefModel.asLiveData has some issue

    gradle

     implementation 'com.chibatching.kotpref:kotpref:2.9.1'
     implementation 'androidx.lifecycle:lifecycle-livedata:2.0.0'
     implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.41"
    

    my user data is

    object User :KotprefModel(){
        var username by stringPref()
        var token by stringPref()
        var uid by intPref()
         var isLogin by booleanPref()
        val isLogined = User.asLiveData(User::isLogin)//highlight code
    
    }
    

    my fragment

    class FragmentTwo : BaseFragment() {
    
        companion object {
            fun newInstance() = FragmentTwo()
        }
    
        private  val  viewModel by lazy { ViewModelProviders.of(requireActivity()).get(FragmentTwoViewModel::class.java) }
    
        override fun onCreateView(
            inflater: LayoutInflater, container: ViewGroup?,
            savedInstanceState: Bundle?
        ): View? {
            val view = inflater.inflate(R.layout.fragment_two_fragment, container, false)
            val bind = DataBindingUtil.bind<FragmentTwoFragmentBindingImpl>(view)
            bind?.lifecycleOwner = this
            bind?.twoVm = viewModel
    
    
            return view
        }
    
        override fun onActivityCreated(savedInstanceState: Bundle?) {
            super.onActivityCreated(savedInstanceState)
            // TODO: Use the ViewModel
            viewModel.isStart.observe(this, Observer {
                startActivity(Intent(context,it.first))
            })
           //highlight code
            User.isLogined.observe(this, Observer {
                Log.d(javaClass.name,"asLiveData(User::isLogin) $it")
            })
    
        }
    
    }
    
    

    when i wanna change isLogin in this method

                    User.isLogin = true
    

    fragment observe is not called

    when i change extend code

    KotprefModel.asLiveData
    remove this@asLiveData.preferences.unregisterOnSharedPreferenceChangeListener(this)

    the observe is working.


    I think there is some issue in KotprefModel.asLiveData

    bug investigation 
    opened by TestSmirk 4
  • Add support for storing and retrieving properties based on enums

    Add support for storing and retrieving properties based on enums

    Should resolve #18. The option I went with is to provide an enum's possible values as the first argument when defining the preference variable. Another option could be to provide the enum's class itself and then using enumConstants to retrieve the list instead. That could be a bit cleaner but may require usage of kotlin-reflection which some library users might not find desirable.

    enhancement 
    opened by plackemacher 4
  • Nullable preferences

    Nullable preferences

    I use your library and it seems a proper way to work with preferences from Kotlin.

    However I found one disadvantage: it is not possible to put the null value to a preference (see example bellow). In origin Android preference model I can do it through the Editor interface. In this case, when I read this property, I retrieve null or default value (if specified).

    public object DevicePreference : KotprefModel() { var key: String? by stringPrefVar(default = "") }

    In current case I should to write uncomfortable setting code:

    string: String? = "" DevicePreference.key = string ?: ""

    I think that you should allow to set the null value to a preference. In this case it less comfortable to read value (need to add "!!" symbols) but users should chose preferable way by yourself.

    enhancement 
    opened by skatset 4
  • Featur Request -> Save data class

    Featur Request -> Save data class

    Your library is so cool. Really easy to use Also it would be greater if you add feature to save data class in your KotPrefModel You can use GSON to convert data class to string and save it in shared pref

    Thank you in advance

    opened by zihadrizkyef 1
  • livedata is not notify when clearing on API < 30

    livedata is not notify when clearing on API < 30

    LiveData-support doesn't work for situations that targetSdk or target device are below than API 30.

    I checked livedata-support source code. It uses SharedPreferences.OnSharedPreferenceChangeListener that has this description:

    Note: This callback will not be triggered when preferences are cleared via Editor#clear(), unless targeting Build.VERSION_CODES.R on devices running OS versions Android R or later. source

    bug 
    opened by beigirad 0
  • Auto update API docs with CI

    Auto update API docs with CI

    Currently, updating API docs manually. I want to automate it in publish CircleCI jobs or GitHub workflow with tag push.

    Update docs command is below

    ./gradlew dokkaHtmlMultiModule
    
    maintenance 
    opened by chibatching 0
  • Support for versioning

    Support for versioning

    As of now, there is no support for versioning of KotprefModel. This is useful in some cases when someone wants to remove a key on version update, or clear the complete model itself.

    This could be provided by having a version number in KotprefModel and calling an abstract function onVersionUpdate whenever the version number is increased.

    enhancement 
    opened by pr-gupta 0
  • Persisting custom objects

    Persisting custom objects

    Hello again :) What about supporting pref values, which could be presisted into String by custom converter?

    object AppState { // client code
        val user by customPref<User?>(default = null, converter = UserConverter)
    }
    
    interface PrefConverter<T> { // library code
        fun fromPref(str: String): T
        fun toPref(t: T): String
    }
    
    object UserConverter : PrefConverter<User> { // client code
        private val gson = Gson()
        override fun fromPref(str: String) = gson.fromJson(str, User::class.java)
        override fun toPref(t: T) = gson.toJson(t)
    }
    

    Many ORMs (Hibernate, GreenDAO, ORMLite, ObjectBox, etc) do this for object's fields, so we can borrow some architectural solutions from them.

    enhancement 
    opened by Miha-x64 1
Releases(v2.13.2)
  • v2.13.2(Jan 29, 2022)

  • v2.13.1(Feb 7, 2021)

    From this version, Kotpref is hosted in Maven Central instead of JCenter. Please add mavenCentral() repository settings onto your build.gradle.

    Notification

    2.13.0 on Maven Central is broken. Don't use 2.13.0, if you download from Maven Central.

    Maintenance

    • Migrate to Maven Central from JCenter #240 (@chibatching)
    Source code(tar.gz)
    Source code(zip)
  • v2.13.0(Nov 14, 2020)

    Features

    • Migrate auto initialization from ContentProvider to AndroidX App Startup #229 (@chibatching)
    • Introduce explicit api option #227 (@chibatching)

    Bug Fixes

    • Fix that LiveData initial value fires twice #225 (@chibatching)

    Maintenance

    • Migrate publishing artifacts CI task #235 (@chibatching)
    • Upgrade gradle wrapper #234 (@chibatching)
    • Create codecov.yml #228 (@chibatching)
    • Update dependencies #226 (@chibatching)
    Source code(tar.gz)
    Source code(zip)
  • v2.12.0(Sep 28, 2020)

    Features

    • Convert interface to fun interface to use SAM converting #216, #217 (@chibatching)
    • Add isInitialized property to Kotpref object #218 (@chibatching)
    • Remove deprecated class and function #213 (@chibatching)

    Experimental Features

    • Add builder for custom preference #215 (@chibatching)
    • Add dsl for Preference #210 (@janbina)

    Maintenance

    • Update kotlin to 1.4.10 #219 (@chibatching)
    • Update dependencies #212 (@chibatching)
    • Fix CircleCI build error #211 (@chibatching)
    • Update gradle wrapper #208 (@chibatching)
    Source code(tar.gz)
    Source code(zip)
  • v2.11.0(May 13, 2020)

    Feature

    • Add gson default value provider parameter to lazily instantiate default value #205

    Deprecated

    • Rename PreferencesOpener to PreferencesProvider #192

    Others

    • Update dependent libraries and Kotlin #204
    Source code(tar.gz)
    Source code(zip)
  • v2.10.0(Dec 12, 2019)

  • v2.9.2(Sep 17, 2019)

  • v2.9.1(Aug 12, 2019)

  • v2.9.0(Aug 12, 2019)

  • v2.8.0(Apr 27, 2019)

  • v2.7.0(Mar 31, 2019)

    Feature

    • From this version, Kotpref will be shipped with Java 8 bytecode #140
    • Migrate to AndroidX #127

    Bug fix

    • StringSetPref isn't aware of changes made by PreferenceFragment #143
    Source code(tar.gz)
    Source code(zip)
  • v2.6.0(Aug 19, 2018)

  • v2.5.0(Mar 22, 2018)

    Bug fix

    • Fix StringSet preference saving issue #96

    Feature

    • Support generics type object for gson support #88 Thanks @sosite 😄

    Note

    • From this version, I removed dependencies to kotlin and other third party library from pom. So, you should explicitly declare it.
    Source code(tar.gz)
    Source code(zip)
  • v2.4.0(Feb 12, 2018)

  • v2.3.0(Jan 18, 2018)

  • v2.2.0(Oct 1, 2017)

  • v2.1.2(Jun 25, 2017)

    Feature

    • Update Kotlin to 1.1.3
    • Remove dependency to kotlin stdlib
      • please specify kotlin stdlib in your build.gradle

    Bug fix

    • NoClassDefFoundError occur when using StringSetPref in blockingBulk edit https://github.com/chibatching/Kotpref/pull/53 (Thanks @Tunous !!)
    Source code(tar.gz)
    Source code(zip)
  • v2.1.1(Mar 26, 2017)

  • v2.1.0(Mar 17, 2017)

    Feature

    • Update kotlin to 1.1.1

    Bug fix

    • Fix the bug that StringPrefSet iterator is not work properly in transaction

    Improvement

    • Improve StringPrefSet performance
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0(Feb 1, 2017)

    Kotpref version 2 has destructive changes from version 1!!

    • Simplify interface name
    • Separate standard module and optional module
      • auto initializer
      • enum support
    • Add gson serialize support
    Source code(tar.gz)
    Source code(zip)
  • v1.6.0(Dec 18, 2016)

  • v1.5.0(Oct 24, 2016)

  • v1.4.0(Sep 6, 2016)

  • v1.3.1(Jun 13, 2016)

  • v1.3.0(Apr 24, 2016)

  • v1.2.0(Jun 13, 2016)

  • v1.1.0(Feb 9, 2016)

  • v1.0.1(Feb 5, 2016)

  • v1.0.0(Feb 5, 2016)

  • v0.10.0(Dec 27, 2015)

Owner
Takao Chiba
Android app engineer
Takao Chiba
A Kotlin library for reactive and boilerplate-free SharedPreferences in Android

KPreferences A Kotlin library for reactive and boilerplate-free Shared Preferences in Android. With KPreferences you can use Kotlin's marvelous delega

Mohamad Amin Mohamadi 19 Dec 16, 2020
The most complete and powerful data-binding library and persistence infra for Kotlin 1.3, Android & Splitties Views DSL, JavaFX & TornadoFX, JSON, JDBC & SQLite, SharedPreferences.

Lychee (ex. reactive-properties) Lychee is a library to rule all the data. ToC Approach to declaring data Properties Other data-binding libraries Prop

Mike 112 Dec 9, 2022
Easy lightweight SharedPreferences library for Android in Kotlin using delegated properties

Easy lightweight SharedPreferences library for Android in Kotlin using delegated properties Idea Delegated properties in Kotlin allow you to execute a

null 25 Dec 27, 2022
Android Library to make SharedPreferences usage easier.

KotlinPreferences Kotlin Android Library, that makes preference usage simple and fun. KotlinPreferences now have a brother. With KotlinPreferences, yo

Marcin Moskała 50 Nov 6, 2022
Adapter library for SharedPreferences

EasyPrefs Adapter library for SharedPreferences which reduces boilerplate needed to store simple data, but open enough to not interfere with your own

Kacper Wojciechowski 6 Nov 23, 2021
Android SharedPreferences Helper

PocketDB Android SharedPreferences Helper This is SharedPreferences Helper like a database noSql. Support AES encryption Latest Version Download depen

Muhammad Utsman 9 Jun 20, 2021
Real life Kotlin Multiplatform project with an iOS application developed in Swift with SwiftUI, an Android application developed in Kotlin with Jetpack Compose and a backed in Kotlin hosted on AppEngine.

Conferences4Hall Real life Kotlin Multiplatform project with an iOS application developed in Swift with SwiftUI, an Android application developed in K

Gérard Paligot 98 Dec 15, 2022
Run Kotlin/JS libraries in Kotlin/JVM and Kotlin/Native programs

Zipline This library streamlines using Kotlin/JS libraries from Kotlin/JVM and Kotlin/Native programs. It makes it possible to do continuous deploymen

Cash App 1.5k Dec 30, 2022
A somewhat copy past of Jetbrain's code from the kotlin plugin repo to make it humanly possible to test Intellij IDEA kotlin plugins that work on kotlin

A somewhat copy past of Jetbrain's code from the kotlin plugin repo to make it humanly possible to test Intellij IDEA kotlin plugins that work on kotlin

common sense OSS 0 Jan 20, 2022
Kotlin library for Android

KAndroid Kotlin library for Android providing useful extensions to eliminate boilerplate code in Android SDK and focus on productivity. Download Downl

Paweł Gajda 890 Nov 13, 2022
🔓 Kotlin version of the popular google/easypermissions wrapper library to simplify basic system permissions logic on Android M or higher.

EasyPermissions-ktx Kotlin version of the popular googlesample/easypermissions wrapper library to simplify basic system permissions logic on Android M

Madalin Valceleanu 326 Dec 23, 2022
Android Spinner Dialog Library supported on both Java and Kotlin, Use for single or multi selection of choice

SpinnerDialog Android Spinner Dialog Library, Use for single or multi selection of choice Android UI Download To include SpinnerDialog in your project

Hamza Khan 55 Sep 15, 2022
A Bluetooth kotlin multiplatform "Cross-Platform" library for iOS and Android

Blue-Falcon A Bluetooth "Cross Platform" Kotlin Multiplatform library for iOS, Android, MacOS, Raspberry Pi and Javascript. Bluetooth in general has t

Andrew Reed 220 Dec 28, 2022
A Kotlin Android library for content provider queries with reactive streams and coroutines.

Pickpocket An Android library for content provider queries with reactive streams and coroutines. Calendar Contacts SMS MMS Files/Media Call Log Bookma

Chris Basinger 27 Nov 14, 2022
A Kotlin Android library for heuristics evasion that prevents your code from being tested.

EvadeMe An Android library for heuristics evasion that prevents your code from being tested. User Instructions Add the maven repository to your projec

Chris Basinger 29 Dec 26, 2022
Android AsyncTask wrapper library, written in Kotlin

KillerTask This is a Kotlin Android library to create async background tasks. Inspired by TinyTask, but more beautiful and easy to use for Kotlin Andr

Inaka 26 Oct 3, 2022
A Kotlin work manager library for Android with progress notifications and Hilt support.

Boot Laces A kotlin work manager library for Android that includes notifications and Hilt support. User Instructions Add the JitPack repository to you

Chris Basinger 35 Oct 8, 2022
Stateful is a Kotlin library which makes Android application development faster and easier.

Stateful Stateful is a Kotlin library which makes Android application development faster and easier. It helps you delete all the boilerplate code for

PicsArt 67 Oct 3, 2022
Android Library for requesting Permissions with Kotlin Coroutines or AndroidX LiveData

PEKO PErmissions with KOtlin Android Permissions with Kotlin Coroutines or LiveData No more callbacks, builders, listeners or verbose code for request

Marko Devcic 133 Dec 14, 2022