Exemple #1
0
 /**
  * 将密码设置到本地
  *
  * @param context
  * @param mIndexs
  */
 public static void setPwdToDisk(Context context, String userName, int[] mIndexs) {
   if (StrUtils.isBlank(userName)) return;
   String str = "";
   for (int i : mIndexs) {
     str += i + ",";
   }
   SPUtils.putString(context, preGs + userName, str);
 }
Exemple #2
0
 public static boolean isNightMode(AppCompatActivity activity) {
   int uiMode = activity.getResources().getConfiguration().uiMode;
   int dayNightUiMode = uiMode & Configuration.UI_MODE_NIGHT_MASK;
   if (SPUtils.getBoolean(MainActivity.CURRENT_NIGHT_MODE)
       && dayNightUiMode != Configuration.UI_MODE_NIGHT_YES) {
     activity.getDelegate().setLocalNightMode(AppCompatDelegate.MODE_NIGHT_YES);
     activity.recreate();
     return true;
   }
   return false;
 }
Exemple #3
0
 /**
  * 获取本地密码
  *
  * @return
  */
 public static int[] getPwd(Context context, String userName) {
   String str = SPUtils.getString(context, preGs + userName);
   if (!StrUtils.isBlank(str) && !StrUtils.isBlank(userName)) {
     String[] s = str.split(",");
     int[] indexs = new int[s.length];
     if (s.length > 1) {
       for (int i = 0; i < s.length; i++) {
         indexs[i] = Integer.valueOf(s[i]);
       }
     }
     return indexs;
   }
   return new int[] {};
 }
Exemple #4
0
 /**
  * 清空本地密码
  *
  * @param context
  */
 public static void clearPwd(Context context, String userName) {
   if (!StrUtils.isBlank(userName)) SPUtils.putString(context, preGs + userName, "");
 }
Exemple #5
0
  /**
   * 获取当前是否开启手势密码 true:开启 false:关闭
   *
   * @param context
   * @return
   */
  public static boolean getPwdStatus(Context context, String userName) {
    if (StrUtils.isBlank(userName)) return false;

    return SPUtils.getBoolean(context, preOS + userName, false);
  }
Exemple #6
0
 /** 是否开启手势密码 true:开启 false:关闭 */
 public static void setPwdStatus(Context context, String userName, boolean flag) {
   if (StrUtils.isBlank(userName)) return;
   SPUtils.putBoolean(context, preOS + userName, flag);
 }