59 lines
1.7 KiB
Java
59 lines
1.7 KiB
Java
package cn.com.magnity.magnitycx.sdk;
|
|
|
|
import android.content.Context;
|
|
import android.content.SharedPreferences;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class SharedPreferencesManager {
|
|
private static SharedPreferences.Editor editor_;
|
|
private static SharedPreferences preferences_;
|
|
|
|
public static void init(Context context) {
|
|
preferences_ = context.getApplicationContext().getSharedPreferences("magnitycx", 0);
|
|
editor_ = preferences_.edit();
|
|
}
|
|
|
|
public static boolean commit() {
|
|
return editor_.commit();
|
|
}
|
|
|
|
public static SharedPreferences.Editor putInt(String key, int value) {
|
|
return editor_.putInt(key, value);
|
|
}
|
|
|
|
public static void putIntWithCommit(String key, int value) {
|
|
editor_.putInt(key, value);
|
|
editor_.commit();
|
|
}
|
|
|
|
public static int getInt(String key, int defValue) {
|
|
return preferences_.getInt(key, defValue);
|
|
}
|
|
|
|
public static SharedPreferences.Editor putFloat(String key, float value) {
|
|
return editor_.putFloat(key, value);
|
|
}
|
|
|
|
public static void putFloatWithCommit(String key, float value) {
|
|
editor_.putFloat(key, value);
|
|
editor_.commit();
|
|
}
|
|
|
|
public static float getFloat(String key, float defValue) {
|
|
return preferences_.getFloat(key, defValue);
|
|
}
|
|
|
|
public static SharedPreferences.Editor putBoolean(String key, boolean value) {
|
|
return editor_.putBoolean(key, value);
|
|
}
|
|
|
|
public static void putBooleanWithCommit(String key, boolean value) {
|
|
editor_.putBoolean(key, value);
|
|
editor_.commit();
|
|
}
|
|
|
|
public static boolean getBoolean(String key, boolean defValue) {
|
|
return preferences_.getBoolean(key, defValue);
|
|
}
|
|
}
|