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);
}
}
Aggregations