Skip to content

Commit

Permalink
Only log error on invalid book id on note display
Browse files Browse the repository at this point in the history
  • Loading branch information
nevenz committed Apr 24, 2018
1 parent 9b256a8 commit 6f13d3c
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions app/src/main/java/com/orgzly/android/ui/DisplayManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,23 +146,20 @@ public static void displayNewNote(FragmentManager fragmentManager, NotePlace tar
private static void displayNote(FragmentManager fragmentManager, boolean isNew, long bookId, long noteId, Place place) {
if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG, bookId, noteId);

if (bookId <= 0) {
throw new IllegalArgumentException("Invalid book id (" + bookId + ")");
}

/* Create fragment. */
Fragment fragment = NoteFragment.forBook(isNew, bookId, noteId, place);

/* Add fragment. */
fragmentManager
.beginTransaction()
.setCustomAnimations(R.anim.fragment_enter, R.anim.fragment_exit, R.anim.fragment_enter, R.anim.fragment_exit)
.addToBackStack(null)
.replace(R.id.single_pane_container, fragment, NoteFragment.FRAGMENT_TAG)
.commit();
if (bookId > 0) {
/* Create fragment. */
Fragment fragment = NoteFragment.forBook(isNew, bookId, noteId, place);

// .setCustomAnimations(R.anim.slide_in_from_right, R.anim.slide_out_to_left, R.anim.slide_in_from_left, R.anim.slide_out_to_right)
// .setCustomAnimations(R.anim.fragment_enter, R.anim.fragment_exit, R.anim.fragment_enter, R.anim.fragment_exit, R.anim.fragment_enter, R.anim.fragment_exit, R.anim.fragment_enter, R.anim.fragment_exit)
/* Add fragment. */
fragmentManager
.beginTransaction()
.setCustomAnimations(R.anim.fragment_enter, R.anim.fragment_exit, R.anim.fragment_enter, R.anim.fragment_exit)
.addToBackStack(null)
.replace(R.id.single_pane_container, fragment, NoteFragment.FRAGMENT_TAG)
.commit();
} else {
Log.e(TAG, "displayNote: Invalid book id " + bookId);
}
}

public static void displayQuery(FragmentManager fragmentManager, @NonNull String queryString) {
Expand Down

0 comments on commit 6f13d3c

Please sign in to comment.