@@ -0,0 +1,1906 @@
+package com.joker.fourfun.utils;%0A%0Aimport android.app.Activity;%0Aimport android.content.SharedPreferences;%0Aimport android.support.v7.app.AppCompatActivity;%0A%0Aimport com.joker.fourfun.FourFun;%0A%0Aimport static android.content.Context.MODE_PRIVATE;%0A%0A/**%0A * Created by joker on 2017/1/4.%0A */%0A%0Apublic class PreferenceUtil %7B%0A    public static final String DEFAULT_PREFERENCES_FILE = %22fourfun%22;%0A%0A    public static SharedPreferences getSp() %7B%0A        return FourFun.getInstance().getContext().getSharedPreferences%0A                (DEFAULT_PREFERENCES_FILE,%0A                        MODE_PRIVATE);%0A    %7D%0A%0A    public static SharedPreferences getSp(Activity activity, String name) %7B%0A        return activity.getSharedPreferences(name, MODE_PRIVATE);%0A    %7D%0A%0A    /**%0A     * %E9%BB%98%E8%AE%A4%E7%9A%84%E5%AD%98%E5%80%BC%0A     *%0A     * @param key%0A     * @param value%0A     */%0A    public static void putBoolean(String key, boolean value) %7B%0A        getSp().edit().putBoolean(key, value).apply();%0A    %7D%0A%0A    /**%0A     * %E6%90%BA%E6%9C%89 sharedPreference %E6%96%87%E4%BB%B6%E5%90%8D%E7%9A%84%E5%AD%98%E5%80%BC%E6%96%B9%E6%B3%95%0A     *%0A     * @param activity%0A     * @param name%0A     * @param key%0A     * @param value%0A     */%0A    public static void putBoolean(AppCompatActivity activity, String name, String key, boolean value) %7B%0A        getSp(activity, name).edit().putBoolean(key, value).apply();%0A    %7D%0A%0A    /**%0A     * %E9%BB%98%E8%AE%A4%E5%8F%96%E5%80%BC%0A     *%0A     * @param key%0A     */%0A    public static boolean getDefaultFalse(String key) %7B%0A        return getSp().getBoolean(key, false);%0A    %7D%0A%0A    public static boolean getDefaultFalse(AppCompatActivity activity, String name, String key) %7B%0A        return getSp(activity, name).getBoolean(key, false);%0A    %7D%0A%0A    public static boolean getBoolean(String key, boolean defValue) %7B%0A        return getSp().getBoolean(key, defValue);%0A    %7D%0A%0A    public static boolean getBoolean(AppCompatActivity activity, String name, String key, boolean%0A            defValue) %7B%0A        return getSp(activity, name).getBoolean(key, defValue);%0A    %7D%0A%7D%0A

add preference util