Search in sources :

Example 6 with Note

use of de.djuelg.neuronizer.domain.model.preview.Note in project Neuronizer by djuelg.

the class RenameNoteInteractorImpl method run.

@Override
public void run() {
    final Optional<Note> outDatedItem = repository.note().get(uuid);
    if (outDatedItem.isPresent()) {
        final Note updatedItem = title.equals(outDatedItem.get().getTitle()) ? outDatedItem.get().update(title, position) : outDatedItem.get().update(title, position).updateLastChange();
        repository.note().update(updatedItem);
        mMainThread.post(new Runnable() {

            @Override
            public void run() {
                callback.onNoteUpdated(updatedItem);
            }
        });
    }
}
Also used : Note(de.djuelg.neuronizer.domain.model.preview.Note)

Example 7 with Note

use of de.djuelg.neuronizer.domain.model.preview.Note in project Neuronizer by djuelg.

the class EditNoteBodyInteractorImpl method run.

@Override
public void run() {
    final Optional<Note> outDatedItem = repository.note().get(uuid);
    if (outDatedItem.isPresent()) {
        if (!outDatedItem.get().getBody().equals(body)) {
            final Note updatedItem = outDatedItem.get().update(body).updateLastChange();
            // repository.note().update(updatedItem); // not needed because of Importance increasing
            Importance.increase(repository, updatedItem);
            mMainThread.post(new Runnable() {

                @Override
                public void run() {
                    callback.onNoteUpdated(updatedItem);
                }
            });
        }
    }
}
Also used : Note(de.djuelg.neuronizer.domain.model.preview.Note)

Aggregations

Note (de.djuelg.neuronizer.domain.model.preview.Note)7 NoteDAO (de.djuelg.neuronizer.storage.model.NoteDAO)2 Realm (io.realm.Realm)2 BaseModel (de.djuelg.neuronizer.domain.model.BaseModel)1 TodoList (de.djuelg.neuronizer.domain.model.preview.TodoList)1 PreviewViewModel (de.djuelg.neuronizer.presentation.ui.flexibleadapter.PreviewViewModel)1 NoteDAOConverter (de.djuelg.neuronizer.storage.converter.NoteDAOConverter)1 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1