Search in sources :

Example 1 with CollectionListAdapter

use of com.odysee.app.adapter.CollectionListAdapter 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)

Aggregations

Context (android.content.Context)1 MainActivity (com.odysee.app.MainActivity)1 CollectionListAdapter (com.odysee.app.adapter.CollectionListAdapter)1 OdyseeCollection (com.odysee.app.model.OdyseeCollection)1