Search in sources :

Example 1 with PhoneNewVerifyTask

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

the class RewardVerificationPhoneFragment method addPhoneNumber.

private void addPhoneNumber() {
    PhoneNewVerifyTask task = new PhoneNewVerifyTask(currentCountryCode, currentPhoneNumber, null, newLoading, new GenericTaskHandler() {

        @Override
        public void beforeStart() {
            Helper.setViewEnabled(continueButton, false);
            Helper.setViewVisibility(continueButton, View.GONE);
        }

        @Override
        public void onSuccess() {
            if (listener != null) {
                listener.onPhoneAdded(currentCountryCode, currentPhoneNumber);
            }
            Helper.setViewText(textVerifyParagraph, getString(R.string.enter_phone_verify_code, countryCodePicker.getFullNumberWithPlus()));
            Helper.setViewVisibility(layoutCollect, View.GONE);
            Helper.setViewVisibility(layoutVerify, View.VISIBLE);
            Helper.setViewEnabled(continueButton, true);
            Helper.setViewVisibility(continueButton, View.VISIBLE);
        }

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

Example 2 with PhoneNewVerifyTask

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

the class RewardVerificationPhoneFragment method verifyPhoneNumber.

private void verifyPhoneNumber(String verificationCode) {
    PhoneNewVerifyTask task = new PhoneNewVerifyTask(currentCountryCode, currentPhoneNumber, verificationCode, verifyLoading, new GenericTaskHandler() {

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

        @Override
        public void onSuccess() {
            if (listener != null) {
                listener.onPhoneVerified();
            }
            Helper.setViewEnabled(verifyButton, true);
            Helper.setViewEnabled(editButton, true);
        }

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

Aggregations

GenericTaskHandler (com.odysee.app.tasks.GenericTaskHandler)2 PhoneNewVerifyTask (com.odysee.app.tasks.verification.PhoneNewVerifyTask)2