/** 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; }
/** 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; }
/** * 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); }