use of com.thebluealliance.androidclient.models.Match in project the-blue-alliance-android by the-blue-alliance.
the class MatchBreakdownView2016Test method getView.
private MatchBreakdownView2016 getView(String matchJsonFile) {
Match match = ModelMaker.getModel(Match.class, matchJsonFile);
LayoutInflater inflater = LayoutInflater.from(InstrumentationRegistry.getTargetContext());
View view = inflater.inflate(R.layout.fragment_match_breakdown, null, false);
FrameLayout matchView = (FrameLayout) view.findViewById(R.id.match_breakdown);
assertEquals(1, matchView.getChildCount());
assertTrue(matchView.getChildAt(0) instanceof MatchBreakdownView2016);
MatchBreakdownView2016 view2016 = (MatchBreakdownView2016) matchView.getChildAt(0);
MatchType matchType = MatchType.fromKey(match.getKey());
view2016.initWithData(matchType, match.getWinningAlliance(), match.getAlliances(), mGson.fromJson(match.getScoreBreakdown(), JsonObject.class));
view2016.setVisibility(View.VISIBLE);
// hide progress bar
view.findViewById(R.id.progress).setVisibility(View.GONE);
return view2016;
}
use of com.thebluealliance.androidclient.models.Match in project the-blue-alliance-android by the-blue-alliance.
the class MatchBreakdownView2018Test method getView.
private MatchBreakdownView2018 getView(String matchJsonFile) {
Match match = ModelMaker.getModel(Match.class, matchJsonFile);
LayoutInflater inflater = LayoutInflater.from(InstrumentationRegistry.getTargetContext());
View view = inflater.inflate(R.layout.fragment_match_breakdown, null, false);
FrameLayout matchView = (FrameLayout) view.findViewById(R.id.match_breakdown);
assertEquals(1, matchView.getChildCount());
assertTrue(matchView.getChildAt(0) instanceof MatchBreakdownView2018);
MatchBreakdownView2018 view2018 = (MatchBreakdownView2018) matchView.getChildAt(0);
MatchType matchType = MatchType.fromKey(match.getKey());
view2018.initWithData(matchType, match.getWinningAlliance(), match.getAlliances(), mGson.fromJson(match.getScoreBreakdown(), JsonObject.class));
view2018.setVisibility(View.VISIBLE);
// hide progress bar
view.findViewById(R.id.progress).setVisibility(View.GONE);
return view2018;
}
use of com.thebluealliance.androidclient.models.Match in project the-blue-alliance-android by the-blue-alliance.
the class MatchesTableTest method testUpdate.
@Test
public void testUpdate() {
Match result = DbTableTestDriver.testUpdate(mTable, mMatches.get(0), match -> match.setSetNumber(2), mGson);
assertNotNull(result);
assertEquals(2, result.getSetNumber().intValue());
}
use of com.thebluealliance.androidclient.models.Match in project the-blue-alliance-android by the-blue-alliance.
the class MatchListWriterTest method testMatchListWriter.
@Test
public void testMatchListWriter() {
mWriter.write(mMatches, 0L);
SQLiteDatabase db = mDb.getWritableDatabase();
for (Match match : mMatches) {
verify(db).insert(Database.TABLE_MATCHES, null, match.getParams(mGson));
}
}
use of com.thebluealliance.androidclient.models.Match in project the-blue-alliance-android by the-blue-alliance.
the class APICache method fetchMatch.
public Observable<Match> fetchMatch(String matchKey) {
return Observable.create((observer) -> {
try {
Match match = mDb.getMatchesTable().get(matchKey);
observer.onNext(match);
observer.onCompleted();
} catch (Exception e) {
observer.onError(e);
}
});
}
Aggregations