mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 17:59:33 +02:00
updated API
This commit is contained in:
parent
3ea71a1efc
commit
d2dfafccf8
5 changed files with 93 additions and 17 deletions
|
@ -52,6 +52,10 @@ public class ApiImplementation extends ApiInterface.Stub implements ApiMethods {
|
|||
return getTextPosition(myReader.getTextView().getStartCursor());
|
||||
case GET_PAGE_END:
|
||||
return getTextPosition(myReader.getTextView().getEndCursor());
|
||||
case IS_PAGE_END_OF_SECTION:
|
||||
return ApiObject.envelope(isPageEndOfSection());
|
||||
case IS_PAGE_END_OF_TEXT:
|
||||
return ApiObject.envelope(isPageEndOfText());
|
||||
case SET_PAGE_START:
|
||||
setPageStart(
|
||||
(TextPosition)parameters[0]
|
||||
|
@ -77,6 +81,16 @@ public class ApiImplementation extends ApiInterface.Stub implements ApiMethods {
|
|||
);
|
||||
}
|
||||
|
||||
private boolean isPageEndOfSection() {
|
||||
final ZLTextWordCursor cursor = myReader.getTextView().getEndCursor();
|
||||
return cursor.isEndOfParagraph() && cursor.getParagraphCursor().isEndOfSection();
|
||||
}
|
||||
|
||||
private boolean isPageEndOfText() {
|
||||
final ZLTextWordCursor cursor = myReader.getTextView().getEndCursor();
|
||||
return cursor.isEndOfParagraph() && cursor.getParagraphCursor().isLast();
|
||||
}
|
||||
|
||||
private void setPageStart(TextPosition position) {
|
||||
myReader.getTextView().gotoPosition(position.ParagraphIndex, position.ElementIndex, position.CharIndex);
|
||||
myReader.getViewWidget().repaint();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue