Beispiel #1
0
  @Override
  protected void afterInflate() {
    during = (CheckBox) getView().findViewById(R.id.reminder_due);
    after = (CheckBox) getView().findViewById(R.id.reminder_overdue);
    modeDisplay = (TextView) getView().findViewById(R.id.reminder_alarm_display);
    mode = (Spinner) getView().findViewById(R.id.reminder_alarm);
    View modeContainer = getView().findViewById(R.id.reminder_alarm_container);
    modeContainer.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            mode.performClick();
          }
        });

    randomControlSet = new RandomReminderControlSet(activity, getView(), -1);
    alarmControl = new AlarmControlSet(activity, R.layout.control_set_alarms);
    alarmControl.readFromTask(model);

    remindersBody = (LinearLayout) getView().findViewById(R.id.reminders_body);
    remindersBody.addView(alarmControl.getView());
    while (extraViews.size() > 0) {
      addViewToBody(extraViews.remove(0));
    }

    String[] list =
        new String[] {
          activity.getString(R.string.TEA_reminder_mode_once),
          activity.getString(R.string.TEA_reminder_mode_five),
          activity.getString(R.string.TEA_reminder_mode_nonstop),
        };
    final ArrayAdapter<String> adapter =
        new ArrayAdapter<String>(activity, android.R.layout.simple_spinner_item, list);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mode.setOnItemSelectedListener(
        new OnItemSelectedListener() {

          @Override
          public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            modeDisplay.setText(adapter.getItem(position));
          }

          @Override
          public void onNothingSelected(AdapterView<?> parent) {
            // TODO Auto-generated method stub

          }
        });
    activity.runOnUiThread(
        new Runnable() {
          @Override
          public void run() {
            mode.setAdapter(adapter);
          }
        });
  }
Beispiel #2
0
  @Override
  protected String writeToModelAfterInitialized(Task task) {
    task.setValue(Task.REMINDER_FLAGS, getValue());

    randomControlSet.writeToModel(task);
    alarmControl.writeToModel(task);
    return null;
  }