/** prevent swipe left if the user is scrolling the page left */ public boolean isPagePreviousOkay() { boolean isOkay = true; if (CurrentPageManager.getInstance().isMapShown()) { // allow swipe left if at left edge of map boolean isAtLeftEdge = (getScrollX() == 0); // the first side swipe takes us to the edge and second takes us to next page isOkay = isAtLeftEdge && wasAtLeftEdge; wasAtLeftEdge = isAtLeftEdge; wasAtRightEdge = false; } return isOkay; }
/** prevent swipe right if the user is scrolling the page right */ public boolean isPageNextOkay() { boolean isOkay = true; if (CurrentPageManager.getInstance().isMapShown()) { // allow swipe right if at right side of map boolean isAtRightEdge = (getScrollX() >= getMaxHorizontalScroll()); // the first side swipe takes us to the edge and second takes us to next page isOkay = isAtRightEdge && wasAtRightEdge; wasAtRightEdge = isAtRightEdge; wasAtLeftEdge = false; } return isOkay; }
public static CurrentPageManager getInstance() { if (singleton == null) { synchronized (CurrentPageManager.class) { if (singleton == null) { CurrentPageManager instance = new CurrentPageManager(); instance.currentBibleVerse = new CurrentBibleVerse(); instance.currentBiblePage = new CurrentBiblePage(instance.currentBibleVerse); instance.currentCommentaryPage = new CurrentCommentaryPage(instance.currentBibleVerse); instance.currentMyNotePage = new CurrentMyNotePage(instance.currentBibleVerse); instance.currentDictionaryPage = new CurrentDictionaryPage(); instance.currentGeneralBookPage = new CurrentGeneralBookPage(); instance.currentDisplayedPage = instance.currentBiblePage; singleton = instance; } } } return singleton; }
/** * show a page from bible commentary * * @param html */ @Override public void show(String html, int jumpToVerse, float jumpToYOffsetRatio) { Log.d(TAG, "Show(html," + jumpToVerse + "," + jumpToYOffsetRatio + ")"); // call this from here because some documents may require an adjusted font size e.g. those using // Greek font applyFontSize(); mJumpToVerse = jumpToVerse; mJumpToYOffsetRatio = jumpToYOffsetRatio; // allow zooming if map boolean isMap = CurrentPageManager.getInstance().isMapShown(); getSettings().setBuiltInZoomControls(isMap); // http://stackoverflow.com/questions/3808532/how-to-set-the-initial-zoom-width-for-a-webview getSettings().setLoadWithOverviewMode(isMap); getSettings().setUseWideViewPort(isMap); loadDataWithBaseURL("http://baseUrl", html, "text/html", "UTF-8", "http://historyUrl"); }
private void onButtonPress() { CurrentPageManager.getInstance().setCurrentDocument(mSuggestedDocument); }