Search in sources :

Example 1 with ListItem

use of com.thebluealliance.androidclient.listitems.ListItem in project the-blue-alliance-android by the-blue-alliance.

the class TeamListSubscriber method parseData.

@Override
public void parseData() {
    mDataToBind.clear();
    Collections.sort(mAPIData, mComparator);
    for (int i = 0; i < mAPIData.size(); i++) {
        Team team = mAPIData.get(i);
        if (team == null) {
            continue;
        }
        ListItem item = mRenderer.renderFromModel(team, mRenderMode);
        if (item == null) {
            continue;
        }
        mDataToBind.add(item);
    }
}
Also used : Team(com.thebluealliance.androidclient.models.Team) ListItem(com.thebluealliance.androidclient.listitems.ListItem)

Example 2 with ListItem

use of com.thebluealliance.androidclient.listitems.ListItem in project the-blue-alliance-android by the-blue-alliance.

the class StatsListSubscriberTest method testParsedData.

@Test
public void testParsedData() {
    StatsListSubscriber.Model model = new StatsListSubscriber.Model(mStats, mInsights);
    List<ListItem> data = DatafeedTestDriver.getParsedData(mSubscriber, model);
    assertEquals(66, data.size());
    assertTrue(data.get(0) instanceof StatsListElement);
    StatsListElement actual = ((StatsListElement) data.get(0));
    assertEquals(actual.teamNumber, "3419");
    assertEquals(actual.teamName, "Team 3419");
    assertEquals(actual.opr, 41.76934455450079, 0);
    assertEquals(actual.dpr, 18.164742518609433, 0);
    assertEquals(actual.ccwm, 23.60460203589137, 0);
}
Also used : ListItem(com.thebluealliance.androidclient.listitems.ListItem) StatsListElement(com.thebluealliance.androidclient.listitems.StatsListElement) Test(org.junit.Test)

Example 3 with ListItem

use of com.thebluealliance.androidclient.listitems.ListItem in project the-blue-alliance-android by the-blue-alliance.

the class TeamAtDistrictSummarySubscriberTest method testParsedData.

@Test
public void testParsedData() {
    List<ListItem> data = DatafeedTestDriver.getParsedData(mSubscriber, mDistrictTeam);
    assertEquals(5, data.size());
    LabelValueListItem rank = getItemAtPosition(0, data);
    LabelValueDetailListItem event1 = getDetailItemAtPoistion(1, data);
    LabelValueDetailListItem event2 = getDetailItemAtPoistion(2, data);
    LabelValueDetailListItem cmp = getDetailItemAtPoistion(3, data);
    LabelValueListItem total = getItemAtPosition(4, data);
    String event1Key = EventTeamHelper.generateKey("2015nhnas", "frc1519");
    String event2Key = EventTeamHelper.generateKey("2015manda", "frc1519");
    String cmpKey = EventTeamHelper.generateKey("2015necmp", "frc1519");
    assertEquals(new LabelValueListItem("District Rank", "1st"), rank);
    assertEquals(new LabelValueDetailListItem("2015nhnas", "73 Points", event1Key), event1);
    assertEquals(new LabelValueDetailListItem("2015manda", "73 Points", event2Key), event2);
    assertEquals(new LabelValueDetailListItem("2015necmp", "219 Points", cmpKey), cmp);
    assertEquals(new LabelValueListItem("Total Points", "365 Points"), total);
}
Also used : LabelValueListItem(com.thebluealliance.androidclient.listitems.LabelValueListItem) LabelValueDetailListItem(com.thebluealliance.androidclient.listitems.LabelValueDetailListItem) LabelValueListItem(com.thebluealliance.androidclient.listitems.LabelValueListItem) ListItem(com.thebluealliance.androidclient.listitems.ListItem) LabelValueDetailListItem(com.thebluealliance.androidclient.listitems.LabelValueDetailListItem) Test(org.junit.Test)

Example 4 with ListItem

use of com.thebluealliance.androidclient.listitems.ListItem in project the-blue-alliance-android by the-blue-alliance.

the class AwardsListSubscriberTest method testSelectedTeam.

@Test
public void testSelectedTeam() {
    mSubscriber.setTeamKey("frc195");
    List<ListItem> data = DatafeedTestDriver.getParsedData(mSubscriber, mAwards);
    CardedAwardListElement element = (CardedAwardListElement) data.get(0);
    assertEquals(element.mSelectedTeamNum, "195");
}
Also used : CardedAwardListElement(com.thebluealliance.androidclient.listitems.CardedAwardListElement) ListItem(com.thebluealliance.androidclient.listitems.ListItem) Test(org.junit.Test)

Example 5 with ListItem

use of com.thebluealliance.androidclient.listitems.ListItem 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)));
}
Also used : ImageListElement(com.thebluealliance.androidclient.listitems.ImageListElement) MatchListElement(com.thebluealliance.androidclient.listitems.MatchListElement) Media(com.thebluealliance.androidclient.models.Media) ListItem(com.thebluealliance.androidclient.listitems.ListItem) Test(org.junit.Test)

Aggregations

ListItem (com.thebluealliance.androidclient.listitems.ListItem)26 Test (org.junit.Test)18 ModelListElement (com.thebluealliance.androidclient.listitems.ModelListElement)6 CardedAwardListElement (com.thebluealliance.androidclient.listitems.CardedAwardListElement)5 Award (com.thebluealliance.androidclient.models.Award)3 Team (com.thebluealliance.androidclient.models.Team)3 ListViewAdapter (com.thebluealliance.androidclient.adapters.ListViewAdapter)2 DistrictTeamListElement (com.thebluealliance.androidclient.listitems.DistrictTeamListElement)2 EventTypeHeader (com.thebluealliance.androidclient.listitems.EventTypeHeader)2 LabelValueListItem (com.thebluealliance.androidclient.listitems.LabelValueListItem)2 Event (com.thebluealliance.androidclient.models.Event)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Cursor (android.database.Cursor)1 JsonObject (com.google.gson.JsonObject)1 EventAwardsEvent (com.thebluealliance.androidclient.eventbus.EventAwardsEvent)1 RenderableModel (com.thebluealliance.androidclient.interfaces.RenderableModel)1 ContributorListElement (com.thebluealliance.androidclient.listitems.ContributorListElement)1 DividerListItem (com.thebluealliance.androidclient.listitems.DividerListItem)1 EmptyListElement (com.thebluealliance.androidclient.listitems.EmptyListElement)1