Android SharedPreference management library made with kotlin

Related tags

Kotlin Projects Kref
Overview

Kref

Android SharedPreference management library made for kotlin

Download

Use Gradle:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

dependencies {
    implementation 'com.github.dudgns0507:Kref:1.0.1'
}

How do I use Kref?

Initialize KrefManager:

class App: Application() {
    override fun onCreate() {
        super.onCreate()

        KrefManager.init(this)
        // KrefManager.init(this, "SharedPreference Name")
        // KrefManager.init(this, "SharedPreference Name", Context.MODE_PRIVATE)

        // Clear SharedPreference
        // KrefManager.instance.clear()
    }
}

Save data to SharedPreference (Example):

class PrefManager {
    companion object {
        val instance = PrefManager()
    }

    var kString: String by StringPref(default = "")
}

// getValue like this
PrefManager.instance.kString

// setValue like this
PrefManager.instance.kString = "Kref"

Support Types:

// default is default value when SharedPreference key-value is empty
// name is SharedPreference key (if name is blank default is "{variable name}_Kref")

var kref: String by StringPref(default = "", name = "")
var kref: String? by StringNullablePref()
var kref: Boolean by BooleanPref(default = false)
var kref: Int by IntPref(default = 0)
var kref: Long by LongPref(default = 0L)
var kref: Float by FloatPref(default = 0F)
var kref: List<Any> by ListPref(default = arrayListOf()))

data class Test(
    var a: String
)

var kref: Test by ObjectPref(Test::class, default = Test(a = ""))

Author

Park YoungHun - @dudgns0507 on GitHub

License

MIT License

Copyright (c) 2021 dudgns0507

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
You might also like...
Open source Crypto Currency Tracker Android App made fully in Kotlin
Open source Crypto Currency Tracker Android App made fully in Kotlin

CoinBit CoinBit is a beautiful CryptoCurrency app, completely open sourced and 100% in kotlin. It supports following features Track prices of over 300

🗼 yukata (浴衣) is a modernized and fast GraphQL implementation made in Kotlin

🗼 yukata 浴衣 - Modernized and fast implementation of GraphQL made in Kotlin yukata is never meant to be captialised, so it'll just be yukata if you me

Api Rest Card Game made in Kotlin with Ktor

ApiRest-CardGame "Card Game API" is a project made in Kotlin with Ktor. The API allows you to manage a simple card game deck (shuffle, take a card, pu

Note taking app made in Kotlin
Note taking app made in Kotlin

Android Study Jams Notezz ⭐ Problem Statement: Note-taking is one of the most ov

A simple ToDo Task Manager App made in Kotlin using Room DataBase.
A simple ToDo Task Manager App made in Kotlin using Room DataBase.

ToDo List App 🌟 About A simple To-Do List Management App that helps you get things done. Built with Kotlin, it helps the user to add their task. User

A basic template ecommerce application with payment integration made using Android Architechture componets
A basic template ecommerce application with payment integration made using Android Architechture componets

ShopIt ShopIt is a basic template ecommerce application with payment integration(RazorPay), made using Android Architechture componets and Material Co

DSU-Sideloader - A simple app made to help users easily install GSIs via DSU's Android feature
DSU-Sideloader - A simple app made to help users easily install GSIs via DSU's Android feature

DSU Sideloader A simple app made to help users easily install GSIs via DSU's And

A small application for working with the Github API, made as a practical task. GeekBrains, course of study: Popular libraries: RxJava 2, Dagger 2, Moxie.
A small application for working with the Github API, made as a practical task. GeekBrains, course of study: Popular libraries: RxJava 2, Dagger 2, Moxie.

GeekBrains_Course_AndroidOnKotlin_HW_My_Movie Домашнее задание к занятию №2-6 Студента GeekBrains Веремеенко Дмитрия Факультет: Android-разработки Кур

New style for app design Online Sunglasses Shop App UI made in Jetpack Compose.😉😎
New style for app design Online Sunglasses Shop App UI made in Jetpack Compose.😉😎

JetSunglassUI-Android New style for app design Online Sunglasses Shop App UI made in Jetpack Compose. 😉 😎 (Navigation Components, Dagger-Hilt, Mater

Releases(1.1.7)
Owner
copin-danny
copin-danny
“Budgeter” is an optimized application for personal account management. Household account management is complicated.

Budgeter Links ?? Open-Source Library MVVM-Architecture Viewmodel-LiveData Room Database Dependency Injection-Hilt Coroutines Things we used while mak

Aditya Cheke 0 Dec 20, 2021
A command-line student management system in Kotlin

Student Management System Done as a part of NITK GSDC Android Study Jams 2021 Th

Ranjana Kambhammettu 2 Dec 24, 2021
Project created in order to handle account management

Account Service App Aplicação responsável em receber dados de uma conta, validá-los e retornar mensagem de sucesso ou erro. Tecnologias utilizadas - L

Rafael Alberto 0 Dec 14, 2021
Team management service is a production ready and fully tested service that can be used as a template for a microservices development.

team-mgmt-service Description Team management service is a production ready and fully tested service that can be used as a template for a microservice

Albert Llousas Ortiz 18 Oct 10, 2022
LinkHub is a simple and effective link management application that can help you to easily manage your app with no ads!

LinkHub LinkHub is a simple and effective link management application that can help you to easily manage your own links with no ads! Download Screensh

Amr Hesham 71 Dec 17, 2022
Pling is a mobile project management application

Pling is a mobile project management application. This application was developed as part of the “Embedded Interface Programming” course. Pling should include all the necessary and minimal features for planning a project, such as creating a project, adding tasks and monitoring progress.

Cassandra CHAUMULON 2 May 16, 2022
Go-inspired defer-based resource management

defer-kt Golang-inspired resource management library. Add to your project Gradle implementation "me.jason5lee:defer:1.0.1" Gradle Kotlin DSL implement

Jason Dongheng Lee 9 Dec 23, 2022
Game server management, orchestration, and scaling platform.

Liftgate Game server management, orchestration, and scaling platform. Project Status This project is a W.I.P. This README will be updated once we ente

null 4 Nov 14, 2022
🧶 Library to handling files for persistent storage with Google Cloud Storage and Amazon S3-compatible server, made in Kotlin

?? Remi Library to handling files for persistent storage with Google Cloud Storage and Amazon S3-compatible server, made in Kotlin! Why is this built?

Noelware 8 Dec 17, 2022