use of com.thebluealliance.androidclient.database.tables.EventsTable in project the-blue-alliance-android by the-blue-alliance.
the class TeamAtDistrictSummarySubscriber method parseData.
@Override
public void parseData() {
mDataToBind.clear();
EventsTable eventsTable = mDb.getEventsTable();
mDataToBind.add(new LabelValueListItem(mResources.getString(R.string.district_point_rank), mAPIData.getRank() + Utilities.getOrdinalFor(mAPIData.getRank())));
@Nullable IDistrictEventPoints event1Points = getEventPoints(mAPIData, 0);
if (event1Points != null) {
mDataToBind.add(renderEventPoints(mAPIData.getTeamKey(), event1Points, eventsTable, mResources));
}
@Nullable IDistrictEventPoints event2Points = getEventPoints(mAPIData, 1);
if (event2Points != null) {
mDataToBind.add(renderEventPoints(mAPIData.getTeamKey(), event2Points, eventsTable, mResources));
}
@Nullable IDistrictEventPoints cmpPoints = getEventPoints(mAPIData, 2);
if (cmpPoints != null) {
mDataToBind.add(renderEventPoints(mAPIData.getTeamKey(), cmpPoints, eventsTable, mResources));
}
if (mAPIData.getPointTotal() != null) {
mDataToBind.add(new LabelValueListItem(mResources.getString(R.string.total_district_points), String.format(mResources.getString(R.string.district_points_format), mAPIData.getPointTotal())));
}
String actionBarTitle = String.format(mResources.getString(R.string.team_actionbar_title), mTeamKey.substring(3));
String actionBarSubtitle = String.format("@ %1$s %2$s", mDistrictKey.substring(0, 4), mDistrictKey.substring(4).toUpperCase());
mEventBus.post(new ActionBarTitleEvent(actionBarTitle, actionBarSubtitle));
}
use of com.thebluealliance.androidclient.database.tables.EventsTable in project the-blue-alliance-android by the-blue-alliance.
the class DatabaseMocker method mockEventsTable.
public static EventsTable mockEventsTable(Database database) {
SQLiteDatabase db = mock(SQLiteDatabase.class);
DistrictsTable districtsTable = new DistrictsTable(db, TBAAndroidModule.getGson());
EventsTable table = new EventsTable(db, TBAAndroidModule.getGson(), districtsTable);
when(database.getEventsTable()).thenReturn(table);
when(database.getWritableDatabase()).thenReturn(db);
return table;
}
Aggregations