use of com.odysee.app.tasks.GenericTaskHandler 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);
}
use of com.odysee.app.tasks.GenericTaskHandler in project odysee-android by OdyseeTeam.
the class ManualVerificationFragment method onCreateView.
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_verification_manual, container, false);
mainView = root.findViewById(R.id.verification_manual_main);
loadingView = root.findViewById(R.id.verification_manual_loading);
Context context = getContext();
MaterialButton buttonSkipQueue = root.findViewById(R.id.verification_manual_skip_queue);
buttonSkipQueue.setText(context.getString(R.string.skip_queue_button_text, String.valueOf(SKIP_QUEUE_PRICE)));
Helper.applyHtmlForTextView(root.findViewById(R.id.verification_manual_discord_verify));
root.findViewById(R.id.verification_manual_twitter_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// start twitter verification
if (currentOauth != null) {
// Twitter three-legged oauth already completed, verify directly
twitterVerify(currentOauth);
} else {
// show twitter sign-in flow
// twitterVerificationFlow();
}
}
});
root.findViewById(R.id.verification_manual_skip_queue_verify).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showLoading();
if (MainActivity.instance != null) {
MainActivity.instance.getPurchasedChecker().checkPurchases(new GenericTaskHandler() {
@Override
public void beforeStart() {
}
@Override
public void onSuccess() {
hideLoading();
listener.onManualVerifyContinue();
}
@Override
public void onError(Exception error) {
hideLoading();
showError(error.getMessage());
}
});
}
}
});
root.findViewById(R.id.verification_manual_phone_number_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
((VerificationActivity) getContext()).showPhoneVerification();
}
});
root.findViewById(R.id.verification_manual_continue_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.onManualVerifyContinue();
}
}
});
root.findViewById(R.id.verification_manual_skip_queue).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.onSkipQueueAction();
}
}
});
return root;
}
use of com.odysee.app.tasks.GenericTaskHandler 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);
}
use of com.odysee.app.tasks.GenericTaskHandler 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);
}
use of com.odysee.app.tasks.GenericTaskHandler in project odysee-android by OdyseeTeam.
the class FileViewFragment method deleteClaimFile.
private void deleteClaimFile() {
Claim actualClaim = collectionClaimItem != null ? collectionClaimItem : fileClaim;
if (actualClaim != null) {
View actionDelete = getView().findViewById(R.id.file_view_action_delete);
DeleteFileTask task = new DeleteFileTask(actualClaim.getClaimId(), new GenericTaskHandler() {
@Override
public void beforeStart() {
actionDelete.setEnabled(false);
}
@Override
public void onSuccess() {
Helper.setViewVisibility(actionDelete, View.GONE);
View root = getView();
if (root != null) {
// root.findViewById(R.id.file_view_action_download).setVisibility(View.VISIBLE);
root.findViewById(R.id.file_view_unsupported_container).setVisibility(View.GONE);
}
Helper.setViewEnabled(actionDelete, true);
actualClaim.setFile(null);
Lbry.unsetFilesForCachedClaims(Arrays.asList(actualClaim.getClaimId()));
restoreMainActionButton();
}
@Override
public void onError(Exception error) {
actionDelete.setEnabled(true);
if (error != null) {
showError(error.getMessage());
}
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
Aggregations