mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 19:42:17 +02:00
code simplification
This commit is contained in:
parent
3a55bed5c2
commit
faf3a1a8d5
2 changed files with 13 additions and 10 deletions
|
@ -175,17 +175,8 @@ public final class FBView extends ZLTextView {
|
||||||
|
|
||||||
if (isFlickScrollingEnabled()) {
|
if (isFlickScrollingEnabled()) {
|
||||||
final boolean horizontal = ScrollingPreferences.Instance().HorizontalOption.getValue();
|
final boolean horizontal = ScrollingPreferences.Instance().HorizontalOption.getValue();
|
||||||
final int diff = horizontal ? x - myStartX : y - myStartY;
|
|
||||||
final Direction direction = horizontal ? Direction.rightToLeft : Direction.up;
|
final Direction direction = horizontal ? Direction.rightToLeft : Direction.up;
|
||||||
if (diff >= 0) {
|
myReader.scrollViewManually(myStartX, myStartY, x, y, direction);
|
||||||
if (canScrollBackward()) {
|
|
||||||
myReader.scrollViewManually(myStartX, myStartY, x, y, direction);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (canScrollForward()) {
|
|
||||||
myReader.scrollViewManually(myStartX, myStartY, x, y, direction);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -153,6 +153,18 @@ public class ZLAndroidWidget extends View implements View.OnLongClickListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void scrollManually(int startX, int startY, int endX, int endY, ZLView.Direction direction) {
|
public void scrollManually(int startX, int startY, int endX, int endY, ZLView.Direction direction) {
|
||||||
|
final ZLView view = ZLApplication.Instance().getCurrentView();
|
||||||
|
final int diff = direction.IsHorizontal ? endX - startX : endY - startY;
|
||||||
|
if (diff >= 0) {
|
||||||
|
if (!view.canScrollBackward()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!view.canScrollForward()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final AnimationProvider animator = getAnimationProvider();
|
final AnimationProvider animator = getAnimationProvider();
|
||||||
if (!animator.inProgress()) {
|
if (!animator.inProgress()) {
|
||||||
animator.startManualScrolling(
|
animator.startManualScrolling(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue