Search in sources :

Example 71 with MainActivity

use of com.odysee.app.MainActivity in project odysee-android by OdyseeTeam.

the class AddToListsDialogFragment method onPlaylistsLoaded.

private void onPlaylistsLoaded(List<OdyseeCollection> collections) {
    Helper.setViewVisibility(loadProgress, View.INVISIBLE);
    CollectionListAdapter adapter = new CollectionListAdapter(collections, getContext());
    adapter.setListener(new CollectionListAdapter.CollectionListItemCheckChangedListener() {

        @Override
        public void onCheckedChanged(OdyseeCollection collection, boolean checked) {
            if (!Helper.isNullOrEmpty(url)) {
                Context context = getContext();
                if (context instanceof MainActivity) {
                    MainActivity activity = (MainActivity) context;
                    if (checked) {
                        activity.handleAddUrlToList(url, collection, false);
                    } else {
                        activity.handleRemoveUrlFromList(url, collection);
                    }
                }
            }
        }
    });
    if (collectionList != null) {
        collectionList.setAdapter(adapter);
    }
}
Also used : Context(android.content.Context) CollectionListAdapter(com.odysee.app.adapter.CollectionListAdapter) MainActivity(com.odysee.app.MainActivity) OdyseeCollection(com.odysee.app.model.OdyseeCollection)

Example 72 with MainActivity

use of com.odysee.app.MainActivity in project odysee-android by OdyseeTeam.

the class CreateSupportDialogFragment method onResume.

@Override
public void onResume() {
    super.onResume();
    Context context = getContext();
    if (context instanceof MainActivity) {
        ((MainActivity) context).addWalletBalanceListener(this);
    }
    updateInfoText();
    fetchChannels();
}
Also used : Context(android.content.Context) MainActivity(com.odysee.app.MainActivity)

Example 73 with MainActivity

use of com.odysee.app.MainActivity in project odysee-android by OdyseeTeam.

the class RepostClaimDialogFragment method onPause.

@Override
public void onPause() {
    Context context = getContext();
    if (context instanceof MainActivity) {
        ((MainActivity) context).removeWalletBalanceListener(this);
    }
    inputDeposit.clearFocus();
    super.onPause();
}
Also used : Context(android.content.Context) MainActivity(com.odysee.app.MainActivity)

Example 74 with MainActivity

use of com.odysee.app.MainActivity in project odysee-android by OdyseeTeam.

the class RepostClaimDialogFragment method onResume.

@Override
public void onResume() {
    super.onResume();
    Context context = getContext();
    if (context instanceof MainActivity) {
        ((MainActivity) context).addWalletBalanceListener(this);
    }
    fetchChannels();
}
Also used : Context(android.content.Context) MainActivity(com.odysee.app.MainActivity)

Example 75 with MainActivity

use of com.odysee.app.MainActivity in project odysee-android by OdyseeTeam.

the class RepostClaimDialogFragment method fetchChannels.

private void fetchChannels() {
    if (Lbry.ownChannels == null || Lbry.ownChannels.size() == 0) {
        startLoading();
        ClaimListTask task = new ClaimListTask(Claim.TYPE_CHANNEL, repostProgress, new ClaimListResultHandler() {

            @Override
            public void onSuccess(List<Claim> claims) {
                Lbry.ownChannels = new ArrayList<>(claims);
                loadChannels(claims);
                finishLoading();
            }

            @Override
            public void onError(Exception error) {
                // could not fetch channels
                Context context = getContext();
                if (context instanceof MainActivity) {
                    ((MainActivity) context).showError(error.getMessage());
                }
                dismiss();
            }
        });
        task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    } else {
        loadChannels(Lbry.ownChannels);
    }
}
Also used : Context(android.content.Context) ClaimListResultHandler(com.odysee.app.tasks.claim.ClaimListResultHandler) ArrayList(java.util.ArrayList) ClaimListTask(com.odysee.app.tasks.claim.ClaimListTask) MainActivity(com.odysee.app.MainActivity) Claim(com.odysee.app.model.Claim)

Aggregations

MainActivity (com.odysee.app.MainActivity)138 Context (android.content.Context)119 Claim (com.odysee.app.model.Claim)39 View (android.view.View)31 TextView (android.widget.TextView)30 RecyclerView (androidx.recyclerview.widget.RecyclerView)26 AttributeProviderContext (org.commonmark.renderer.html.AttributeProviderContext)25 ArrayList (java.util.ArrayList)21 TrackSelectionOverride (com.google.android.exoplayer2.trackselection.TrackSelectionOverrides.TrackSelectionOverride)19 ImageView (android.widget.ImageView)18 SuppressLint (android.annotation.SuppressLint)15 AdapterView (android.widget.AdapterView)14 NestedScrollView (androidx.core.widget.NestedScrollView)14 JSONException (org.json.JSONException)13 JSONObject (org.json.JSONObject)13 SolidIconView (com.odysee.app.ui.controls.SolidIconView)12 HashMap (java.util.HashMap)12 ClaimListAdapter (com.odysee.app.adapter.ClaimListAdapter)11 ApiCallException (com.odysee.app.exceptions.ApiCallException)11 WebView (android.webkit.WebView)10