use of ch.hsr.sa.radiotour.dataaccess.models.Rider in project app by TourLive.
the class RaceGroupAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(RaceGroupViewHolder holder, int position) {
GridLayoutManager layoutManager = new GridLayoutManager(context, 1);
holder.racegroupName.setText(String.valueOf(raceGroups.get(position).getName()));
holder.gaptimeActual.setText(String.valueOf(convertLongToTimeString(raceGroups.get(position).getActualGapTime())));
holder.gaptimeBefore.setText(String.valueOf(convertLongToTimeString(raceGroups.get(position).getHistoryGapTime())));
if (raceGroups.get(position).getType() != RaceGroupType.FELD) {
RiderRaceGroupAdapter adapter = new RiderRaceGroupAdapter(raceGroups.get(position).getRiders(), fragment);
holder.racegroupRiders.setLayoutManager(layoutManager);
holder.racegroupRiders.setAdapter(adapter);
if (raceGroups.get(position).getType() == RaceGroupType.LEAD) {
holder.gaptimeActual.setBackground(context.getDrawable(R.drawable.background_shape_racetime_before));
}
int color = ContextCompat.getColor(context, R.color.colorGrayLight);
holder.layoutRacegroup.getBackground().setColorFilter(color, PorterDuff.Mode.MULTIPLY);
} else {
RiderRaceGroupAdapter adapter = new RiderRaceGroupAdapter(new RealmList<Rider>(), fragment);
holder.racegroupRiders.setLayoutManager(layoutManager);
holder.racegroupRiders.setAdapter(adapter);
int color = ContextCompat.getColor(context, R.color.colorGrayMiddle);
holder.layoutRacegroup.getBackground().setColorFilter(color, PorterDuff.Mode.MULTIPLY);
holder.gaptimeActual.setBackground(context.getDrawable(R.drawable.background_shape_racetime));
}
holder.racegroupCount.setText(String.valueOf(raceGroups.get(position).getRidersCount()));
}
use of ch.hsr.sa.radiotour.dataaccess.models.Rider in project app by TourLive.
the class RiderEditAdapter method updateAnimateRiderInGroup.
public void updateAnimateRiderInGroup(String raceGroupId) {
RealmList<Rider> ridersToUpdate = RaceGroupPresenter.getInstance().getRaceGroupById(raceGroupId).getRiders();
if (!holderHashMap.isEmpty()) {
for (Rider r : ridersToUpdate) {
if (holderHashMap.get(r.getStartNr()) != null) {
TextView tvNumber = holderHashMap.get(r.getStartNr()).tvNummer;
animateRiderInGroup(tvNumber, r.getStartNr());
}
}
}
}
use of ch.hsr.sa.radiotour.dataaccess.models.Rider in project app by TourLive.
the class RiderListAdapter method updateAnimateRiderInGroup.
public void updateAnimateRiderInGroup(String raceGroupId) {
RaceGroup raceGroup = RaceGroupPresenter.getInstance().getRaceGroupById(raceGroupId);
if (!holderHashMap.isEmpty()) {
for (Rider r : raceGroup.getRiders()) {
if (holderHashMap.get(r.getStartNr()) != null) {
TextView tvNumber = holderHashMap.get(r.getStartNr()).tvNummer;
handler.post(() -> animateRiderInGroup(tvNumber, r.getStartNr()));
}
}
}
}
use of ch.hsr.sa.radiotour.dataaccess.models.Rider in project app by TourLive.
the class RiderRaceGroupAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(RiderRaceGroupAdapter.RiderRaceGroupViewHolder holder, int position) {
Rider rider = riders.get(position);
holder.racegroupRiderName.setText(String.valueOf(rider.getName()));
if (rider.getStartNr() < 900) {
holder.racegroupRiderStartNr.setText(String.valueOf(rider.getStartNr()));
holder.racegroupRiderTeam.setText(String.valueOf(rider.getTeamShortName()));
holder.racegroupRiderVirtualRank.setText(Integer.toString(rider.getRiderStages().first().getRiderRanking(RankingType.VIRTUAL).getRank()));
setTrictos(rider, holder);
} else {
holder.racegroupRiderStartNr.setText(R.string.race_startnr_unknownrider);
holder.racegroupRiderTeam.setText(R.string.race_startnr_unknownrider);
}
holder.racegroupRiderCountry.setImageResource(UIUtilitis.getCountryFlag(riders.get(position).getCountry()));
}
use of ch.hsr.sa.radiotour.dataaccess.models.Rider in project app by TourLive.
the class RiderRaceGroupFragment method onClick.
@Override
public void onClick(View view) {
RealmList<Rider> selectedRiders = adapter.getSelectedRiders();
switch(view.getId()) {
case R.id.btn_Defect:
addRiderToResetAfterTabChange(selectedRiders);
updateRiderStates(RiderStateType.DEFECT);
break;
case R.id.btn_DNC:
updateRiderStates(RiderStateType.DNC);
break;
case R.id.btn_Doctor:
addRiderToResetAfterTabChange(selectedRiders);
updateRiderStates(RiderStateType.DOCTOR);
break;
case R.id.btn_Drop:
addRiderToResetAfterTabChange(selectedRiders);
updateRiderStates(RiderStateType.DROP);
break;
case R.id.btn_Quit:
updateRiderStates(RiderStateType.QUIT);
break;
case R.id.btn_UnkownRiders:
FragmentManager fm = getFragmentManager();
UnknownRiderDialogFragment alertDialog = UnknownRiderDialogFragment.newInstance();
alertDialog.setTargetFragment(RiderRaceGroupFragment.this, 300);
alertDialog.show(fm, "");
break;
default:
break;
}
}
Aggregations