Search in sources :

Example 1 with GenericTaskHandler

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);
}
Also used : PhoneNewVerifyTask(com.odysee.app.tasks.verification.PhoneNewVerifyTask) GenericTaskHandler(com.odysee.app.tasks.GenericTaskHandler)

Example 2 with GenericTaskHandler

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;
}
Also used : Context(android.content.Context) GenericTaskHandler(com.odysee.app.tasks.GenericTaskHandler) View(android.view.View) WebView(android.webkit.WebView) MaterialButton(com.google.android.material.button.MaterialButton)

Example 3 with GenericTaskHandler

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);
}
Also used : PhoneNewVerifyTask(com.odysee.app.tasks.verification.PhoneNewVerifyTask) GenericTaskHandler(com.odysee.app.tasks.GenericTaskHandler)

Example 4 with GenericTaskHandler

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);
}
Also used : GenericTaskHandler(com.odysee.app.tasks.GenericTaskHandler) EmailResendTask(com.odysee.app.tasks.verification.EmailResendTask) View(android.view.View) TextView(android.widget.TextView)

Example 5 with GenericTaskHandler

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);
    }
}
Also used : GenericTaskHandler(com.odysee.app.tasks.GenericTaskHandler) SolidIconView(com.odysee.app.ui.controls.SolidIconView) PlayerView(com.google.android.exoplayer2.ui.PlayerView) NestedScrollView(androidx.core.widget.NestedScrollView) AdapterView(android.widget.AdapterView) RecyclerView(androidx.recyclerview.widget.RecyclerView) PhotoView(com.github.chrisbanes.photoview.PhotoView) ImageView(android.widget.ImageView) View(android.view.View) WebView(android.webkit.WebView) TextView(android.widget.TextView) DeleteFileTask(com.odysee.app.tasks.file.DeleteFileTask) TrackSelectionOverride(com.google.android.exoplayer2.trackselection.TrackSelectionOverrides.TrackSelectionOverride) Claim(com.odysee.app.model.Claim) LbryRequestException(com.odysee.app.exceptions.LbryRequestException) JSONException(org.json.JSONException) LbryUriException(com.odysee.app.exceptions.LbryUriException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) LbryResponseException(com.odysee.app.exceptions.LbryResponseException) LbryioRequestException(com.odysee.app.exceptions.LbryioRequestException) LbryioResponseException(com.odysee.app.exceptions.LbryioResponseException) ApiCallException(com.odysee.app.exceptions.ApiCallException)

Aggregations

GenericTaskHandler (com.odysee.app.tasks.GenericTaskHandler)6 View (android.view.View)4 TextView (android.widget.TextView)3 Context (android.content.Context)2 WebView (android.webkit.WebView)2 AdapterView (android.widget.AdapterView)2 RecyclerView (androidx.recyclerview.widget.RecyclerView)2 Claim (com.odysee.app.model.Claim)2 PhoneNewVerifyTask (com.odysee.app.tasks.verification.PhoneNewVerifyTask)2 Editable (android.text.Editable)1 TextWatcher (android.text.TextWatcher)1 ImageView (android.widget.ImageView)1 CardView (androidx.cardview.widget.CardView)1 NestedScrollView (androidx.core.widget.NestedScrollView)1 PhotoView (com.github.chrisbanes.photoview.PhotoView)1 TrackSelectionOverride (com.google.android.exoplayer2.trackselection.TrackSelectionOverrides.TrackSelectionOverride)1 PlayerView (com.google.android.exoplayer2.ui.PlayerView)1 MaterialButton (com.google.android.material.button.MaterialButton)1 MainActivity (com.odysee.app.MainActivity)1 InlineChannelSpinnerAdapter (com.odysee.app.adapter.InlineChannelSpinnerAdapter)1