@Override public Account getAccount() { Account account = new Account(); account.setCookie(get(COOKIE)); account.setUsername(get(USERNAME)); account.setExpirationDate(Utils.parse(get(EXPIRATION_DATE))); account.setType(get(TYPE)); account.setEmailAdress(get(EMAIL)); account.setPassword(get(PASSWORD)); account.setLastLogin(Utils.parse(get(LAST_LOGIN))); return account; }
@Override public void persist(Account account) { SharedPreferences.Editor editor = mPreferences.edit(); put(COOKIE, account.getCookie(), editor); put(USERNAME, account.getUsername(), editor); put(EXPIRATION_DATE, Utils.format(account.getExpirationDate()), editor); put(TYPE, account.getType(), editor); put(EMAIL, account.getEmailAdress(), editor); put(PASSWORD, account.getPassword(), editor); put(LAST_LOGIN, Utils.format(account.getLastLogin()), editor); editor.apply(); }