use of org.ebookdroid.core.PageIndex in project LibreraReader by foobnix.
the class SettingsManager method updateTempPage.
public static void updateTempPage(String fileName, int pageNumber) {
try {
BookSettings bookSettings = getTempBookSettings(fileName);
bookSettings.currentPage = new PageIndex(pageNumber, pageNumber);
db.storeBookSettings(bookSettings);
LOG.d("updateTempPage", fileName, pageNumber);
} catch (Exception e) {
LOG.e(e);
}
}
use of org.ebookdroid.core.PageIndex in project LibreraReader by foobnix.
the class HorizontalModeController method saveCurrentPage.
public void saveCurrentPage() {
if (TempHolder.get().loadingCancelled) {
LOG.d("Loading cancelled");
return;
}
// int page = PageUrl.fakeToReal(currentPage);
LOG.d("_PAGE", "saveCurrentPage", currentPage, pagesCount);
try {
BookSettings bs = SettingsManager.getBookSettings(getBookPath());
bs.updateFromAppState();
bs.currentPageChanged(new PageIndex(currentPage, currentPage), pagesCount);
bs.save();
} catch (Exception e) {
LOG.e(e);
}
}
use of org.ebookdroid.core.PageIndex in project LibreraReader by foobnix.
the class DocumentModel method initPages.
public void initPages(final IActivityController base, final IProgressIndicator task) {
recyclePages();
final BookSettings bs = SettingsManager.getBookSettings();
if (base == null || bs == null || context == null || decodeService == null) {
return;
}
final IView view = base.getView();
final CodecPageInfo defCpi = new CodecPageInfo();
defCpi.width = (view.getWidth());
defCpi.height = (view.getHeight());
int viewIndex = 0;
try {
final ArrayList<Page> list = new ArrayList<Page>();
final CodecPageInfo[] infos = retrievePagesInfo(base, bs, task);
for (int docIndex = 0; docIndex < infos.length; docIndex++) {
if (TempHolder.get().loadingCancelled) {
return;
}
if (!AppState.get().isCut) {
CodecPageInfo cpi = infos[docIndex] != null ? infos[docIndex] : defCpi;
final Page page = new Page(base, new PageIndex(docIndex, viewIndex++), PageType.FULL_PAGE, cpi);
list.add(page);
} else {
final Page page1 = new Page(base, new PageIndex(docIndex, viewIndex++), PageType.LEFT_PAGE, infos[docIndex]);
final Page page2 = new Page(base, new PageIndex(docIndex, viewIndex++), PageType.RIGHT_PAGE, infos[docIndex]);
if (AppState.get().isCutRTL) {
list.add(page2);
list.add(page1);
} else {
list.add(page1);
list.add(page2);
}
}
}
pages = list.toArray(new Page[list.size()]);
} finally {
}
}
Aggregations