use of com.thebluealliance.androidclient.models.Media in project the-blue-alliance-android by the-blue-alliance.
the class MatchInfoSubscriberTest method testParsedData.
@Test
public void testParsedData() {
List<ListItem> data = DatafeedTestDriver.getParsedData(mSubscriber, mData);
assertEquals(3, data.size());
assertTrue(data.get(0) instanceof MatchListElement);
assertTrue(data.get(1) instanceof ImageListElement);
Media videoItem = ((Match.MatchVideo) mData.match.getVideos().get(0)).asMedia();
ImageListElement video = (ImageListElement) data.get(1);
verify(mRenderer).renderFromModel(mData.match, MatchRenderer.RENDER_MATCH_INFO);
assertTrue(video.equals(mMediaRenderer.renderFromModel(videoItem, null)));
}
use of com.thebluealliance.androidclient.models.Media in project the-blue-alliance-android by the-blue-alliance.
the class TeamInfoSubscriberTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
Context context = RuntimeEnvironment.application;
mSubscriber = new TeamInfoSubscriber(context, mAppConfig);
Team team = ModelMaker.getModel(Team.class, "frc1124");
List<Media> socialMedia = ModelMaker.getModelList(Media.class, "frc1124_social_media");
mModel = new TeamInfoSubscriber.Model(team, socialMedia);
}
use of com.thebluealliance.androidclient.models.Media in project the-blue-alliance-android by the-blue-alliance.
the class MediaListWriterTest method testEventListWriter.
@Test
public void testEventListWriter() {
mWriter.write(mMedias, 0L);
SQLiteDatabase db = mDb.getWritableDatabase();
for (Media media : mMedias) {
verify(db).insert(Database.TABLE_MEDIAS, null, media.getParams(mGson));
}
}
use of com.thebluealliance.androidclient.models.Media in project the-blue-alliance-android by the-blue-alliance.
the class MatchInfoSubscriber method parseData.
@Override
public void parseData() {
mDataToBind.clear();
mDataToBind.add(mRenderer.renderFromModel(mAPIData.match, MatchRenderer.RENDER_MATCH_INFO));
mMatchTitle = mAPIData.match.getTitle(mResources);
mMatchKey = mAPIData.match.getKey();
List<IMatchVideo> matchVideos = mAPIData.match.getVideos();
for (int i = 0; matchVideos != null && i < matchVideos.size(); i++) {
Match.MatchVideo video = (Match.MatchVideo) matchVideos.get(i);
if (MediaType.fromString(video.getType()) != MediaType.NONE) {
Media media = video.asMedia();
mDataToBind.add(mMediaRenderer.renderFromModel(media, null));
}
}
updateActionBarTitle(mAPIData.event.getShortName());
}
use of com.thebluealliance.androidclient.models.Media 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));
}
Aggregations