コード例 #1
0
 public Long getIdentifier(Document doc) {
   if (doc == null) {
     throw new UnsupportedOperationException("Can not not map a null Document");
   }
   if (doc.getId() == null) {
     throw new UnsupportedOperationException("Can not not map a Document with null UUID");
   }
   return getIdentifier(doc.getId());
 }
コード例 #2
0
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   if (v.getId() == listView.getId()) {
     AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
     Document doc = documentsList.getDocument(info.position);
     menu.setHeaderTitle(doc.getTitle());
     populateContextMenu(doc, menu);
   }
   super.onCreateContextMenu(menu, v, menuInfo);
 }
コード例 #3
0
  // Content menu handling
  @Override
  public boolean onContextItemSelected(MenuItem item) {

    AdapterView.AdapterContextMenuInfo info =
        (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
    int selectedPosition = info.position;
    Document doc = getContextMenuDocument(selectedPosition);

    if (item.getItemId() == CTXMNU_VIEW_DOCUMENT) {
      if (getEditActivityClass() == null) {
        Toast.makeText(this, "No View activity defined ", Toast.LENGTH_SHORT).show();
        return true;
      }
      startActivity(
          new Intent(this, getEditActivityClass())
              .putExtra(BaseDocumentLayoutActivity.DOCUMENT, doc)
              .putExtra(BaseDocumentLayoutActivity.MODE, LayoutMode.VIEW));
      return true;
    } else if (item.getItemId() == CTXMNU_EDIT_DOCUMENT) {
      if (getEditActivityClass() == null) {
        Toast.makeText(this, "No Edit activity defined ", Toast.LENGTH_SHORT).show();
        return true;
      }
      startActivityForResult(
          new Intent(this, getEditActivityClass())
              .putExtra(BaseDocumentLayoutActivity.DOCUMENT, doc)
              .putExtra(BaseDocumentLayoutActivity.MODE, LayoutMode.EDIT),
          ACTION_EDIT_DOCUMENT);
      return true;
    } else if (item.getItemId() == CTXMNU_VIEW_ATTACHEMENT) {
      Uri blobUri = doc.getBlob();
      if (blobUri == null) {
        Toast.makeText(this, "No Attachement available ", Toast.LENGTH_SHORT).show();
      } else {
        startViewerFromBlob(blobUri);
      }
      return true;
    } else {
      return super.onContextItemSelected(item);
    }
  }
コード例 #4
0
 public void release(Documents docs) {
   for (Document doc : docs) {
     UUID2IDs.remove(doc.getId());
   }
 }