MCPcopy Create free account
hub / github.com/dumbledore/AlbiteREADER / openBook

Method openBook

src/org/albite/albite/BookCanvas.java:1234–1284  ·  view source on GitHub ↗
(final String bookURL)

Source from the content-addressed store, hash-verified

1232 }
1233
1234 public final Book openBook(final String bookURL)
1235 throws IOException, BookException {
1236
1237 //#debug
1238 AlbiteMIDlet.LOGGER.log("Opening book...");
1239
1240 /*
1241 * If the book is already open, no need to load it again
1242 */
1243 if (isBookOpen(bookURL)) {
1244 mode = MODE_PAGE_READING;
1245 return currentBook;
1246 }
1247
1248 /*
1249 * try to open the book
1250 */
1251 //#debug
1252 AlbiteMIDlet.LOGGER.log("Trying to open...");
1253 Book newBook = null;
1254
1255 newBook = Book.open(bookURL);
1256
1257 /*
1258 * All was OK, let's close current book
1259 */
1260 closeBook();
1261
1262 currentBook = newBook;
1263
1264 //#if !(TinyMode || TinyModeExport || LightMode || LightModeExport)
1265 /*
1266 * load hyphenator according to book language
1267 */
1268 loadHyphenator(currentBook.getLanguage());
1269 //#endif
1270 /*
1271 * Reset the Toc
1272 */
1273 app.resetToc();
1274
1275 /*
1276 * Go to position and effectively reflow chapter
1277 */
1278 goToPosition(currentBook.getCurrentChapter(),
1279 currentBook.getCurrentChapterPosition());
1280
1281 mode = MODE_PAGE_READING;
1282
1283 return currentBook;
1284 }
1285
1286 private void closeBook() {
1287 if (isBookOpen()) {

Callers 1

executeMethod · 0.80

Calls 10

isBookOpenMethod · 0.95
openMethod · 0.95
closeBookMethod · 0.95
loadHyphenatorMethod · 0.95
goToPositionMethod · 0.95
logMethod · 0.80
resetTocMethod · 0.80
getCurrentChapterMethod · 0.80
getLanguageMethod · 0.45

Tested by

no test coverage detected