All Projects → anasanasanas → Preference-Rhythm

anasanasanas / Preference-Rhythm

Licence: Apache-2.0 license
Android library makes using Shared Preference easier.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Preference-Rhythm

Prefser
Wrapper for Android SharedPreferences with object serialization and RxJava Observables
Stars: ✭ 228 (+1325%)
Mutual labels:  sharedpreferences, rxandroid, rxjava2
Typedvalue
Tiny library to simplify access to SharedPreferences, Bundle or any other key-value storage
Stars: ✭ 18 (+12.5%)
Mutual labels:  sharedpreferences, rxjava2
android-base-project
Android LateralView Base Project
Stars: ✭ 25 (+56.25%)
Mutual labels:  rxandroid, repository-pattern
kotlin-maze
🚂 A simple way to implement applications using observable streams
Stars: ✭ 56 (+250%)
Mutual labels:  rxandroid, rxjava2
iMoney
iMoney 金融项目
Stars: ✭ 55 (+243.75%)
Mutual labels:  sharedpreferences, rxjava2
preferx
A reactive SharedPreferences library for Kotlin
Stars: ✭ 13 (-18.75%)
Mutual labels:  sharedpreferences, rxjava2
Starwars
A sample modular Android app written in Kotlin using Rx, Koin, Coroutines, Dagger 2 and Architecture components
Stars: ✭ 41 (+156.25%)
Mutual labels:  rxandroid, rxjava2
Reactivewifi
Android library listening available WiFi Access Points and related information with RxJava Observables
Stars: ✭ 186 (+1062.5%)
Mutual labels:  rxandroid, rxjava2
RestaurantsExplorer
Android application build with MVVM Pattern, using Zomato API to enable search cities arround the world and display the city restaurants on a map.
Stars: ✭ 32 (+100%)
Mutual labels:  rxjava2, repository-pattern
MVVM-Demo
This demo for MVVM Design pattern for android
Stars: ✭ 20 (+25%)
Mutual labels:  rxjava2, repository-pattern
RxLogs
An Android & Kotlin Reactive Advanced Logging Framework.
Stars: ✭ 12 (-25%)
Mutual labels:  rxandroid, rxjava2
Poolakey
Android In-App Billing SDK for Cafe Bazaar App Store
Stars: ✭ 60 (+275%)
Mutual labels:  rxandroid, rxjava2
Reactivenetwork
Android library listening network connection state and Internet connectivity with RxJava Observables
Stars: ✭ 2,484 (+15425%)
Mutual labels:  rxandroid, rxjava2
ToDoApp
📱My android playground app - Simple and Fastest todo app - developing to cover most android concepts, simple logic can make me focus more on framework
Stars: ✭ 28 (+75%)
Mutual labels:  sharedpreferences, repository-pattern
Conductormvp
Multi-project Clean Architecture MVP app in Kotlin using Conductor, Room, RxJava 2, Dagger 2 with custom scopes
Stars: ✭ 192 (+1100%)
Mutual labels:  rxandroid, rxjava2
RxPagination
Implement pagination in just few lines with RxPagination
Stars: ✭ 20 (+25%)
Mutual labels:  rxandroid, rxjava2
Rxbus
Event Bus By RxJava.
Stars: ✭ 2,126 (+13187.5%)
Mutual labels:  rxandroid, rxjava2
Androidbasemvp
🚀一个快速搭建MVP+RxJava2+Retrofit 基础框架,主要是封装有Http网络请求、日志、缓存、加载等待、toast、页面状态布局管理、权限、RxBus、Glide图片加载等组件,方便快速开发新项目、减少开发成本。
Stars: ✭ 184 (+1050%)
Mutual labels:  rxandroid, rxjava2
Android-Starter-Kit
This is up-to-date android studio project for native android application, that is using modern tools and libraries.
Stars: ✭ 16 (+0%)
Mutual labels:  rxandroid, rxjava2
AndroidVIP
Android project to experiment the VIPER approach using mosby, RxJava and dagger2
Stars: ✭ 21 (+31.25%)
Mutual labels:  rxandroid, rxjava2

Preference Rhythm

Android library makes using Shared Preference easier.

Features

  • Support RxJava 2
  • Encrypt Data
  • Support Iterable
  • Build on top of repository design pattern

Installation

Add this to your module build.gradle file:

dependencies {
    ...
     compile "com.github.anasanasanas:Preference-Rhythm:1.0.0"
}

Add this to your root build.gradle file:

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

How to use Preference Rhythm ?

just extend PreferenceRepoImpl with the Object you want to save.

public class CountryPreferenceRepo extends PreferenceRepoImpl<Country> {
    public CountryPreferenceRepo(Context context, Class<Country> clazz) {
        super(context, clazz);
    }

    @Override
    public boolean encryptData() {
        return false;
    }

    @Override
    public String encryptionKey() {
        return null;
    }
}

OR

public class UserTokenPreferenceRepo extends PreferenceRepoImpl<String> {
    public UserTokenPreferenceRepo(Context context, Class<String> clazz) {
        super(context, clazz);
    }

    @Override
    public boolean encryptData() {
        return true;
    }

    @Override
    public String encryptionKey() {
        return "8N5zx1CUFyoE7Z3WuUq5SX14ziWKBJti";
    }
}

Then

        //check if the shared preference is empty and return boolean value
        userTokenPreferenceRepo.isEmpty();

        //clear the shared preference data
        userTokenPreferenceRepo.clear();

        //save the object in the shared preference
        userTokenPreferenceRepo.saveObject("Token");

        //get the object in the shared preference, if nothing saved return null
        userTokenPreferenceRepo.getObject();

        //save list of objects in the shared preference
        userTokenPreferenceRepo.saveList(new ArrayList<String>());

        //get the list saved in the shared preference, if nothing saved return null
        userTokenPreferenceRepo.getList();

        //return Observable that emits the Object
        userTokenPreferenceRepo.getObjectObservable();

        //return Observable that emits List of the objects
        userTokenPreferenceRepo.getListObservable();

Notes

  • Every class extend PreferenceRepoImpl has his own shared preference file.
  • If the Encryption key changed all the data in the shared preference will be cleared.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].