SharedPreference Helper.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config/findbugs
gradle/wrapper
prefkit
sample
.gitignore
Dangerfile
Gemfile
Gemfile.lock
LICENSE
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
settings.gradle
wercker.yml

README.md

PrefKit

wercker status jitpack codecov License

Typesafe key-value store for Android. Inspired by Retrofit.

Update

  • 0.0.2 First release.

How to

Step 1. Add the JitPack repository to your build file.
  repositories {
    maven {
      url "https://jitpack.io"
    }
  }
Step 2. Add the dependency.
  dependencies {
    compile 'com.github.kazy1991:PrefKit:0.0.2'
  }
Step 3. Define get/put method with Interface.
@PrefSchema("SampleSchema")
interface SampleSchema {

    String WELCOME_DIALOG = "welcome_dialog";

    @PrefKey(WELCOME_DIALOG)
    void putWelcomeDialogFlag(boolean value);

    @PrefKey(WELCOME_DIALOG)
    boolean getWelcomeDialogFlag(boolean defaultValue);
}

@PrefSchema: Define sharedPreference name.

@PrefKey: Define key name.

Step 4. Access sharedPreference via interface.

PrefKit prefKit = new PrefKit(this);
SampleSchema sampleSchema = prefKit.create(SampleSchema.class);
sampleSchema.setWelcomeDialogFlag(true);
sampleSchema.getWelcomeDialogFlag(false);

License

MIT License