|
|
@@ -2,9 +2,12 @@ package com.sheep.jiuyan.samllsheep.utils;
|
|
|
|
|
|
import android.content.Context;
|
|
|
import android.content.SharedPreferences;
|
|
|
+import android.text.TextUtils;
|
|
|
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
|
|
|
+import go.kfzssafe.Kfzssafe;
|
|
|
+
|
|
|
/**
|
|
|
* Created by kemllor on 2017/12/21.
|
|
|
*/
|
|
|
@@ -49,6 +52,7 @@ public class SpUtils {
|
|
|
SharedPreferences user = SheepApp.getInstance().getSharedPreferences("user", Context.MODE_PRIVATE);
|
|
|
return user.getBoolean(key, false);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 存入一些小型的用户数据
|
|
|
*
|
|
|
@@ -118,6 +122,24 @@ public class SpUtils {
|
|
|
return user.getString("device_id", "");
|
|
|
}
|
|
|
|
|
|
+ public static void saveUp(Context context, String u, String p) {
|
|
|
+ SharedPreferences user = context.getSharedPreferences("up", Context.MODE_PRIVATE);
|
|
|
+ SharedPreferences.Editor editor = user.edit();
|
|
|
+ editor.putString("u_" + u, Kfzssafe.xEncodeS2S(p));
|
|
|
+ editor.apply();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public static String getUp(Context context, String u) {
|
|
|
+ SharedPreferences user = context.getSharedPreferences("up", Context.MODE_PRIVATE);
|
|
|
+ String p = user.getString("u_" + u, "");
|
|
|
+ if (TextUtils.isEmpty(p)) {
|
|
|
+ return "";
|
|
|
+ } else {
|
|
|
+ return Kfzssafe.xDecodeS2S(p);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 保存要忽略的版本的md5值,只能忽略一个
|
|
|
@@ -136,7 +158,7 @@ public class SpUtils {
|
|
|
return user.getString("ignore_md5", "");
|
|
|
}
|
|
|
|
|
|
- public static void saveVoucherFirst(){
|
|
|
+ public static void saveVoucherFirst() {
|
|
|
SharedPreferences sp = SheepApp.getInstance().getSharedPreferences("first", Context.MODE_PRIVATE);
|
|
|
SharedPreferences.Editor editor = sp.edit();
|
|
|
editor.putBoolean("first.personcenter.voucher", false);
|
|
|
@@ -147,7 +169,8 @@ public class SpUtils {
|
|
|
SharedPreferences sp = SheepApp.getInstance().getSharedPreferences("first", Context.MODE_PRIVATE);
|
|
|
return sp.getBoolean("first.personcenter.voucher", true);
|
|
|
}
|
|
|
- public static void putAsBoolean(String key, boolean value){
|
|
|
+
|
|
|
+ public static void putAsBoolean(String key, boolean value) {
|
|
|
SharedPreferences sp = SheepApp.getInstance().getSharedPreferences("app", Context.MODE_PRIVATE);
|
|
|
SharedPreferences.Editor editor = sp.edit();
|
|
|
editor.putBoolean(key, value);
|