Search in sources :

Example 1 with EmailResendTask

use of com.odysee.app.tasks.verification.EmailResendTask in project odysee-android by OdyseeTeam.

the class EmailVerificationFragment method resendEmail.

private void resendEmail() {
    EmailResendTask task = new EmailResendTask(currentEmail, null, new GenericTaskHandler() {

        @Override
        public void beforeStart() {
            Helper.setViewEnabled(buttonResend, false);
        }

        @Override
        public void onSuccess() {
            View view = getView();
            if (view != null) {
                Snackbar.make(view, R.string.please_follow_instructions, Snackbar.LENGTH_LONG).show();
            }
            Helper.setViewEnabled(buttonResend, true);
        }

        @Override
        public void onError(Exception error) {
            View view = getView();
            if (view != null && error != null) {
                Snackbar.make(view, error.getMessage(), Snackbar.LENGTH_LONG).setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
            }
            Helper.setViewEnabled(buttonResend, true);
        }
    });
    task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Also used : GenericTaskHandler(com.odysee.app.tasks.GenericTaskHandler) EmailResendTask(com.odysee.app.tasks.verification.EmailResendTask) View(android.view.View) TextView(android.widget.TextView)

Aggregations

View (android.view.View)1 TextView (android.widget.TextView)1 GenericTaskHandler (com.odysee.app.tasks.GenericTaskHandler)1 EmailResendTask (com.odysee.app.tasks.verification.EmailResendTask)1