Search in sources :

Example 6 with ClaimListTask

use of com.odysee.app.tasks.claim.ClaimListTask in project odysee-android by OdyseeTeam.

the class MainActivity method fetchOwnChannels.

public void fetchOwnChannels() {
    ClaimListTask task = new ClaimListTask(Claim.TYPE_CHANNEL, null, Lbryio.AUTH_TOKEN, new ClaimListResultHandler() {

        @Override
        public void onSuccess(List<Claim> claims) {
            Lbry.ownChannels = Helper.filterDeletedClaims(new ArrayList<>(claims));
            for (FetchChannelsListener listener : fetchChannelsListeners) {
                listener.onChannelsFetched(claims);
            }
        }

        @Override
        public void onError(Exception error) {
            Log.e("FetchingChannels", "onError: ".concat(error.getLocalizedMessage()));
        }
    });
    task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Also used : ClaimListResultHandler(com.odysee.app.tasks.claim.ClaimListResultHandler) ClaimListTask(com.odysee.app.tasks.claim.ClaimListTask) FetchChannelsListener(com.odysee.app.listener.FetchChannelsListener) Claim(com.odysee.app.model.Claim) JSONException(org.json.JSONException) LbryUriException(com.odysee.app.exceptions.LbryUriException) ExecutionException(java.util.concurrent.ExecutionException) SQLiteException(android.database.sqlite.SQLiteException) LbryioRequestException(com.odysee.app.exceptions.LbryioRequestException) LbryioResponseException(com.odysee.app.exceptions.LbryioResponseException) ApiCallException(com.odysee.app.exceptions.ApiCallException) AuthTokenInvalidatedException(com.odysee.app.exceptions.AuthTokenInvalidatedException) ParseException(java.text.ParseException)

Example 7 with ClaimListTask

use of com.odysee.app.tasks.claim.ClaimListTask in project odysee-android by OdyseeTeam.

the class FileViewFragment method fetchChannels.

private void fetchChannels() {
    if (Lbry.ownChannels != null && !Lbry.ownChannels.isEmpty()) {
        updateChannelList(Lbry.ownChannels);
        return;
    }
    fetchingChannels = true;
    disableChannelSpinner();
    ClaimListTask task = new ClaimListTask(Claim.TYPE_CHANNEL, progressLoadingChannels, new ClaimListResultHandler() {

        @Override
        public void onSuccess(List<Claim> claims) {
            Lbry.ownChannels = new ArrayList<>(claims);
            updateChannelList(Lbry.ownChannels);
            enableChannelSpinner();
            fetchingChannels = false;
        }

        @Override
        public void onError(Exception error) {
            enableChannelSpinner();
            fetchingChannels = false;
        }
    });
    task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Also used : ClaimListResultHandler(com.odysee.app.tasks.claim.ClaimListResultHandler) ArrayList(java.util.ArrayList) ClaimListTask(com.odysee.app.tasks.claim.ClaimListTask) 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)

Example 8 with ClaimListTask

use of com.odysee.app.tasks.claim.ClaimListTask in project odysee-android by OdyseeTeam.

the class CreateSupportDialogFragment method fetchChannels.

private void fetchChannels() {
    if (Lbry.ownChannels != null && !Lbry.ownChannels.isEmpty()) {
        updateChannelList(Lbry.ownChannels);
        return;
    }
    fetchingChannels = true;
    disableChannelSpinner();
    ClaimListTask task = new ClaimListTask(Claim.TYPE_CHANNEL, progressLoadingChannels, new ClaimListResultHandler() {

        @Override
        public void onSuccess(List<Claim> claims) {
            Lbry.ownChannels = new ArrayList<>(claims);
            updateChannelList(Lbry.ownChannels);
            enableChannelSpinner();
            fetchingChannels = false;
        }

        @Override
        public void onError(Exception error) {
            enableChannelSpinner();
            fetchingChannels = false;
        }
    });
    task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Also used : ClaimListResultHandler(com.odysee.app.tasks.claim.ClaimListResultHandler) ArrayList(java.util.ArrayList) ClaimListTask(com.odysee.app.tasks.claim.ClaimListTask) Claim(com.odysee.app.model.Claim) ApiCallException(com.odysee.app.exceptions.ApiCallException) ExecutionException(java.util.concurrent.ExecutionException)

Example 9 with ClaimListTask

use of com.odysee.app.tasks.claim.ClaimListTask in project odysee-android by OdyseeTeam.

the class FirstRunActivity method checkChannelStep.

private void checkChannelStep() {
    ClaimListTask task = new ClaimListTask(Claim.TYPE_CHANNEL, null, Lbryio.AUTH_TOKEN, new ClaimListResultHandler() {

        @Override
        public void onSuccess(List<Claim> claims) {
            onRequestInProgress(false);
            if (claims.size() == 0) {
                // no channels, move to first run step: channel
                checkEmailVerifiedRewardForChannelStep();
            } else {
                // this user already has a channel, move to the final step: rewards verification
                proceedToRewardsStep();
            }
        }

        @Override
        public void onError(Exception error) {
            checkEmailVerifiedRewardForChannelStep();
        // onRequestCompleted(FIRST_RUN_STEP_CHANNEL);
        }
    });
    task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Also used : ClaimListResultHandler(com.odysee.app.tasks.claim.ClaimListResultHandler) ClaimListTask(com.odysee.app.tasks.claim.ClaimListTask) Claim(com.odysee.app.model.Claim) LbryioRequestException(com.odysee.app.exceptions.LbryioRequestException) LbryioResponseException(com.odysee.app.exceptions.LbryioResponseException) ApiCallException(com.odysee.app.exceptions.ApiCallException) IOException(java.io.IOException)

Example 10 with ClaimListTask

use of com.odysee.app.tasks.claim.ClaimListTask in project odysee-android by OdyseeTeam.

the class LibraryFragment method fetchOwnClaimsAndShowDownloads.

private void fetchOwnClaimsAndShowDownloads() {
    if (Lbry.ownClaims != null && Lbry.ownClaims.size() > 0) {
        initialOwnClaimsFetched = true;
        fetchDownloads();
        return;
    }
    linkStats.setVisibility(View.INVISIBLE);
    ClaimListTask task = new ClaimListTask(Arrays.asList(Claim.TYPE_STREAM, Claim.TYPE_REPOST), listLoading, new ClaimListResultHandler() {

        @Override
        public void onSuccess(List<Claim> claims) {
            Lbry.ownClaims = Helper.filterDeletedClaims(new ArrayList<>(claims));
            initialOwnClaimsFetched = true;
            if (currentFilter == FILTER_DOWNLOADS) {
                fetchDownloads();
            }
            checkStatsLink();
        }

        @Override
        public void onError(Exception error) {
            initialOwnClaimsFetched = true;
            checkStatsLink();
        }
    });
    task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Also used : ClaimListResultHandler(com.odysee.app.tasks.claim.ClaimListResultHandler) ClaimListTask(com.odysee.app.tasks.claim.ClaimListTask) Claim(com.odysee.app.model.Claim) JSONException(org.json.JSONException) ApiCallException(com.odysee.app.exceptions.ApiCallException)

Aggregations

Claim (com.odysee.app.model.Claim)11 ClaimListResultHandler (com.odysee.app.tasks.claim.ClaimListResultHandler)11 ClaimListTask (com.odysee.app.tasks.claim.ClaimListTask)11 ApiCallException (com.odysee.app.exceptions.ApiCallException)6 ArrayList (java.util.ArrayList)5 JSONException (org.json.JSONException)5 LbryioRequestException (com.odysee.app.exceptions.LbryioRequestException)4 LbryioResponseException (com.odysee.app.exceptions.LbryioResponseException)4 ExecutionException (java.util.concurrent.ExecutionException)4 Context (android.content.Context)3 MainActivity (com.odysee.app.MainActivity)3 LbryUriException (com.odysee.app.exceptions.LbryUriException)3 SQLiteException (android.database.sqlite.SQLiteException)2 ClaimListAdapter (com.odysee.app.adapter.ClaimListAdapter)2 AuthTokenInvalidatedException (com.odysee.app.exceptions.AuthTokenInvalidatedException)2 IOException (java.io.IOException)2 ParseException (java.text.ParseException)2 Account (android.accounts.Account)1 AccountManager (android.accounts.AccountManager)1 View (android.view.View)1