Skip to content

operando/Garum

Repository files navigation

Garum Build Status

Annotation style SharedPreferences.

Garum

How to use

Model

@Pref(name = "app_status")
public class AppStatus extends PrefModel {

    @PrefKey
    public String appName;

    @PrefKey
    public int startupCount;

    @PrefKey
    public boolean showNotification;
}

Save

AppStatus appStatus = new AppStatus();
appStatus.appName = "Garum";
appStatus.startupCount = ++appStatus.startupCount;
appStatus.showNotification = true;
appStatus.save();

XML

/data/data/[package name]/shared_prefs/app_status.xml

<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
    <string name="appName">Garum</string>
    <int name="startupCount" value="10" />
    <boolean name="showNotification" value="true" />
</map>

Documentation

Please refer to the Wiki.

Download

Download or grab via Maven:

<dependency>
    <groupId>com.os.operando.garum</groupId>
    <artifactId>garum</artifactId>
    <version>0.9.0</version>
</dependency>

or Gradle:

compile 'com.os.operando.garum:garum:0.9.0'

ProGuard

# Garum
-keepclasseswithmembers class com.os.operando.garum.annotations.** {
    *;
}
-keepclasseswithmembernames class * extends com.os.operando.garum.models.PrefModel {
    *;
}

License

Apache Version 2.0

Copyright (C) 2014 Shinobu Okano

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.