Search in sources :

Example 1 with PageIndex

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);
    }
}
Also used : BookSettings(org.ebookdroid.common.settings.books.BookSettings) PageIndex(org.ebookdroid.core.PageIndex)

Example 2 with PageIndex

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);
    }
}
Also used : BookSettings(org.ebookdroid.common.settings.books.BookSettings) PageIndex(org.ebookdroid.core.PageIndex)

Example 3 with PageIndex

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 {
    }
}
Also used : IView(org.ebookdroid.ui.viewer.IView) CodecPageInfo(org.ebookdroid.core.codec.CodecPageInfo) ArrayList(java.util.ArrayList) BookSettings(org.ebookdroid.common.settings.books.BookSettings) Page(org.ebookdroid.core.Page) PageIndex(org.ebookdroid.core.PageIndex)

Aggregations

BookSettings (org.ebookdroid.common.settings.books.BookSettings)3 PageIndex (org.ebookdroid.core.PageIndex)3 ArrayList (java.util.ArrayList)1 Page (org.ebookdroid.core.Page)1 CodecPageInfo (org.ebookdroid.core.codec.CodecPageInfo)1 IView (org.ebookdroid.ui.viewer.IView)1