Beispiel #1
0
 // adds the tag that can currently be found to the tag-variable, to the stored measurements.
 public void onClick(View v) {
   if (txtTag.getText().toString().equals("")) return;
   // Since we use the CyclicQueue, the element that is pop'ed, is the element first added to
   // the queue, is
   // the newest measurement. So we may just pop for example the first five elements and tag
   // these.
   // In other words, we do not need to worry about not tagging the newest five (which could
   // be possible, since
   // we store the newest measurements and might as well tag the 5 oldest from these
   // measurements.
   int toTag = Math.min(tagQueue.getSize(), numberOfMeasurementsToTag);
   for (int i = 0; i < toTag; i++) {
     Measurement m = (Measurement) tagQueue.getElement(i);
     m.addUserTag(txtTag.getText().toString());
   }
   txtTag.setText(""); // clear field
   // TODO store tag (in pref's?) for suggestion dropdown
   Toaster.displayToast(
       "The last "
           + toTag
           + " measurements have been tagged with \""
           + txtTag.getText().toString()
           + "\"");
   MainActivity.getInstance().showGraph(); // go back to graph tab
 }
Beispiel #2
0
  public void update(Measurement newMeasurement, Track track) {
    // When we haven't stored the last X measurements since we chose to tag some of them...
    if (needsNewTrack == true) {
      // ... we need to store them and make sure no new ones will be stored.
      needsNewTrack = false;

      Enumeration enumerator = track.getMeasurementsNewestFirst();
      int mnumber = 0;
      if (enumerator.hasMoreElements())
        // We skip the newest element, since this element is the first measurement recorded when we
        // where in the
        // current screen. This element should not be part of the tagging, since the user didn't saw
        // this element
        // yet when he chose to tag an interval.
        enumerator.nextElement();
      while (mnumber++ < MAX_TAGGABLE_MEASUREMENTS_SERIES && enumerator.hasMoreElements()) {
        tagQueue.offer(enumerator.nextElement());
      }
    }
  }