Skip to content

Commit

Permalink
renaming: autoScrolling -> animatedScrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
geometer committed Jun 11, 2011
1 parent 529a7a6 commit fe64b61
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/org/geometerplus/fbreader/fbreader/FBView.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public boolean onFingerRelease(int x, int y) {
}

if (isFlickScrollingEnabled()) {
myReader.getViewWidget().startAutoScrolling(
myReader.getViewWidget().startAnimatedScrolling(
x, y, ScrollingPreferences.Instance().AnimationSpeedOption.getValue()
);
return true;
Expand Down
4 changes: 2 additions & 2 deletions src/org/geometerplus/fbreader/fbreader/TurnPageAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public boolean isEnabled() {

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,
Expand All @@ -49,7 +49,7 @@ public void run() {

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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void run() {
forward = !forward;
}

Reader.getViewWidget().startAutoScrolling(
Reader.getViewWidget().startAnimatedScrolling(
forward ? FBView.PageIndex.next : FBView.PageIndex.previous,
preferences.HorizontalOption.getValue()
? FBView.Direction.rightToLeft : FBView.Direction.up,
Expand Down
6 changes: 3 additions & 3 deletions src/org/geometerplus/zlibrary/core/view/ZLViewWidget.java
Original file line number Diff line number Diff line change
Expand 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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -81,7 +81,7 @@ void scrollTo(int x, int y) {
}
}

void startAutoScrolling(int x, int y, int speed) {
void startAnimatedScrolling(int x, int y, int speed) {
if (myMode != Mode.ManualScrolling) {
return;
}
Expand All @@ -96,7 +96,7 @@ void startAutoScrolling(int x, int y, int speed) {
(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) {
Expand Down Expand Up @@ -136,16 +136,16 @@ void startAutoScrolling(int x, int y, int speed) {
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:
Expand All @@ -157,12 +157,12 @@ public void startAutoScrolling(ZLView.PageIndex pageIndex, Integer x, Integer y,
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,14 @@ ZLView.PageIndex getPageToScrollTo(int x, int y) {
}

@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;
Expand Down Expand Up @@ -245,7 +245,7 @@ void doStep() {
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 {
Expand All @@ -268,7 +268,7 @@ void doStep() {
}

final boolean xSpeedIsPositive, ySpeedIsPositive;
if (getMode() == Mode.AutoScrollingForward) {
if (getMode() == Mode.AnimatedScrollingForward) {
xSpeedIsPositive = cornerX == 0;
ySpeedIsPositive = cornerY == 0;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void doStep() {
}

@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;
Expand All @@ -56,7 +56,7 @@ protected void setupAutoScrollingStart(Integer x, Integer y) {
}

@Override
protected void startAutoScrollingInternal(int speed) {
protected void startAnimatedScrollingInternal(int speed) {
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ZLView.PageIndex getPageToScrollTo(int x, int y) {
}

@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;
Expand All @@ -63,7 +63,7 @@ protected void setupAutoScrollingStart(Integer x, Integer y) {
}

@Override
protected void startAutoScrollingInternal(int speed) {
protected void startAnimatedScrollingInternal(int speed) {
mySpeedFactor = (float)Math.pow(1.5, 0.25 * speed);
doStep();
}
Expand All @@ -89,7 +89,7 @@ void doStep() {
break;
}
final int bound;
if (getMode() == Mode.AutoScrollingForward) {
if (getMode() == Mode.AnimatedScrollingForward) {
bound = myDirection.IsHorizontal ? myWidth : myHeight;
} else {
bound = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ private void onDrawInScrolling(Canvas canvas) {
drawFooter(canvas);
} else {
switch (oldMode) {
case AutoScrollingForward:
case AnimatedScrollingForward:
{
final ZLView.PageIndex index = animator.getPageToScrollTo();
myBitmapManager.shift(index == ZLView.PageIndex.next);
view.onScrollingFinished(index);
ZLApplication.Instance().onRepaintFinished();
break;
}
case AutoScrollingBackward:
case AnimatedScrollingBackward:
view.onScrollingFinished(ZLView.PageIndex.current);
break;
}
Expand Down Expand Up @@ -171,40 +171,40 @@ public void scrollManuallyTo(int x, int y) {
}
}

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();
}

Expand Down

0 comments on commit fe64b61

Please sign in to comment.