mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 10:49:24 +02:00
scrolling refactoring
This commit is contained in:
parent
5613be82ba
commit
caea6f0f7f
6 changed files with 13 additions and 13 deletions
|
@ -192,7 +192,7 @@ public final class FBView extends ZLTextView {
|
|||
return false;
|
||||
}
|
||||
if (!cursor.isStartOfParagraph() || !cursor.getParagraphCursor().isFirst()) {
|
||||
myReader.scrollViewManually(horizontal ? PAGE_LEFT : PAGE_TOP, myStartX, myStartY, x, y);
|
||||
myReader.scrollViewManually(myStartX, myStartY, x, y, horizontal);
|
||||
}
|
||||
} else if (diff < 0) {
|
||||
final ZLTextWordCursor cursor = getEndCursor();
|
||||
|
@ -200,7 +200,7 @@ public final class FBView extends ZLTextView {
|
|||
return false;
|
||||
}
|
||||
if (!cursor.isEndOfParagraph() || !cursor.getParagraphCursor().isLast()) {
|
||||
myReader.scrollViewManually(horizontal ? PAGE_RIGHT : PAGE_BOTTOM, myStartX, myStartY, x, y);
|
||||
myReader.scrollViewManually(myStartX, myStartY, x, y, horizontal);
|
||||
}
|
||||
} else {
|
||||
myReader.scrollViewToCenter();
|
||||
|
|
|
@ -73,9 +73,9 @@ public abstract class ZLApplication {
|
|||
}
|
||||
}
|
||||
|
||||
public final void scrollViewManually(int viewPage, int startX, int startY, int endX, int endY) {
|
||||
public final void scrollViewManually(int startX, int startY, int endX, int endY, boolean horizontally) {
|
||||
if (myWindow != null) {
|
||||
myWindow.scrollViewManually(viewPage, startX, startY, endX, endY);
|
||||
myWindow.scrollViewManually(startX, startY, endX, endY, horizontally);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ abstract public class ZLApplicationWindow {
|
|||
abstract protected void refreshMenu();
|
||||
|
||||
abstract protected void repaintView();
|
||||
abstract protected void scrollViewManually(int viewPage, int startX, int startY, int endX, int endY);
|
||||
abstract protected void scrollViewManually(int startX, int startY, int endX, int endY, boolean horizontally);
|
||||
abstract protected void scrollViewToCenter();
|
||||
abstract protected void startViewAutoScrolling(int viewPage);
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ abstract public class ZLView {
|
|||
public static final int PAGE_BOTTOM = 4;
|
||||
|
||||
public enum Animation {
|
||||
none, slide, shift, curl
|
||||
none, curl, slide, shift
|
||||
}
|
||||
public abstract Animation getAnimationType();
|
||||
|
||||
|
|
|
@ -76,10 +76,10 @@ public final class ZLAndroidApplicationWindow extends ZLApplicationWindow {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void scrollViewManually(int viewPage, int startX, int startY, int endX, int endY) {
|
||||
protected void scrollViewManually(int startX, int startY, int endX, int endY, boolean horizontally) {
|
||||
final ZLAndroidWidget widget =
|
||||
((ZLAndroidLibrary)ZLAndroidLibrary.Instance()).getWidget();
|
||||
widget.scrollManually(viewPage, startX, startY, endX, endY);
|
||||
widget.scrollManually(startX, startY, endX, endY, horizontally);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -265,11 +265,11 @@ public class ZLAndroidWidget extends View implements View.OnLongClickListener {
|
|||
}
|
||||
}
|
||||
|
||||
public void scrollManually(int viewPage, int startX, int startY, int endX, int endY) {
|
||||
final boolean horizontal =
|
||||
viewPage == ZLView.PAGE_RIGHT ||
|
||||
viewPage == ZLView.PAGE_LEFT;
|
||||
final int shift = horizontal ? endX - startX : endY - startY;
|
||||
public void scrollManually(int startX, int startY, int endX, int endY, boolean horizontally) {
|
||||
final int shift = horizontally ? endX - startX : endY - startY;
|
||||
final int viewPage = horizontally
|
||||
? (shift < 0 ? ZLView.PAGE_RIGHT : ZLView.PAGE_LEFT)
|
||||
: (shift < 0 ? ZLView.PAGE_BOTTOM : ZLView.PAGE_TOP);
|
||||
|
||||
if (myMainBitmap == null) {
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue