Esempio n. 1
0
  public void createMemory(Memory newMemory) {
    // Create new memory
    if (newMemory.getTitle() == null || newMemory.getTitle().equals("")) {
      newMemory.setTitle("Untitled");
    }
    if (newMemory.getDate() == null) {
      newMemory.setDate(Calendar.getInstance());
    }
    newMemory.save();

    // Notify map here
    mMemoryChanged.onMemoryAdded(newMemory);
  }
Esempio n. 2
0
 public void updateMemory(Memory updatedMemory) {
   // Update the model
   Memory memory = Memory.findById(Memory.class, updatedMemory.getId());
   if (updatedMemory.getTitle() == null || updatedMemory.getTitle().equals("")) {
     updatedMemory.setTitle("Untitled");
   } else {
     memory.setTitle(updatedMemory.getTitle());
   }
   memory.setDate(updatedMemory.getDate());
   memory.setPeople(updatedMemory.getPeople());
   memory.setPhotoURI(updatedMemory.getPhotoURI());
   memory.setDescription(updatedMemory.getDescription());
   memory.setLatitude(updatedMemory.getLatitude());
   memory.setLongitude(updatedMemory.getLongitude());
   memory.setPlaceName(updatedMemory.getPlaceName());
   memory.save();
   // Notify the map
   mMemoryChanged.onMemoryUpdated(memory);
 }