Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void onRegisterClick(View v) {
- progressBar.setVisibility(View.VISIBLE);
- progressBar.animate().alpha(1).setDuration(500).start();
- final String username = usernameEditText.getText().toString();
- final String password = passwordEditText.getText().toString();
- RegistrationDTO dto = new RegistrationDTO(username, password);
- registrationService.callback(new Callback() {
- @Override
- public void onResponse(Call<RegistrationDTO> call, Response<RegistrationResult> response) {
- progressBar.setVisibility(View.GONE);
- storage.putString(USERNAME, username);
- storage.putString(PASSWORD, password);
- Intent nextActivity = new Intent(RegistrationActivity.this, NextActivity.class);
- nextActivity.launch();
- }
- @Override
- public void onFailure(Throwable t) {
- progressBar.setVisibility(View.GONE);
- if (t instanceof ConnectException) {
- new CustomAlertDialog.Builder()
- .setMessage("Internet unavailable")
- .build()
- .show();
- }
- else {
- new CustomAlertDialog.Builder()
- .setMessage("An unknown error has occurred")
- .build()
- .show();
- }
- }
- }).enqueue();
- }
Add Comment
Please, Sign In to add comment