use of com.lguipeng.notes.model.SNote in project Notes by lguipeng.
the class MainActivity method showTrashPopupMenu.
@Override
public void showTrashPopupMenu(View view, SNote note) {
PopupMenu popup = new PopupMenu(this, view);
popup.getMenuInflater().inflate(R.menu.menu_notes_trash_more, popup.getMenu());
popup.setOnMenuItemClickListener((item -> mainPresenter.onPopupMenuClick(item.getItemId(), note)));
popup.show();
}
use of com.lguipeng.notes.model.SNote in project Notes by lguipeng.
the class MainActivity method showNormalPopupMenu.
@Override
public void showNormalPopupMenu(View view, SNote note) {
PopupMenu popup = new PopupMenu(this, view);
popup.getMenuInflater().inflate(R.menu.menu_notes_more, popup.getMenu());
popup.setOnMenuItemClickListener((item -> mainPresenter.onPopupMenuClick(item.getItemId(), note)));
popup.show();
}
use of com.lguipeng.notes.model.SNote in project Notes by lguipeng.
the class MainPresenter method onEventMainThread.
public void onEventMainThread(NotifyEvent event) {
switch(event.getType()) {
case NotifyEvent.REFRESH_LIST:
view.startRefresh();
onRefresh();
break;
case NotifyEvent.CREATE_NOTE:
if (event.getData() instanceof SNote) {
SNote note = (SNote) event.getData();
view.addNote(note);
view.scrollRecyclerViewToTop();
pushNote(note);
}
break;
case NotifyEvent.UPDATE_NOTE:
if (event.getData() instanceof SNote) {
SNote note = (SNote) event.getData();
view.updateNote(note);
view.scrollRecyclerViewToTop();
pushNote(note);
}
break;
case NotifyEvent.CHANGE_THEME:
view.reCreate();
break;
}
}
use of com.lguipeng.notes.model.SNote in project Notes by lguipeng.
the class MainPresenter method newNote.
public void newNote() {
SNote note = new SNote();
note.setType(mCurrentNoteTypePage);
startNoteActivity(NotePresenter.CREATE_NOTE_MODE, note);
}
use of com.lguipeng.notes.model.SNote in project Notes by lguipeng.
the class FileUtils method backupSNotes.
public boolean backupSNotes(Context context, List<SNote> notes) {
createFile(BACKUP_FILE_NAME);
StringBuilder sb = new StringBuilder();
String title = context.getString(R.string.title);
String content = context.getString(R.string.note_content);
for (SNote note : notes) {
sb.append(title + ":" + note.getLabel() + "\n");
sb.append(content + ":\n" + note.getContent() + "\n\n");
}
return writeSNotesFile(sb.toString());
}
Aggregations