@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (PrefUtils.isUserLogged(prefs)) { BarazkideCache.init(prefs); UserCache.init(prefs); finish(); GardensActivity_.intent(this).start(); } }
@UiThread void validateUserResult(User user) { if (UserUtils.isEmptyUser(user)) { prefs.user().put(""); prefs.pass().put(""); Toast.makeText(this, "Incorrect user or password.", Toast.LENGTH_SHORT).show(); } else { loginUser(user); BarazkideCache.init(prefs); UserCache.init(prefs); finish(); GardensActivity_.intent(this).start(); } dialog.cancel(); }
@UiThread void createAccountResult(int result) { switch (result) { case USER_EXISTS: Toast.makeText(this, "User already exists!", Toast.LENGTH_LONG).show(); dialog.cancel(); break; case REGISTER_OK: Toast.makeText(this, "User registered", Toast.LENGTH_LONG).show(); dialog.cancel(); finish(); GardensActivity_.intent(this).start(); break; case REGISTER_ERROR: Toast.makeText(this, "Error creating user!", Toast.LENGTH_LONG).show(); dialog.cancel(); break; } }