Search in sources :

Example 1 with TeamAvatarUpdateEvent

use of com.thebluealliance.androidclient.eventbus.TeamAvatarUpdateEvent in project the-blue-alliance-android by the-blue-alliance.

the class MediaListSubscriber method parseData.

@Override
public void parseData() {
    mDataToBind.clear();
    mPhotos.clear();
    mVideos.clear();
    String encodedAvatar = "";
    for (int i = 0; i < mAPIData.size(); i++) {
        Media media = mAPIData.get(i);
        MediaType mediaType = MediaType.fromString(media.getType());
        if (mediaType.isImage()) {
            mPhotos.children.add(media);
        } else if (mediaType.isVideo()) {
            mVideos.children.add(media);
        } else if (mediaType.isAvatar()) {
            encodedAvatar = media.getBase64Image();
        }
    }
    if (!mPhotos.children.isEmpty()) {
        mDataToBind.add(mPhotos);
    }
    if (!mVideos.children.isEmpty()) {
        mDataToBind.add(mVideos);
    }
    mEventBus.post(new TeamAvatarUpdateEvent(encodedAvatar));
}
Also used : Media(com.thebluealliance.androidclient.models.Media) MediaType(com.thebluealliance.androidclient.types.MediaType) TeamAvatarUpdateEvent(com.thebluealliance.androidclient.eventbus.TeamAvatarUpdateEvent)

Aggregations

TeamAvatarUpdateEvent (com.thebluealliance.androidclient.eventbus.TeamAvatarUpdateEvent)1 Media (com.thebluealliance.androidclient.models.Media)1 MediaType (com.thebluealliance.androidclient.types.MediaType)1