public void initPages( final IActivityController base, final IActivityController.IBookLoadTask 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; final long start = System.currentTimeMillis(); try { final ArrayList<Page> list = new ArrayList<Page>(); final CodecPageInfo[] infos = retrievePagesInfo(base, bs, task); for (int docIndex = 0; docIndex < infos.length; docIndex++) { if (!bs.splitPages || infos[docIndex] == null || (infos[docIndex].width < infos[docIndex].height)) { final Page page = new Page( base, new PageIndex(docIndex, viewIndex++), PageType.FULL_PAGE, infos[docIndex] != null ? infos[docIndex] : defCpi); list.add(page); } else { final Page page1 = new Page( base, new PageIndex(docIndex, viewIndex++), PageType.LEFT_PAGE, infos[docIndex]); list.add(page1); final Page page2 = new Page( base, new PageIndex(docIndex, viewIndex++), PageType.RIGHT_PAGE, infos[docIndex]); list.add(page2); } } pages = list.toArray(new Page[list.size()]); if (pages.length > 0) { createBookThumbnail(bs, pages[0], false); } } finally { LCTX.d("Loading page info: " + (System.currentTimeMillis() - start) + " ms"); } }
public TouchManagerView(final IActivityController base) { super(base.getContext()); this.base = base; this.actions = new ActionController<TouchManagerView>(base, this); this.detector = new DefaultGestureDetector(getContext(), new GestureListener()); super.setVisibility(View.GONE); setFocusable(true); setFocusableInTouchMode(true); bgPaint = new Paint(); bgPaint.setColor(Color.BLACK); bgPaint.setStyle(Paint.Style.FILL); bgPaint.setAlpha(0x40); gridPaint = new Paint(); gridPaint.setColor(Color.GREEN); }