Created
July 3, 2013 20:45
-
-
Save ZavenArra/5922647 to your computer and use it in GitHub Desktop.
Android spring with robospice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LoginRequestListener implements RequestListener< LoginUser > { | |
@Override | |
public void onRequestFailure( SpiceException e ) { | |
//showProgress(false); | |
if(e instanceof NoNetworkException){ | |
Toast.makeText(LoginActivity.this, "Network connection is unavailable", Toast.LENGTH_LONG).show(); | |
spiceManager.cancelAllRequests(); | |
} else { | |
Toast.makeText(LoginActivity.this, "Error during request: " + e.getMessage(), Toast.LENGTH_LONG); | |
e.printStackTrace(); | |
} | |
} | |
@Override | |
public void onRequestSuccess( LoginUser response ) { | |
if ( response == null ){ | |
mEmailView.setError("Email address not found"); | |
return; | |
} | |
// Found a user record, store the record and verify the user's country | |
mLoginFormView.setVisibility(View.GONE); | |
loginUser = response; | |
showCountryVerificationForm(); | |
} | |
} | |
spiceManager.execute( new LoginRequest(mEmail), JSON_CACHE_KEY, DurationInMillis.NEVER, new LoginRequestListener() ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment