boolean () { int listSize = documentOfPagesModel.getPagesAmount(); if (listSize < 1) { return true; } long numberOfPage0 = documentOfPagesModel.getPageByIndex(0).getPageNumber(); if (numberOfPage0 != targetVisiblePosition.pageNumber - 2 && numberOfPage0 != targetVisiblePosition.pageNumber - 1) { // we can have no any extra pages before visible one only in case, when target visible page is in the beginning of the file return numberOfPage0 == targetVisiblePosition.pageNumber && targetVisiblePosition.pageNumber == 0; } if (listSize < 2) { return true; } long numberOfPage1 = documentOfPagesModel.getPageByIndex(1).getPageNumber(); if (numberOfPage1 == targetVisiblePosition.pageNumber) { return true; } if (numberOfPage1 != targetVisiblePosition.pageNumber - 1) { return false; } if (listSize < 3) { return true; } long numberOfPage2 = documentOfPagesModel.getPageByIndex(2).getPageNumber(); return numberOfPage2 == targetVisiblePosition.pageNumber; }