public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   Tag t = tagManager.get(position);
   if (tags.contains(t)) tags.remove(t);
   else tags.add(t);
   Log.d(TAG, "Click: " + tags.size());
   tagsChanged(true);
 }
 @Override
 public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
   if (parent == tagList.getAdapterView()) {
     Log.d(TAG, "Long click: " + tags.size());
     tag = tagManager.get(position);
     showDialog(DIALOG_EDIT_TAG);
     return true;
   }
   return false;
 }
 @Override
 protected void onResume() {
   super.onResume();
   Book book = Bookshelf.getCurrentBook();
   tagManager = book.getTagManager();
   tagManager.sort();
   tags = Bookshelf.getCurrentBook().currentPage().tags;
   tagList.setTagSet(tags);
   tagCloud.setTagSet(tags);
   updateStatusBar();
 }
 public boolean onKey(View v, int keyCode, KeyEvent event) {
   // If the event is a key-down event on the "enter" button
   Log.v(TAG, "onKey " + keyCode);
   EditText text = (EditText) v;
   if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
     Tag t = tagManager.newTag(text.getText().toString());
     tags.add(t);
     tagsChanged(false);
     return true;
   }
   return false;
 }