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