Fit
Fit is a library use apt by SharedPreferences store primitive field as Object.
Installation
Add it in your root build.gradle at the end of repositories:
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
Add the following dependency to your build.gradle file:
apply plugin: 'com.neenbedankt.android-apt'
dependencies {
compile 'com.github.2tu.fit:fit:0.1.2'
apt 'com.github.2tu.fit:fit-compiler:0.1.2'
}
Usage
annotation model class.
@SharedPreferenceAble
save
User user = new User("Three.Tu");
Fit.save(this, user);get
User user = Fit.get(this, User.class);clear
Fit.clear(this, User.class);What's new (0.1.1) - Changelog
- Save model as SharedPreferences(private static complex field not support)