opt: independent runtime
This commit is contained in:
32
autojs/src/main/java/com/stardust/autojs/Pref.java
Normal file
32
autojs/src/main/java/com/stardust/autojs/Pref.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.stardust.autojs;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/12/8.
|
||||
*/
|
||||
|
||||
public class Pref {
|
||||
|
||||
|
||||
private static Pref sInstance;
|
||||
private SharedPreferences mSharedPreferences;
|
||||
|
||||
public Pref(Context context) {
|
||||
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
}
|
||||
|
||||
public static void setInstance(Pref instance) {
|
||||
if (sInstance != null)
|
||||
throw new IllegalStateException();
|
||||
sInstance = instance;
|
||||
}
|
||||
|
||||
public static Pref getInstance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user