Coder Social home page Coder Social logo

krosxx / smartkey Goto Github PK

View Code? Open in Web Editor NEW
17.0 2.0 2.0 388 KB

⚙ 利用Kotlin委托实现优雅地持久化存储配置。

Kotlin 75.66% Java 24.34%
kotlin android config-management configuration key-value smartkey android-library kotlin-library

smartkey's Issues

混淆

开启混淆的情况下需要确保使用自定义 key 或者把 config 类的字段 keep 住才行,这个应该写到文档

Boolean类型更改无效

Boolean类型更改无效,别的类型没事
1、var haveMask:Boolean by smartKey(true)
2、AppConfig.INSTANCE.setHaveMask(false);
杀掉进程重启,发现还是true

配合 PreferenceFragment 使用

  1. 下载 SmartKeyDataStore.kt 到你的项目

  2. 设置 preferenceManager.preferenceDataStore = SmartKeyDataStore(YourConfig)

   class SettingsFragment : PreferenceFragmentCompat() {
        override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
            preferenceManager.preferenceDataStore = SmartKeyDataStore(AppConfig)
            setPreferencesFromResource(R.xml.root_preferences, rootKey)
        }
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.