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
 }