Search in sources :

Example 1 with NoteCopy

use of com.orgzly.android.usecase.NoteCopy in project orgzly-android by orgzly.

the class MainActivity method onSuccess.

/**
 * User action succeeded.
 */
@Override
public void onSuccess(UseCase action, UseCaseResult result) {
    if (action instanceof NoteCut) {
        NotesClipboard clipboard = (NotesClipboard) result.getUserData();
        if (clipboard != null) {
            int count = clipboard.getCount();
            String message;
            if (count == 0) {
                message = getResources().getString(R.string.no_notes_cut);
            } else {
                message = getResources().getQuantityString(R.plurals.notes_cut, count, count);
            }
            showSnackbar(message);
        }
    } else if (action instanceof NoteCopy) {
        NotesClipboard clipboard = (NotesClipboard) result.getUserData();
        if (clipboard != null) {
            int count = clipboard.getCount();
            if (count > 0) {
                String message = getResources().getQuantityString(R.plurals.notes_copied, count, count);
                showSnackbar(message);
            }
        }
    } else if (action instanceof NotePaste) {
        int count = (int) result.getUserData();
        String message;
        if (count > 0) {
            message = getResources().getQuantityString(R.plurals.notes_pasted, count, count);
        } else {
            message = getResources().getString(R.string.no_notes_pasted);
        }
        showSnackbar(message);
    }
}
Also used : NoteCut(com.orgzly.android.usecase.NoteCut) NoteCopy(com.orgzly.android.usecase.NoteCopy) NotePaste(com.orgzly.android.usecase.NotePaste) NotesClipboard(com.orgzly.android.db.NotesClipboard)

Aggregations

NotesClipboard (com.orgzly.android.db.NotesClipboard)1 NoteCopy (com.orgzly.android.usecase.NoteCopy)1 NoteCut (com.orgzly.android.usecase.NoteCut)1 NotePaste (com.orgzly.android.usecase.NotePaste)1