use of ch.hsr.sa.radiotour.dataaccess.models.Rider in project app by TourLive.
the class VirtualClassFragment method intiTable.
private void intiTable(View root) {
recyclerAdapter = new RecyclerAdapter();
recyclerAdapter.setEmptyItem(new EmptyItem(getString(android.R.string.cancel)));
recyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
recyclerView.setAdapter(recyclerAdapter);
for (Rider r : RiderPresenter.getInstance().getAllRidersReturned()) {
recyclerAdapter.add(new VirtualClassementRider(this, mContext, r));
}
}
use of ch.hsr.sa.radiotour.dataaccess.models.Rider in project app by TourLive.
the class MaillotRepository method addRiderToMaillot.
@Override
public void addRiderToMaillot(Maillot maillot, int riderDbId) {
Realm realm = Realm.getInstance(RadioTourApplication.getInstance());
Maillot realmMaillot = realm.where(Maillot.class).equalTo("id", maillot.getId()).findFirst();
Rider rider = realm.where(Rider.class).equalTo("riderID", riderDbId).findFirst();
realm.beginTransaction();
realmMaillot.setRider(rider);
realm.commitTransaction();
}
use of ch.hsr.sa.radiotour.dataaccess.models.Rider in project app by TourLive.
the class RaceGroupRepository method addInitialRaceGroup.
@Override
public void addInitialRaceGroup(RaceGroup raceGroup, OnSaveRaceGroupCallback callback) {
Realm realm = Realm.getInstance(RadioTourApplication.getInstance());
final RaceGroup transferRaceGroup = raceGroup;
realm.beginTransaction();
RaceGroup realmRaceGroup = realm.createObject(RaceGroup.class, UUID.randomUUID().toString());
realmRaceGroup.setType(transferRaceGroup.getType());
realmRaceGroup.setActualGapTime(transferRaceGroup.getActualGapTime());
realmRaceGroup.setHistoryGapTime(transferRaceGroup.getHistoryGapTime());
RealmList<Rider> res = new RealmList<>();
for (Rider r : transferRaceGroup.getRiders()) {
RealmResults<Rider> temp = realm.where(Rider.class).equalTo("startNr", r.getStartNr()).findAll();
res.addAll(temp);
}
realmRaceGroup.setPosition(transferRaceGroup.getPosition());
realmRaceGroup.setRiders(res);
realm.commitTransaction();
if (callback != null) {
callback.onSuccess(realmRaceGroup);
}
}
use of ch.hsr.sa.radiotour.dataaccess.models.Rider in project app by TourLive.
the class RiderRepository method addRider.
@Override
public void addRider(Rider rider, OnSaveRiderCallback callback) {
Realm realm = Realm.getInstance(RadioTourApplication.getInstance());
final Rider transferRider = rider;
realm.executeTransaction((Realm db) -> {
Rider realmRider = db.createObject(Rider.class, UUID.randomUUID().toString());
realmRider.setRiderID(transferRider.getRiderID());
realmRider.setName(transferRider.getName());
realmRider.setCountry(transferRider.getCountry());
realmRider.setStartNr(transferRider.getStartNr());
realmRider.setTeamName(transferRider.getTeamName());
realmRider.setTeamShortName(transferRider.getTeamShortName());
realmRider.setUnknown(transferRider.isUnknown());
});
if (callback != null)
callback.onSuccess();
}
use of ch.hsr.sa.radiotour.dataaccess.models.Rider in project app by TourLive.
the class RiderRepository method getAllRiders.
@Override
public void getAllRiders(OnGetAllRidersCallback callback) {
Realm realm = Realm.getInstance(RadioTourApplication.getInstance());
RealmResults<Rider> results = realm.where(Rider.class).findAll();
RealmList<Rider> res = new RealmList<>();
res.addAll(results);
if (callback != null)
callback.onSuccess(res);
}
Aggregations