Search in sources :

Example 1 with SNote

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();
}
Also used : Context(android.content.Context) CoordinatorLayout(android.support.design.widget.CoordinatorLayout) SnackbarUtils(com.lguipeng.notes.utils.SnackbarUtils) Bundle(android.os.Bundle) KeyEvent(android.view.KeyEvent) NotesAdapter(com.lguipeng.notes.adpater.NotesAdapter) SearchView(android.support.v7.widget.SearchView) BaseRecyclerViewAdapter(com.lguipeng.notes.adpater.base.BaseRecyclerViewAdapter) OnClick(butterknife.OnClick) MenuItem(android.view.MenuItem) Inject(javax.inject.Inject) MotionEvent(android.view.MotionEvent) Menu(android.view.Menu) View(android.view.View) ToolbarUtils(com.lguipeng.notes.utils.ToolbarUtils) BetterFab(com.lguipeng.notes.view.BetterFab) Bind(butterknife.Bind) AdapterView(android.widget.AdapterView) DialogUtils(com.lguipeng.notes.utils.DialogUtils) DaggerActivityComponent(com.lguipeng.notes.injector.component.DaggerActivityComponent) DrawerLayout(android.support.v4.widget.DrawerLayout) DialogInterface(android.content.DialogInterface) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) MainView(com.lguipeng.notes.mvp.views.impl.MainView) ActivityModule(com.lguipeng.notes.injector.module.ActivityModule) DrawerListAdapter(com.lguipeng.notes.adpater.DrawerListAdapter) ProgressWheel(com.pnikosis.materialishprogress.ProgressWheel) SimpleListAdapter(com.lguipeng.notes.adpater.SimpleListAdapter) ComponentName(android.content.ComponentName) MenuItemCompat(android.support.v4.view.MenuItemCompat) PopupMenu(android.support.v7.widget.PopupMenu) SNote(com.lguipeng.notes.model.SNote) R(com.lguipeng.notes.R) RecyclerView(android.support.v7.widget.RecyclerView) App(com.lguipeng.notes.App) List(java.util.List) AlertDialog(android.support.v7.app.AlertDialog) Toolbar(android.support.v7.widget.Toolbar) Configuration(android.content.res.Configuration) ListView(android.widget.ListView) SearchManager(android.app.SearchManager) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) MainPresenter(com.lguipeng.notes.mvp.presenters.impl.MainPresenter) PopupMenu(android.support.v7.widget.PopupMenu)

Example 2 with SNote

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();
}
Also used : Context(android.content.Context) CoordinatorLayout(android.support.design.widget.CoordinatorLayout) SnackbarUtils(com.lguipeng.notes.utils.SnackbarUtils) Bundle(android.os.Bundle) KeyEvent(android.view.KeyEvent) NotesAdapter(com.lguipeng.notes.adpater.NotesAdapter) SearchView(android.support.v7.widget.SearchView) BaseRecyclerViewAdapter(com.lguipeng.notes.adpater.base.BaseRecyclerViewAdapter) OnClick(butterknife.OnClick) MenuItem(android.view.MenuItem) Inject(javax.inject.Inject) MotionEvent(android.view.MotionEvent) Menu(android.view.Menu) View(android.view.View) ToolbarUtils(com.lguipeng.notes.utils.ToolbarUtils) BetterFab(com.lguipeng.notes.view.BetterFab) Bind(butterknife.Bind) AdapterView(android.widget.AdapterView) DialogUtils(com.lguipeng.notes.utils.DialogUtils) DaggerActivityComponent(com.lguipeng.notes.injector.component.DaggerActivityComponent) DrawerLayout(android.support.v4.widget.DrawerLayout) DialogInterface(android.content.DialogInterface) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) MainView(com.lguipeng.notes.mvp.views.impl.MainView) ActivityModule(com.lguipeng.notes.injector.module.ActivityModule) DrawerListAdapter(com.lguipeng.notes.adpater.DrawerListAdapter) ProgressWheel(com.pnikosis.materialishprogress.ProgressWheel) SimpleListAdapter(com.lguipeng.notes.adpater.SimpleListAdapter) ComponentName(android.content.ComponentName) MenuItemCompat(android.support.v4.view.MenuItemCompat) PopupMenu(android.support.v7.widget.PopupMenu) SNote(com.lguipeng.notes.model.SNote) R(com.lguipeng.notes.R) RecyclerView(android.support.v7.widget.RecyclerView) App(com.lguipeng.notes.App) List(java.util.List) AlertDialog(android.support.v7.app.AlertDialog) Toolbar(android.support.v7.widget.Toolbar) Configuration(android.content.res.Configuration) ListView(android.widget.ListView) SearchManager(android.app.SearchManager) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) MainPresenter(com.lguipeng.notes.mvp.presenters.impl.MainPresenter) PopupMenu(android.support.v7.widget.PopupMenu)

Example 3 with SNote

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;
    }
}
Also used : SNote(com.lguipeng.notes.model.SNote)

Example 4 with SNote

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);
}
Also used : SNote(com.lguipeng.notes.model.SNote)

Example 5 with SNote

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());
}
Also used : SNote(com.lguipeng.notes.model.SNote)

Aggregations

SNote (com.lguipeng.notes.model.SNote)13 RecyclerView (android.support.v7.widget.RecyclerView)3 SearchView (android.support.v7.widget.SearchView)3 View (android.view.View)3 AdapterView (android.widget.AdapterView)3 ListView (android.widget.ListView)3 Note (com.evernote.edam.type.Note)3 NotesAdapter (com.lguipeng.notes.adpater.NotesAdapter)3 BaseRecyclerViewAdapter (com.lguipeng.notes.adpater.base.BaseRecyclerViewAdapter)3 MainView (com.lguipeng.notes.mvp.views.impl.MainView)3 SearchManager (android.app.SearchManager)2 ComponentName (android.content.ComponentName)2 Context (android.content.Context)2 DialogInterface (android.content.DialogInterface)2 Configuration (android.content.res.Configuration)2 Bundle (android.os.Bundle)2 CoordinatorLayout (android.support.design.widget.CoordinatorLayout)2 MenuItemCompat (android.support.v4.view.MenuItemCompat)2 DrawerLayout (android.support.v4.widget.DrawerLayout)2 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)2