Search in sources :

Example 1 with CollectionListAdapter

use of org.musicbrainz.mobile.adapter.list.CollectionListAdapter in project musicbrainz-android by jdamcd.

the class CollectionListFragment method onListItemClick.

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    CollectionListAdapter adapter = (CollectionListAdapter) getListAdapter();
    String title = adapter.getItem(position).getName();
    String mbid = adapter.getItem(position).getMbid();
    startActivity(IntentFactory.getCollection(appContext, title, mbid));
}
Also used : CollectionListAdapter(org.musicbrainz.mobile.adapter.list.CollectionListAdapter)

Example 2 with CollectionListAdapter

use of org.musicbrainz.mobile.adapter.list.CollectionListAdapter in project musicbrainz-android by jdamcd.

the class CollectionAddDialog method onLoadFinished.

@Override
public void onLoadFinished(Loader<AsyncResult<List<UserCollectionInfo>>> loader, AsyncResult<List<UserCollectionInfo>> result) {
    loading.setVisibility(View.GONE);
    switch(result.getStatus()) {
        case SUCCESS:
            List<UserCollectionInfo> collection = result.getData();
            try {
                adapter = new CollectionListAdapter(getActivity(), collection);
                if (adapter.isEmpty()) {
                    empty.setVisibility(View.VISIBLE);
                }
                list.setAdapter(adapter);
            } catch (Exception e) {
            // Fragment not connected.
            }
            break;
        case EXCEPTION:
            showConnectionErrorWarning();
    }
}
Also used : CollectionListAdapter(org.musicbrainz.mobile.adapter.list.CollectionListAdapter) UserCollectionInfo(org.musicbrainz.android.api.data.UserCollectionInfo)

Aggregations

CollectionListAdapter (org.musicbrainz.mobile.adapter.list.CollectionListAdapter)2 UserCollectionInfo (org.musicbrainz.android.api.data.UserCollectionInfo)1