示例#1
0
  private void f_action_auto_login_success(
      interface_app_user_login_resp resp, interface_app_user_login_req req) {
    try {
      PreferencesUtils.putString(this, "user_id", resp.getUser_id());
      PreferencesUtils.putString(this, "user_icon", resp.getUser_icon());
      PreferencesUtils.putString(this, "user_type", resp.getUser_type());
      PreferencesUtils.putString(this, "user_name", req.getUser_name());
      PreferencesUtils.putString(this, "user_password", req.getUser_password());
      // --
      Intent intent = new Intent();

      intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
      intent.setClass(this, ActivityMain.class);
      startActivity(intent);
      finish();
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
示例#2
0
  private void init_folder_env() {
    try {

      String sd_path = tools.get_application_dir_path(this);
      PreferencesUtils.putString(this, global_contants.SYS_PATH_SD_CARD, sd_path);
      PreferencesUtils.putString(this, global_contants.SYS_PATH_APP_FOLDER, "/Lovebabies");
      PreferencesUtils.putString(this, global_contants.SYS_PATH_CACHE, "/cache");
      PreferencesUtils.putString(this, global_contants.SYS_PATH_TEMP, "/temp");
      PreferencesUtils.putString(this, global_contants.SYS_PATH_CRASH, "/crash");
      PreferencesUtils.putString(this, global_contants.SYS_PATH_UP, "/up");
      // --
      String app_path =
          PreferencesUtils.getString(this, global_contants.SYS_PATH_SD_CARD)
              + PreferencesUtils.getString(this, "sys_path_app_folder");
      String cache_path =
          app_path + PreferencesUtils.getString(this, global_contants.SYS_PATH_CACHE);
      String temp_path = app_path + PreferencesUtils.getString(this, global_contants.SYS_PATH_TEMP);
      String crash_path =
          app_path + PreferencesUtils.getString(this, global_contants.SYS_PATH_CRASH);
      String up_path = app_path + PreferencesUtils.getString(this, global_contants.SYS_PATH_UP);
      // --
      File folder_root = new File(app_path);
      if (!folder_root.exists()) {
        folder_root.mkdirs();
      }
      // --
      File folder_cache = new File(cache_path);
      if (!folder_cache.exists()) {
        folder_cache.mkdirs();
      }
      // --
      File folder_temp = new File(temp_path);
      if (!folder_temp.exists()) {
        folder_temp.mkdirs();
      }
      // --
      File folder_crash = new File(crash_path);
      if (!folder_crash.exists()) {
        folder_crash.mkdirs();
      }
      // --
      File up_crash = new File(up_path);
      if (!up_crash.exists()) {
        up_crash.mkdirs();
      }
    } catch (Exception e) {
      // TODO: handle exception
    }
  }