Skip to content
Snippets Groups Projects
Commit 6339109c authored by Ilham Firdausi Putra's avatar Ilham Firdausi Putra
Browse files

add preference helper

parent e801b871
No related merge requests found
package com.etsi.helper;
package com.chatman.helper;
import android.content.Context;
import android.content.SharedPreferences;
......@@ -6,13 +6,8 @@ import android.preference.PreferenceManager;
public class PreferencesHelper {
private static final String USER_ROLE_KEY = "user_role_key";
public static final boolean USER_ROLE_KREATOR = true;
public static final boolean USER_ROLE_SOBAT = false;
public static final String USER_FIREBASE_KEY = "user_firebase_key";
public static final String KREATOR1_TIER_KEY = "kreator1_tier_key";
public static final String KREATOR2_TIER_KEY = "kreator2_tier_key";
public static String CURRENT_KREATOR_KEY;
public static final String USER_NAME = "user_name";
private static void setBooleanPreferences(Context context, String key, boolean value) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
......@@ -50,14 +45,6 @@ public class PreferencesHelper {
return preferences.getInt(key, 0);
}
public static void setUserRole(Context context, boolean value) {
setBooleanPreferences(context, USER_ROLE_KEY, value);
}
public static boolean getUserRole(Context context) {
return getBooleanPreferences(context, USER_ROLE_KEY);
}
public static void setUserFirebaseKey(Context context, String value) {
setStringPreferences(context, USER_FIREBASE_KEY, value);
}
......@@ -66,28 +53,13 @@ public class PreferencesHelper {
return getStringPreferences(context, USER_FIREBASE_KEY);
}
public static void setKreator1TierKey(Context context, int value){
setIntPreferences(context, KREATOR1_TIER_KEY, value);
public static void setUserName(Context context, String value) {
setStringPreferences(context, USER_NAME, value);
}
public static int getKreator1TierKey(Context context){
return getIntPreferences(context, KREATOR1_TIER_KEY);
public static String getUserName(Context context) {
return getStringPreferences(context, USER_NAME);
}
public static void setKreator2TierKey(Context context, int value){
setIntPreferences(context, KREATOR2_TIER_KEY, value);
}
public static int getKreator2TierKey(Context context){
return getIntPreferences(context, KREATOR2_TIER_KEY);
}
public static String getCurrentKreatorKey() {
return CURRENT_KREATOR_KEY;
}
public static void setCurrentKreatorKey(String value) {
CURRENT_KREATOR_KEY = value;
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment