Ejemplo n.º 1
0
  private void addUserToClass(final ShowClassParticipator item) {
    if (item.getIsParticipating()) {

      AlertDialog.Builder builder = new AlertDialog.Builder(this);
      final AdminActivity activity = this;
      final View dialogView =
          getLayoutInflater().inflate(R.layout.dialog_rider_enter_horse_name, null);

      builder
          .setView(dialogView)
          .setTitle(R.string.admin_prompt_horse_name)
          .setPositiveButton(
              R.string.ok_caption,
              new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {

                  EditText nameEditText =
                      (EditText)
                          dialogView.findViewById(R.id.dialog_rider_enter_horse_name_edit_text);
                  String name = nameEditText.getText().toString();

                  AdminProxy.addUserToClass(
                      activity,
                      getCurrentEvent().getId(),
                      item.getShowClass().getId(),
                      getSelectedRider().getId(),
                      name);
                }
              });
      AlertDialog alert = builder.create();
      alert.show();
    }
  }
Ejemplo n.º 2
0
  private void setupEventListAdapters() {
    if (getCurrentEvent() == null) return;

    Participant[] participants = getCurrentEvent().getParticipants();
    ListView participantsListView =
        (ListView) findViewById(R.id.admin_event_participants_list_view);
    participantsListView.setAdapter(
        new UserListAdapter(this, getParticipantsWithoutCurrentUser(participants), false));
    participantsListView.setOnItemClickListener(this);

    ListView classesListView =
        (ListView) findViewById(R.id.admin_event_participant_classes_list_view);

    ArrayList<ShowClass> classes = getModel().getEventClasses(getCurrentEvent().getId());
    if (classes == null) classes = new ArrayList<ShowClass>();

    ArrayList<ShowClassParticipator> checkableClasses = new ArrayList<ShowClassParticipator>();
    for (ShowClass showClass : classes) {
      boolean riding = false;
      if (getSelectedRider() != null && showClass.getParticipations() != null) {
        for (Participation p : showClass.getParticipations()) {
          if (p.getRider().getId() == getSelectedRider().getId()) riding = true;
        }
      }

      ShowClassParticipator item = new ShowClassParticipator(showClass, riding);
      item.addListener(ShowClassParticipator.EventMeta.PARTICIPATING_CHANGED, this);

      checkableClasses.add(item);
    }

    classesListView.setAdapter(new CheckableShowClassAdapter(this, checkableClasses));
    classesListView.setOnItemClickListener(this);

    Division[] divisions = getCurrentEvent().getDivisions();
    ListView divisionsListView = (ListView) findViewById(R.id.admin_divisions_list_view);
    divisionsListView.setAdapter(new NameListAdapter(this, divisions));
    divisionsListView.setOnItemClickListener(this);
  }
Ejemplo n.º 3
0
 private void classItemClicked(int position) {
   ListView lv = (ListView) findViewById(R.id.admin_event_participant_classes_list_view);
   CheckableShowClassAdapter adapter = (CheckableShowClassAdapter) lv.getAdapter();
   ShowClassParticipator item = adapter.getItems().get(position);
   if (item.getIsParticipating()) Log.d(TAG, "true!");
 }