Skip to content

ConfigManager is an android library for manage your app shared preferences

License

Notifications You must be signed in to change notification settings

bariseser/Android-Config-Manager

Repository files navigation

AndroidConfigManager

user-friendly configuration wrapper for Android

version

Download

AndroidConfigManager is available in jitPack.

Gradle

First Add jitPack repositories in build.gradle(root)

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

Second Add the dependency build.gradle(App)

dependencies 
{
    implementation 'com.github.bariseser:AndroidConfigManager:Tag'
}

Usage

initialize ConfigManager
ConfigManager.getInstance().initialize(context, "settings");
Set/Get Config Items
  • AndroidConfigManager has a four getter and setter method.
  • All getter method need to config key and value parameters.
  • All setter method need to config key parameter. If you want to return default value when the key doesn't exist, just set second parameter
Example
ConfigManager.getInstance().setString("key", "value");
ConfigManager.getInstance().setInt("comment_count", 100); 
ConfigManager.getInstance().setBoolean("is_login", false); 
ConfigManager.getInstance().setLong("long", 12345678910L); 
ConfigManager.getInstance().setFloat("float", 9.52f);
ConfigManager.getInstance().getString("key", null);
ConfigManager.getInstance().getInt("comment_count", 0);
ConfigManager.getInstance().getBoolean("is_login", false);
ConfigManager.getInstance().getLong("long", 1234234243124L);
ConfigManager.getInstance().getFloat("float", 0.0f);
Delete Item
ConfigManager.getInstance().delete('comment_count');
Clear
ConfigManager.getInstance().clear();

Bugs

If you encounter any problems please feel the free to open an Issue.