private void gotoPreviousParagraph() { for (int i = myParagraphIndex - 1; i >= 0; --i) { if (myApi.getParagraphText(i).length() > 0) { myParagraphIndex = i; break; } } if (myApi.getPageStart().ParagraphIndex >= myParagraphIndex) { myApi.setPageStart(new TextPosition(myParagraphIndex, 0, 0)); } highlightParagraph(); runOnUiThread( new Runnable() { public void run() { findViewById(R.id.speak_menu_forward).setEnabled(true); findViewById(R.id.speak_menu_pause).setEnabled(true); } }); }
private String getNextParagraph() { String text = ""; for (; myParagraphIndex < myParagraphsNumber; ++myParagraphIndex) { final String s = myApi.getParagraphText(myParagraphIndex); if (s.length() > 0) { text = s; break; } } if (!"".equals(text) && !myApi.isPageEndOfText()) { myApi.setPageStart(new TextPosition(myParagraphIndex, 0, 0)); } highlightParagraph(); if (myParagraphIndex >= myParagraphsNumber) { runOnUiThread( new Runnable() { public void run() { findViewById(R.id.speak_menu_forward).setEnabled(false); } }); } return text; }