mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-06 03:50:19 +02:00
FBReader stores position every time after page change
This commit is contained in:
parent
7907a9a13b
commit
151355a405
11 changed files with 31 additions and 21 deletions
|
@ -1,4 +1,5 @@
|
|||
===== 1.10 (Apr ??, 2014) =====
|
||||
* Fixed current position storing
|
||||
* Experimental video support
|
||||
* CSS parsing optimization for ePubs (do not parse css files multiple times)
|
||||
* CSS support improvement: added support for space-separated classes list
|
||||
|
|
|
@ -90,9 +90,14 @@ abstract class PopupPanel extends ZLApplication.PopupPanel {
|
|||
}
|
||||
|
||||
public final void storePosition() {
|
||||
if (StartPosition != null &&
|
||||
!StartPosition.equals(getReader().getTextView().getStartCursor())) {
|
||||
getReader().addInvisibleBookmark(StartPosition);
|
||||
if (StartPosition == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final FBReaderApp reader = getReader();
|
||||
if (!StartPosition.equals(reader.getTextView().getStartCursor())) {
|
||||
reader.addInvisibleBookmark(StartPosition);
|
||||
reader.storePosition();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -127,6 +127,7 @@ public class TOCActivity extends ListActivity {
|
|||
fbreader.addInvisibleBookmark();
|
||||
fbreader.BookTextView.gotoPosition(reference.ParagraphIndex, 0, 0);
|
||||
fbreader.showBookTextView();
|
||||
fbreader.storePosition();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ public class LibraryService extends Service {
|
|||
}
|
||||
|
||||
public void close() {
|
||||
myDatabase.close();
|
||||
((SQLiteBooksDatabase)myDatabase).close();
|
||||
}
|
||||
|
||||
public String status() {
|
||||
|
|
|
@ -1012,7 +1012,7 @@ final class SQLiteBooksDatabase extends BooksDatabase {
|
|||
myStorePositionStatement.bindLong(2, position.getParagraphIndex());
|
||||
myStorePositionStatement.bindLong(3, position.getElementIndex());
|
||||
myStorePositionStatement.bindLong(4, position.getCharIndex());
|
||||
myStorePositionStatement.execute();
|
||||
myStorePositionStatement.executeInsert();
|
||||
}
|
||||
|
||||
private SQLiteStatement myDeleteVisitedHyperlinksStatement;
|
||||
|
|
|
@ -167,6 +167,7 @@ public final class FBReaderApp extends ZLApplication {
|
|||
FootnoteView.gotoPosition(label.ParagraphIndex, 0, 0);
|
||||
}
|
||||
getViewWidget().repaint();
|
||||
storePosition();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -358,6 +359,7 @@ public final class FBReaderApp extends ZLApplication {
|
|||
setView(FootnoteView);
|
||||
}
|
||||
getViewWidget().repaint();
|
||||
storePosition();
|
||||
}
|
||||
|
||||
public void showBookTextView() {
|
||||
|
@ -493,9 +495,4 @@ public final class FBReaderApp extends ZLApplication {
|
|||
getViewWidget().repaint();
|
||||
}
|
||||
}
|
||||
|
||||
public void onRepaintFinished() {
|
||||
super.onRepaintFinished();
|
||||
storePosition();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -678,4 +678,10 @@ public final class FBView extends ZLTextView {
|
|||
return ZLPaintContext.ColorAdjustingMode.NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void onScrollingFinished(PageIndex pageIndex) {
|
||||
super.onScrollingFinished(pageIndex);
|
||||
myReader.storePosition();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,10 +44,10 @@ class MoveCursorAction extends FBAction {
|
|||
} else {
|
||||
switch (myDirection) {
|
||||
case down:
|
||||
fbView.scrollPage(true, FBView.ScrollingMode.SCROLL_LINES, 1);
|
||||
fbView.turnPage(true, FBView.ScrollingMode.SCROLL_LINES, 1);
|
||||
break;
|
||||
case up:
|
||||
fbView.scrollPage(false, FBView.ScrollingMode.SCROLL_LINES, 1);
|
||||
fbView.turnPage(false, FBView.ScrollingMode.SCROLL_LINES, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ public abstract class ZLApplication {
|
|||
return myWindow != null ? myWindow.getViewWidget() : null;
|
||||
}
|
||||
|
||||
public void onRepaintFinished() {
|
||||
public final void onRepaintFinished() {
|
||||
if (myWindow != null) {
|
||||
myWindow.refresh();
|
||||
}
|
||||
|
|
|
@ -166,13 +166,13 @@ class ZLTextSelection extends ZLTextHighlighting {
|
|||
|
||||
if (myCursorInMovement == ZLTextSelectionCursor.Right) {
|
||||
if (hasPartAfterPage(page)) {
|
||||
myView.scrollPage(true, ZLTextView.ScrollingMode.SCROLL_LINES, 1);
|
||||
myView.turnPage(true, ZLTextView.ScrollingMode.SCROLL_LINES, 1);
|
||||
myView.Application.getViewWidget().reset();
|
||||
myView.preparePaintInfo();
|
||||
}
|
||||
} else {
|
||||
if (hasPartBeforePage(page)) {
|
||||
myView.scrollPage(false, ZLTextView.ScrollingMode.SCROLL_LINES, 1);
|
||||
myView.turnPage(false, ZLTextView.ScrollingMode.SCROLL_LINES, 1);
|
||||
myView.Application.getViewWidget().reset();
|
||||
myView.preparePaintInfo();
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ class ZLTextSelection extends ZLTextHighlighting {
|
|||
}
|
||||
|
||||
public void run() {
|
||||
myView.scrollPage(myScrollForward, ZLTextView.ScrollingMode.SCROLL_LINES, 1);
|
||||
myView.turnPage(myScrollForward, ZLTextView.ScrollingMode.SCROLL_LINES, 1);
|
||||
myView.preparePaintInfo();
|
||||
expandTo(myPage, myX, myY);
|
||||
myView.Application.getViewWidget().reset();
|
||||
|
|
|
@ -131,7 +131,7 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
|||
}
|
||||
while (mark.compareTo(myCurrentPage.EndCursor.getMark()) > 0) {
|
||||
doRepaint = true;
|
||||
scrollPage(true, ScrollingMode.NO_OVERLAPPING, 0);
|
||||
turnPage(true, ScrollingMode.NO_OVERLAPPING, 0);
|
||||
preparePaintInfo(myCurrentPage);
|
||||
}
|
||||
if (doRepaint) {
|
||||
|
@ -163,7 +163,7 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
|||
}
|
||||
while (!highlighting.intersects(myCurrentPage)) {
|
||||
doRepaint = true;
|
||||
scrollPage(true, ScrollingMode.NO_OVERLAPPING, 0);
|
||||
turnPage(true, ScrollingMode.NO_OVERLAPPING, 0);
|
||||
preparePaintInfo(myCurrentPage);
|
||||
}
|
||||
if (doRepaint) {
|
||||
|
@ -1321,7 +1321,7 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
|||
}
|
||||
}
|
||||
|
||||
public synchronized final void scrollPage(boolean forward, int scrollingMode, int value) {
|
||||
public synchronized final void turnPage(boolean forward, int scrollingMode, int value) {
|
||||
preparePaintInfo(myCurrentPage);
|
||||
myPreviousPage.reset();
|
||||
myNextPage.reset();
|
||||
|
@ -1346,7 +1346,7 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
|||
myNextPage.reset();
|
||||
preparePaintInfo(myCurrentPage);
|
||||
if (myCurrentPage.isEmptyPage()) {
|
||||
scrollPage(true, ScrollingMode.NO_OVERLAPPING, 0);
|
||||
turnPage(true, ScrollingMode.NO_OVERLAPPING, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1358,7 +1358,7 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
|||
myNextPage.reset();
|
||||
preparePaintInfo(myCurrentPage);
|
||||
if (myCurrentPage.isEmptyPage()) {
|
||||
scrollPage(false, ScrollingMode.NO_OVERLAPPING, 0);
|
||||
turnPage(false, ScrollingMode.NO_OVERLAPPING, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue