mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 18:29:23 +02:00
renaming: autoScrolling -> animatedScrolling
This commit is contained in:
parent
529a7a6de5
commit
fe64b6169d
9 changed files with 35 additions and 35 deletions
|
@ -195,7 +195,7 @@ public final class FBView extends ZLTextView {
|
|||
}
|
||||
|
||||
if (isFlickScrollingEnabled()) {
|
||||
myReader.getViewWidget().startAutoScrolling(
|
||||
myReader.getViewWidget().startAnimatedScrolling(
|
||||
x, y, ScrollingPreferences.Instance().AnimationSpeedOption.getValue()
|
||||
);
|
||||
return true;
|
||||
|
|
|
@ -39,7 +39,7 @@ class TurnPageAction extends FBAction {
|
|||
|
||||
public void run() {
|
||||
final ScrollingPreferences preferences = ScrollingPreferences.Instance();
|
||||
Reader.getViewWidget().startAutoScrolling(
|
||||
Reader.getViewWidget().startAnimatedScrolling(
|
||||
myForward ? FBView.PageIndex.next : FBView.PageIndex.previous,
|
||||
preferences.HorizontalOption.getValue()
|
||||
? FBView.Direction.rightToLeft : FBView.Direction.up,
|
||||
|
@ -49,7 +49,7 @@ class TurnPageAction extends FBAction {
|
|||
|
||||
public void runWithCoordinates(int x, int y) {
|
||||
final ScrollingPreferences preferences = ScrollingPreferences.Instance();
|
||||
Reader.getViewWidget().startAutoScrolling(
|
||||
Reader.getViewWidget().startAnimatedScrolling(
|
||||
myForward ? FBView.PageIndex.next : FBView.PageIndex.previous,
|
||||
x, y,
|
||||
preferences.HorizontalOption.getValue()
|
||||
|
|
|
@ -39,7 +39,7 @@ class VolumeKeyTurnPageAction extends FBAction {
|
|||
forward = !forward;
|
||||
}
|
||||
|
||||
Reader.getViewWidget().startAutoScrolling(
|
||||
Reader.getViewWidget().startAnimatedScrolling(
|
||||
forward ? FBView.PageIndex.next : FBView.PageIndex.previous,
|
||||
preferences.HorizontalOption.getValue()
|
||||
? FBView.Direction.rightToLeft : FBView.Direction.up,
|
||||
|
|
|
@ -25,7 +25,7 @@ public interface ZLViewWidget {
|
|||
|
||||
void startManualScrolling(int x, int y, ZLView.Direction direction);
|
||||
void scrollManuallyTo(int x, int y);
|
||||
void startAutoScrolling(ZLView.PageIndex pageIndex, int x, int y, ZLView.Direction direction, int speed);
|
||||
void startAutoScrolling(ZLView.PageIndex pageIndex, ZLView.Direction direction, int speed);
|
||||
void startAutoScrolling(int x, int y, int speed);
|
||||
void startAnimatedScrolling(ZLView.PageIndex pageIndex, int x, int y, ZLView.Direction direction, int speed);
|
||||
void startAnimatedScrolling(ZLView.PageIndex pageIndex, ZLView.Direction direction, int speed);
|
||||
void startAnimatedScrolling(int x, int y, int speed);
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ abstract class AnimationProvider {
|
|||
static enum Mode {
|
||||
NoScrolling(false),
|
||||
ManualScrolling(false),
|
||||
AutoScrollingForward(true),
|
||||
AutoScrollingBackward(true);
|
||||
AnimatedScrollingForward(true),
|
||||
AnimatedScrollingBackward(true);
|
||||
|
||||
final boolean Auto;
|
||||
|
||||
|
@ -81,7 +81,7 @@ abstract class AnimationProvider {
|
|||
}
|
||||
}
|
||||
|
||||
void startAutoScrolling(int x, int y, int speed) {
|
||||
void startAnimatedScrolling(int x, int y, int speed) {
|
||||
if (myMode != Mode.ManualScrolling) {
|
||||
return;
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ abstract class AnimationProvider {
|
|||
(myHeight > myWidth ? myHeight / 4 : myHeight / 3);
|
||||
boolean forward = Math.abs(diff) > minDiff;
|
||||
|
||||
myMode = forward ? Mode.AutoScrollingForward : Mode.AutoScrollingBackward;
|
||||
myMode = forward ? Mode.AnimatedScrollingForward : Mode.AnimatedScrollingBackward;
|
||||
|
||||
float velocity = 15;
|
||||
if (myDrawInfos.size() > 1) {
|
||||
|
@ -136,16 +136,16 @@ abstract class AnimationProvider {
|
|||
break;
|
||||
}
|
||||
|
||||
startAutoScrollingInternal(speed);
|
||||
startAnimatedScrollingInternal(speed);
|
||||
}
|
||||
|
||||
public void startAutoScrolling(ZLView.PageIndex pageIndex, Integer x, Integer y, int speed) {
|
||||
public void startAnimatedScrolling(ZLView.PageIndex pageIndex, Integer x, Integer y, int speed) {
|
||||
if (myMode.Auto) {
|
||||
return;
|
||||
}
|
||||
|
||||
terminate();
|
||||
myMode = Mode.AutoScrollingForward;
|
||||
myMode = Mode.AnimatedScrollingForward;
|
||||
|
||||
switch (myDirection) {
|
||||
case up:
|
||||
|
@ -157,12 +157,12 @@ abstract class AnimationProvider {
|
|||
mySpeed = pageIndex == ZLView.PageIndex.next ? 15 : -15;
|
||||
break;
|
||||
}
|
||||
setupAutoScrollingStart(x, y);
|
||||
startAutoScrollingInternal(speed);
|
||||
setupAnimatedScrollingStart(x, y);
|
||||
startAnimatedScrollingInternal(speed);
|
||||
}
|
||||
|
||||
protected abstract void startAutoScrollingInternal(int speed);
|
||||
protected abstract void setupAutoScrollingStart(Integer x, Integer y);
|
||||
protected abstract void startAnimatedScrollingInternal(int speed);
|
||||
protected abstract void setupAnimatedScrollingStart(Integer x, Integer y);
|
||||
|
||||
boolean inProgress() {
|
||||
return myMode != Mode.NoScrolling;
|
||||
|
|
|
@ -199,14 +199,14 @@ class CurlAnimationProvider extends AnimationProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void startAutoScrollingInternal(int speed) {
|
||||
protected void startAnimatedScrollingInternal(int speed) {
|
||||
mySpeedFactor = (float)Math.pow(2.0, 0.25 * speed);
|
||||
mySpeed *= 1.5;
|
||||
doStep();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupAutoScrollingStart(Integer x, Integer y) {
|
||||
protected void setupAnimatedScrollingStart(Integer x, Integer y) {
|
||||
if (x == null || y == null) {
|
||||
if (myDirection.IsHorizontal) {
|
||||
x = mySpeed < 0 ? myWidth - 3 : 3;
|
||||
|
@ -245,7 +245,7 @@ class CurlAnimationProvider extends AnimationProvider {
|
|||
final int cornerY = myStartY > myHeight / 2 ? myHeight : 0;
|
||||
|
||||
final int boundX, boundY;
|
||||
if (getMode() == Mode.AutoScrollingForward) {
|
||||
if (getMode() == Mode.AnimatedScrollingForward) {
|
||||
boundX = cornerX == 0 ? 2 * myWidth : -myWidth;
|
||||
boundY = cornerY == 0 ? 2 * myHeight : -myHeight;
|
||||
} else {
|
||||
|
@ -268,7 +268,7 @@ class CurlAnimationProvider extends AnimationProvider {
|
|||
}
|
||||
|
||||
final boolean xSpeedIsPositive, ySpeedIsPositive;
|
||||
if (getMode() == Mode.AutoScrollingForward) {
|
||||
if (getMode() == Mode.AnimatedScrollingForward) {
|
||||
xSpeedIsPositive = cornerX == 0;
|
||||
ySpeedIsPositive = cornerY == 0;
|
||||
} else {
|
||||
|
|
|
@ -43,7 +43,7 @@ class NoneAnimationProvider extends AnimationProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void setupAutoScrollingStart(Integer x, Integer y) {
|
||||
protected void setupAnimatedScrollingStart(Integer x, Integer y) {
|
||||
if (myDirection.IsHorizontal) {
|
||||
myStartX = mySpeed < 0 ? myWidth : 0;
|
||||
myEndX = myWidth - myStartX;
|
||||
|
@ -56,7 +56,7 @@ class NoneAnimationProvider extends AnimationProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void startAutoScrollingInternal(int speed) {
|
||||
protected void startAnimatedScrollingInternal(int speed) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -48,7 +48,7 @@ abstract class SimpleAnimationProvider extends AnimationProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void setupAutoScrollingStart(Integer x, Integer y) {
|
||||
protected void setupAnimatedScrollingStart(Integer x, Integer y) {
|
||||
if (x == null || y == null) {
|
||||
if (myDirection.IsHorizontal) {
|
||||
x = mySpeed < 0 ? myWidth : 0;
|
||||
|
@ -63,7 +63,7 @@ abstract class SimpleAnimationProvider extends AnimationProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void startAutoScrollingInternal(int speed) {
|
||||
protected void startAnimatedScrollingInternal(int speed) {
|
||||
mySpeedFactor = (float)Math.pow(1.5, 0.25 * speed);
|
||||
doStep();
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ abstract class SimpleAnimationProvider extends AnimationProvider {
|
|||
break;
|
||||
}
|
||||
final int bound;
|
||||
if (getMode() == Mode.AutoScrollingForward) {
|
||||
if (getMode() == Mode.AnimatedScrollingForward) {
|
||||
bound = myDirection.IsHorizontal ? myWidth : myHeight;
|
||||
} else {
|
||||
bound = 0;
|
||||
|
|
|
@ -132,7 +132,7 @@ public class ZLAndroidWidget extends View implements ZLViewWidget, View.OnLongCl
|
|||
drawFooter(canvas);
|
||||
} else {
|
||||
switch (oldMode) {
|
||||
case AutoScrollingForward:
|
||||
case AnimatedScrollingForward:
|
||||
{
|
||||
final ZLView.PageIndex index = animator.getPageToScrollTo();
|
||||
myBitmapManager.shift(index == ZLView.PageIndex.next);
|
||||
|
@ -140,7 +140,7 @@ public class ZLAndroidWidget extends View implements ZLViewWidget, View.OnLongCl
|
|||
ZLApplication.Instance().onRepaintFinished();
|
||||
break;
|
||||
}
|
||||
case AutoScrollingBackward:
|
||||
case AnimatedScrollingBackward:
|
||||
view.onScrollingFinished(ZLView.PageIndex.current);
|
||||
break;
|
||||
}
|
||||
|
@ -171,40 +171,40 @@ public class ZLAndroidWidget extends View implements ZLViewWidget, View.OnLongCl
|
|||
}
|
||||
}
|
||||
|
||||
public void startAutoScrolling(ZLView.PageIndex pageIndex, int x, int y, ZLView.Direction direction, int speed) {
|
||||
public void startAnimatedScrolling(ZLView.PageIndex pageIndex, int x, int y, ZLView.Direction direction, int speed) {
|
||||
final ZLView view = ZLApplication.Instance().getCurrentView();
|
||||
if (pageIndex == ZLView.PageIndex.current || !view.canScroll(pageIndex)) {
|
||||
return;
|
||||
}
|
||||
final AnimationProvider animator = getAnimationProvider();
|
||||
animator.setup(direction, getWidth(), getMainAreaHeight());
|
||||
animator.startAutoScrolling(pageIndex, x, y, speed);
|
||||
animator.startAnimatedScrolling(pageIndex, x, y, speed);
|
||||
if (animator.getMode().Auto) {
|
||||
postInvalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public void startAutoScrolling(ZLView.PageIndex pageIndex, ZLView.Direction direction, int speed) {
|
||||
public void startAnimatedScrolling(ZLView.PageIndex pageIndex, ZLView.Direction direction, int speed) {
|
||||
final ZLView view = ZLApplication.Instance().getCurrentView();
|
||||
if (pageIndex == ZLView.PageIndex.current || !view.canScroll(pageIndex)) {
|
||||
return;
|
||||
}
|
||||
final AnimationProvider animator = getAnimationProvider();
|
||||
animator.setup(direction, getWidth(), getMainAreaHeight());
|
||||
animator.startAutoScrolling(pageIndex, null, null, speed);
|
||||
animator.startAnimatedScrolling(pageIndex, null, null, speed);
|
||||
if (animator.getMode().Auto) {
|
||||
postInvalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public void startAutoScrolling(int x, int y, int speed) {
|
||||
public void startAnimatedScrolling(int x, int y, int speed) {
|
||||
final ZLView view = ZLApplication.Instance().getCurrentView();
|
||||
final AnimationProvider animator = getAnimationProvider();
|
||||
if (!view.canScroll(animator.getPageToScrollTo(x, y))) {
|
||||
animator.terminate();
|
||||
return;
|
||||
}
|
||||
animator.startAutoScrolling(x, y, speed);
|
||||
animator.startAnimatedScrolling(x, y, speed);
|
||||
postInvalidate();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue