DemoCache整理
This commit is contained in:
@@ -3,20 +3,25 @@ package com.yizhuan.xchat_android_library.utils.pref;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
public class ObjectPref extends XSharedPref
|
||||
{
|
||||
private static ObjectPref sInst;
|
||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
||||
|
||||
private ObjectPref(SharedPreferences preferences){
|
||||
super(preferences);
|
||||
}
|
||||
public class ObjectPref extends XSharedPref {
|
||||
private static ObjectPref sInst;
|
||||
|
||||
public synchronized static ObjectPref instance(Context applicationContext) {
|
||||
if(sInst == null){
|
||||
SharedPreferences pref = applicationContext.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
|
||||
sInst = new ObjectPref(pref);
|
||||
}
|
||||
return sInst;
|
||||
}
|
||||
private ObjectPref(SharedPreferences preferences) {
|
||||
super(preferences);
|
||||
}
|
||||
|
||||
public synchronized static ObjectPref instance(Context applicationContext) {
|
||||
if (sInst == null) {
|
||||
SharedPreferences pref = applicationContext.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
|
||||
sInst = new ObjectPref(pref);
|
||||
}
|
||||
return sInst;
|
||||
}
|
||||
|
||||
public static ObjectPref instance() {
|
||||
return instance(BasicConfig.INSTANCE.getAppContext());
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -14,32 +14,28 @@ import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
||||
*/
|
||||
public class SettingsPref extends YSharedPref {
|
||||
|
||||
private static SettingsPref instanse;
|
||||
private static SettingsPref instance;
|
||||
|
||||
private SettingsPref(SharedPreferences preferences){
|
||||
private SettingsPref(SharedPreferences preferences) {
|
||||
super(preferences);
|
||||
}
|
||||
|
||||
public synchronized static SettingsPref instance(Context applicationContext) {
|
||||
if (instance == null) {
|
||||
SharedPreferences pref = applicationContext.getSharedPreferences("SettingsPrefs", Context.MODE_PRIVATE);
|
||||
instance = new SettingsPref(pref);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static SettingsPref instance() {
|
||||
return instance(BasicConfig.INSTANCE.getAppContext());
|
||||
}
|
||||
|
||||
public SharedPreferences getSharePref() {
|
||||
return mPref;
|
||||
}
|
||||
|
||||
public synchronized static SettingsPref instance(Context applicationContext) {
|
||||
if(instanse == null){
|
||||
SharedPreferences pref = applicationContext.getSharedPreferences("SettingsPrefs", Context.MODE_PRIVATE);
|
||||
instanse = new SettingsPref(pref);
|
||||
}
|
||||
return instanse;
|
||||
}
|
||||
|
||||
public synchronized static SettingsPref instance() {
|
||||
if(instanse == null){
|
||||
SharedPreferences pref = BasicConfig.INSTANCE.getAppContext().getSharedPreferences("SettingsPrefs", Context.MODE_PRIVATE);
|
||||
instanse = new SettingsPref(pref);
|
||||
}
|
||||
return instanse;
|
||||
}
|
||||
|
||||
public String getString(String key, String defaultValue) {
|
||||
return get(key) == null ? defaultValue : get(key);
|
||||
}
|
||||
|
Reference in New Issue
Block a user