Search in sources :

Example 16 with RaceGroup

use of ch.hsr.sa.radiotour.dataaccess.models.RaceGroup 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()));
            }
        }
    }
}
Also used : RaceGroup(ch.hsr.sa.radiotour.dataaccess.models.RaceGroup) TextView(android.widget.TextView) Rider(ch.hsr.sa.radiotour.dataaccess.models.Rider)

Example 17 with RaceGroup

use of ch.hsr.sa.radiotour.dataaccess.models.RaceGroup in project app by TourLive.

the class UnknownRiderTransferDialogFramgent method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity());
    LayoutInflater inflater = LayoutInflater.from(getContext());
    View dialogView = inflater.inflate(R.layout.dialog_unknowntransfer, null);
    alertDialogBuilder.setView(dialogView);
    spinner = dialogView.findViewById(R.id.riderSpinner);
    addItemsToSpinner();
    alertDialogBuilder.setTitle(R.string.race_unknownrider_transfer_title);
    alertDialogBuilder.setMessage(R.string.race_unknownrider_transfer_description);
    alertDialogBuilder.setPositiveButton(R.string.race_unknownrider_transfer_button, (DialogInterface dialog, int which) -> {
        String[] parts = spinner.getItemAtPosition(spinner.getSelectedItemPosition()).toString().split("\\-");
        String startNr = parts[0];
        Log.d("", "" + selectedUnknownRider.toString());
        final int unknownRiderStartNr = selectedUnknownRider.getStartNr();
        new Thread(() -> {
            Rider unknownRider = RiderPresenter.getInstance().getRiderByStartNr(unknownRiderStartNr);
            RaceGroup raceGroup = unknownRider.getRaceGroups();
            RealmList<Rider> rider = new RealmList<>();
            rider.add(getRider(startNr));
            RaceGroupPresenter.getInstance().updateRaceGroupRiders(raceGroup, rider);
            RaceGroupPresenter.getInstance().deleteRiderInRaceGroup(raceGroup, unknownRider);
            RiderPresenter.getInstance().removeRiderWithoutCallback(unknownRider);
        }).start();
    });
    alertDialogBuilder.setNegativeButton(R.string.dismiss, (DialogInterface dialog, int which) -> dialog.dismiss());
    return alertDialogBuilder.create();
}
Also used : AlertDialog(android.app.AlertDialog) RealmList(io.realm.RealmList) DialogInterface(android.content.DialogInterface) View(android.view.View) Rider(ch.hsr.sa.radiotour.dataaccess.models.Rider) RaceGroup(ch.hsr.sa.radiotour.dataaccess.models.RaceGroup) LayoutInflater(android.view.LayoutInflater)

Aggregations

RaceGroup (ch.hsr.sa.radiotour.dataaccess.models.RaceGroup)17 Rider (ch.hsr.sa.radiotour.dataaccess.models.Rider)9 Realm (io.realm.Realm)7 RealmList (io.realm.RealmList)7 Test (org.junit.Test)6 AlertDialog (android.app.AlertDialog)1 DialogInterface (android.content.DialogInterface)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 TextView (android.widget.TextView)1 JSONException (org.json.JSONException)1