1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-03 17:59:33 +02:00

ZLViewEnums is an interface

This commit is contained in:
Nikolay Pultsin 2014-12-07 03:52:01 +00:00
parent da642ae405
commit 22fd615a98
17 changed files with 91 additions and 103 deletions

View file

@ -25,10 +25,11 @@ import org.geometerplus.zlibrary.core.application.*;
import org.geometerplus.zlibrary.core.drm.FileEncryptionInfo;
import org.geometerplus.zlibrary.core.drm.EncryptionMethod;
import org.geometerplus.zlibrary.core.util.*;
import org.geometerplus.zlibrary.core.view.ZLViewEnums;
import org.geometerplus.zlibrary.text.hyphenation.ZLTextHyphenator;
import org.geometerplus.zlibrary.text.model.ZLTextModel;
import org.geometerplus.zlibrary.text.view.*;
import org.geometerplus.fbreader.book.*;
import org.geometerplus.fbreader.bookmodel.*;
import org.geometerplus.fbreader.fbreader.options.*;
@ -112,10 +113,10 @@ public final class FBReaderApp extends ZLApplication {
addAction(ActionCode.TURN_PAGE_FORWARD, new TurnPageAction(this, true));
addAction(ActionCode.TURN_PAGE_BACK, new TurnPageAction(this, false));
addAction(ActionCode.MOVE_CURSOR_UP, new MoveCursorAction(this, ZLViewEnums.Direction.up));
addAction(ActionCode.MOVE_CURSOR_DOWN, new MoveCursorAction(this, ZLViewEnums.Direction.down));
addAction(ActionCode.MOVE_CURSOR_LEFT, new MoveCursorAction(this, ZLViewEnums.Direction.rightToLeft));
addAction(ActionCode.MOVE_CURSOR_RIGHT, new MoveCursorAction(this, ZLViewEnums.Direction.leftToRight));
addAction(ActionCode.MOVE_CURSOR_UP, new MoveCursorAction(this, FBView.Direction.up));
addAction(ActionCode.MOVE_CURSOR_DOWN, new MoveCursorAction(this, FBView.Direction.down));
addAction(ActionCode.MOVE_CURSOR_LEFT, new MoveCursorAction(this, FBView.Direction.rightToLeft));
addAction(ActionCode.MOVE_CURSOR_RIGHT, new MoveCursorAction(this, FBView.Direction.leftToRight));
addAction(ActionCode.VOLUME_KEY_SCROLL_FORWARD, new VolumeKeyTurnPageAction(this, true));
addAction(ActionCode.VOLUME_KEY_SCROLL_BACK, new VolumeKeyTurnPageAction(this, false));

View file

@ -26,13 +26,12 @@ import org.geometerplus.zlibrary.core.filesystem.ZLResourceFile;
import org.geometerplus.zlibrary.core.fonts.FontEntry;
import org.geometerplus.zlibrary.core.library.ZLibrary;
import org.geometerplus.zlibrary.core.util.ZLColor;
import org.geometerplus.zlibrary.core.view.*;
import org.geometerplus.zlibrary.core.view.ZLViewEnums.Animation;
import org.geometerplus.zlibrary.core.view.ZLViewEnums.Direction;
import org.geometerplus.zlibrary.core.view.ZLViewEnums.PageIndex;
import org.geometerplus.zlibrary.core.view.ZLPaintContext;
import org.geometerplus.zlibrary.text.model.ZLTextModel;
import org.geometerplus.zlibrary.text.view.*;
import org.geometerplus.zlibrary.text.view.style.ZLTextStyleCollection;
import org.geometerplus.fbreader.bookmodel.BookModel;
import org.geometerplus.fbreader.bookmodel.FBHyperlinkType;
import org.geometerplus.fbreader.bookmodel.TOCTree;

View file

@ -19,14 +19,13 @@
package org.geometerplus.fbreader.fbreader;
import org.geometerplus.zlibrary.core.view.ZLViewEnums;
import org.geometerplus.zlibrary.text.view.ZLTextRegion;
import org.geometerplus.zlibrary.text.view.ZLTextWordRegionSoul;
class MoveCursorAction extends FBAction {
private final ZLViewEnums.Direction myDirection;
private final FBView.Direction myDirection;
MoveCursorAction(FBReaderApp fbreader, ZLViewEnums.Direction direction) {
MoveCursorAction(FBReaderApp fbreader, FBView.Direction direction) {
super(fbreader);
myDirection = direction;
}

View file

@ -20,7 +20,6 @@
package org.geometerplus.fbreader.fbreader;
import org.geometerplus.fbreader.fbreader.options.PageTurningOptions;
import org.geometerplus.zlibrary.core.view.ZLViewEnums;
class TurnPageAction extends FBAction {
private final boolean myForward;
@ -46,17 +45,17 @@ class TurnPageAction extends FBAction {
final int x = (Integer)params[0];
final int y = (Integer)params[1];
Reader.getViewWidget().startAnimatedScrolling(
myForward ? ZLViewEnums.PageIndex.next : ZLViewEnums.PageIndex.previous,
myForward ? FBView.PageIndex.next : FBView.PageIndex.previous,
x, y,
preferences.Horizontal.getValue()
? ZLViewEnums.Direction.rightToLeft : ZLViewEnums.Direction.up,
? FBView.Direction.rightToLeft : FBView.Direction.up,
preferences.AnimationSpeed.getValue()
);
} else {
Reader.getViewWidget().startAnimatedScrolling(
myForward ? ZLViewEnums.PageIndex.next : ZLViewEnums.PageIndex.previous,
myForward ? FBView.PageIndex.next : FBView.PageIndex.previous,
preferences.Horizontal.getValue()
? ZLViewEnums.Direction.rightToLeft : ZLViewEnums.Direction.up,
? FBView.Direction.rightToLeft : FBView.Direction.up,
preferences.AnimationSpeed.getValue()
);
}

View file

@ -20,7 +20,6 @@
package org.geometerplus.fbreader.fbreader;
import org.geometerplus.fbreader.fbreader.options.PageTurningOptions;
import org.geometerplus.zlibrary.core.view.ZLViewEnums;
class VolumeKeyTurnPageAction extends FBAction {
private final boolean myForward;
@ -34,9 +33,9 @@ class VolumeKeyTurnPageAction extends FBAction {
protected void run(Object ... params) {
final PageTurningOptions preferences = Reader.PageTurningOptions;
Reader.getViewWidget().startAnimatedScrolling(
myForward ? ZLViewEnums.PageIndex.next : ZLViewEnums.PageIndex.previous,
myForward ? FBView.PageIndex.next : FBView.PageIndex.previous,
preferences.Horizontal.getValue()
? ZLViewEnums.Direction.rightToLeft : ZLViewEnums.Direction.up,
? FBView.Direction.rightToLeft : FBView.Direction.up,
preferences.AnimationSpeed.getValue()
);
}

View file

@ -21,7 +21,6 @@ package org.geometerplus.fbreader.fbreader.options;
import org.geometerplus.zlibrary.core.options.*;
import org.geometerplus.zlibrary.core.view.ZLView;
import org.geometerplus.zlibrary.core.view.ZLViewEnums;
public class PageTurningOptions {
public static enum FingerScrollingType {
@ -30,8 +29,8 @@ public class PageTurningOptions {
public final ZLEnumOption<FingerScrollingType> FingerScrolling =
new ZLEnumOption<FingerScrollingType>("Scrolling", "Finger", FingerScrollingType.byTapAndFlick);
public final ZLEnumOption<ZLViewEnums.Animation> Animation =
new ZLEnumOption<ZLViewEnums.Animation>("Scrolling", "Animation", ZLViewEnums.Animation.slide);
public final ZLEnumOption<ZLView.Animation> Animation =
new ZLEnumOption<ZLView.Animation>("Scrolling", "Animation", ZLView.Animation.slide);
public final ZLIntegerRangeOption AnimationSpeed =
new ZLIntegerRangeOption("Scrolling", "AnimationSpeed", 1, 10, 7);

View file

@ -20,10 +20,8 @@
package org.geometerplus.zlibrary.core.view;
import org.geometerplus.zlibrary.core.application.ZLApplication;
import org.geometerplus.zlibrary.core.view.ZLViewEnums.Animation;
import org.geometerplus.zlibrary.core.view.ZLViewEnums.PageIndex;
abstract public class ZLView {
abstract public class ZLView implements ZLViewEnums {
public final ZLApplication Application;
private ZLPaintContext myViewContext = new DummyPaintContext();

View file

@ -19,10 +19,8 @@
package org.geometerplus.zlibrary.core.view;
abstract public class ZLViewEnums {
public static enum PageIndex {
public interface ZLViewEnums {
public enum PageIndex {
previous, current, next;
public PageIndex getNext() {
@ -46,8 +44,9 @@ abstract public class ZLViewEnums {
return null;
}
}
};
public static enum Direction {
}
public enum Direction {
leftToRight(true), rightToLeft(true), up(false), down(false);
public final boolean IsHorizontal;
@ -55,9 +54,9 @@ abstract public class ZLViewEnums {
Direction(boolean isHorizontal) {
IsHorizontal = isHorizontal;
}
};
public static enum Animation {
none, curl, slide, slideOldStyle, shift
}
public enum Animation {
none, curl, slide, slideOldStyle, shift
}
}

View file

@ -23,9 +23,9 @@ public interface ZLViewWidget {
void reset();
void repaint();
void startManualScrolling(int x, int y, ZLViewEnums.Direction direction);
void startManualScrolling(int x, int y, ZLView.Direction direction);
void scrollManuallyTo(int x, int y);
void startAnimatedScrolling(ZLViewEnums.PageIndex pageIndex, int x, int y, ZLViewEnums.Direction direction, int speed);
void startAnimatedScrolling(ZLViewEnums.PageIndex pageIndex, ZLViewEnums.Direction direction, 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);
}

View file

@ -21,8 +21,6 @@ package org.geometerplus.zlibrary.text.view;
import java.util.*;
import org.geometerplus.zlibrary.core.view.ZLViewEnums;
final class ZLTextElementAreaVector {
private final List<ZLTextElementArea> myAreas =
Collections.synchronizedList(new ArrayList<ZLTextElementArea>());
@ -168,7 +166,7 @@ final class ZLTextElementAreaVector {
return bestRegion;
}
protected ZLTextRegion nextRegion(ZLTextRegion currentRegion, ZLViewEnums.Direction direction, ZLTextRegion.Filter filter) {
protected ZLTextRegion nextRegion(ZLTextRegion currentRegion, ZLTextView.Direction direction, ZLTextRegion.Filter filter) {
synchronized (myElementRegions) {
if (myElementRegions.isEmpty()) {
return null;

View file

@ -25,9 +25,8 @@ import org.geometerplus.zlibrary.core.application.ZLApplication;
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.zlibrary.core.util.RationalNumber;
import org.geometerplus.zlibrary.core.util.ZLColor;
import org.geometerplus.zlibrary.core.view.*;
import org.geometerplus.zlibrary.core.view.ZLViewEnums.Direction;
import org.geometerplus.zlibrary.core.view.ZLViewEnums.PageIndex;
import org.geometerplus.zlibrary.core.view.ZLPaintContext;
import org.geometerplus.zlibrary.text.model.*;
import org.geometerplus.zlibrary.text.hyphenation.*;
import org.geometerplus.zlibrary.text.view.style.ZLTextStyleCollection;

View file

@ -26,7 +26,6 @@ import android.util.FloatMath;
import org.geometerplus.zlibrary.core.library.ZLibrary;
import org.geometerplus.zlibrary.core.view.ZLView;
import org.geometerplus.zlibrary.core.view.ZLViewEnums;
abstract class AnimationProvider {
static enum Mode {
@ -48,7 +47,7 @@ abstract class AnimationProvider {
protected int myStartY;
protected int myEndX;
protected int myEndY;
protected ZLViewEnums.Direction myDirection;
protected ZLView.Direction myDirection;
protected float mySpeed;
protected int myWidth;
@ -88,7 +87,7 @@ abstract class AnimationProvider {
return;
}
if (getPageToScrollTo(x, y) == ZLViewEnums.PageIndex.current) {
if (getPageToScrollTo(x, y) == ZLView.PageIndex.current) {
return;
}
@ -124,7 +123,7 @@ abstract class AnimationProvider {
}
myDrawInfos.clear();
if (getPageToScrollTo() == ZLViewEnums.PageIndex.previous) {
if (getPageToScrollTo() == ZLView.PageIndex.previous) {
forward = !forward;
}
@ -142,7 +141,7 @@ abstract class AnimationProvider {
startAnimatedScrollingInternal(speed);
}
public void startAnimatedScrolling(ZLViewEnums.PageIndex pageIndex, Integer x, Integer y, int speed) {
public void startAnimatedScrolling(ZLView.PageIndex pageIndex, Integer x, Integer y, int speed) {
if (myMode.Auto) {
return;
}
@ -153,11 +152,11 @@ abstract class AnimationProvider {
switch (myDirection) {
case up:
case rightToLeft:
mySpeed = pageIndex == ZLViewEnums.PageIndex.next ? -15 : 15;
mySpeed = pageIndex == ZLView.PageIndex.next ? -15 : 15;
break;
case leftToRight:
case down:
mySpeed = pageIndex == ZLViewEnums.PageIndex.next ? 15 : -15;
mySpeed = pageIndex == ZLView.PageIndex.next ? 15 : -15;
break;
}
setupAnimatedScrollingStart(x, y);
@ -175,7 +174,7 @@ abstract class AnimationProvider {
return myDirection.IsHorizontal ? myEndX - myStartX : myEndY - myStartY;
}
final void setup(ZLViewEnums.Direction direction, int width, int height) {
final void setup(ZLView.Direction direction, int width, int height) {
myDirection = direction;
myWidth = width;
myHeight = height;
@ -215,14 +214,14 @@ abstract class AnimationProvider {
protected abstract void drawInternal(Canvas canvas);
abstract ZLViewEnums.PageIndex getPageToScrollTo(int x, int y);
abstract ZLView.PageIndex getPageToScrollTo(int x, int y);
final ZLViewEnums.PageIndex getPageToScrollTo() {
final ZLView.PageIndex getPageToScrollTo() {
return getPageToScrollTo(myEndX, myEndY);
}
protected Bitmap getBitmapFrom() {
return myBitmapManager.getBitmap(ZLViewEnums.PageIndex.current);
return myBitmapManager.getBitmap(ZLView.PageIndex.current);
}
protected Bitmap getBitmapTo() {

View file

@ -22,12 +22,11 @@ package org.geometerplus.zlibrary.ui.android.view;
import android.graphics.Bitmap;
import org.geometerplus.zlibrary.core.view.ZLView;
import org.geometerplus.zlibrary.core.view.ZLViewEnums;
class BitmapManager {
private final int SIZE = 2;
private final Bitmap[] myBitmaps = new Bitmap[SIZE];
private final ZLViewEnums.PageIndex[] myIndexes = new ZLViewEnums.PageIndex[SIZE];
private final ZLView.PageIndex[] myIndexes = new ZLView.PageIndex[SIZE];
private int myWidth;
private int myHeight;
@ -52,7 +51,7 @@ class BitmapManager {
}
}
Bitmap getBitmap(ZLViewEnums.PageIndex index) {
Bitmap getBitmap(ZLView.PageIndex index) {
for (int i = 0; i < SIZE; ++i) {
if (index == myIndexes[i]) {
return myBitmaps[i];
@ -73,14 +72,14 @@ class BitmapManager {
return myBitmaps[iIndex];
}
private int getInternalIndex(ZLViewEnums.PageIndex index) {
private int getInternalIndex(ZLView.PageIndex index) {
for (int i = 0; i < SIZE; ++i) {
if (myIndexes[i] == null) {
return i;
}
}
for (int i = 0; i < SIZE; ++i) {
if (myIndexes[i] != ZLViewEnums.PageIndex.current) {
if (myIndexes[i] != ZLView.PageIndex.current) {
return i;
}
}

View file

@ -23,7 +23,7 @@ import android.graphics.*;
import android.util.FloatMath;
import org.geometerplus.zlibrary.core.view.ZLView;
import org.geometerplus.zlibrary.core.view.ZLViewEnums;
import org.geometerplus.zlibrary.ui.android.util.ZLAndroidColorUtil;
class CurlAnimationProvider extends AnimationProvider {
@ -208,22 +208,22 @@ class CurlAnimationProvider extends AnimationProvider {
}
@Override
ZLViewEnums.PageIndex getPageToScrollTo(int x, int y) {
ZLView.PageIndex getPageToScrollTo(int x, int y) {
if (myDirection == null) {
return ZLViewEnums.PageIndex.current;
return ZLView.PageIndex.current;
}
switch (myDirection) {
case leftToRight:
return myStartX < myWidth / 2 ? ZLViewEnums.PageIndex.next : ZLViewEnums.PageIndex.previous;
return myStartX < myWidth / 2 ? ZLView.PageIndex.next : ZLView.PageIndex.previous;
case rightToLeft:
return myStartX < myWidth / 2 ? ZLViewEnums.PageIndex.previous : ZLViewEnums.PageIndex.next;
return myStartX < myWidth / 2 ? ZLView.PageIndex.previous : ZLView.PageIndex.next;
case up:
return myStartY < myHeight / 2 ? ZLViewEnums.PageIndex.previous : ZLViewEnums.PageIndex.next;
return myStartY < myHeight / 2 ? ZLView.PageIndex.previous : ZLView.PageIndex.next;
case down:
return myStartY < myHeight / 2 ? ZLViewEnums.PageIndex.next : ZLViewEnums.PageIndex.previous;
return myStartY < myHeight / 2 ? ZLView.PageIndex.next : ZLView.PageIndex.previous;
}
return ZLViewEnums.PageIndex.current;
return ZLView.PageIndex.current;
}
@Override

View file

@ -22,7 +22,6 @@ package org.geometerplus.zlibrary.ui.android.view;
import android.graphics.*;
import org.geometerplus.zlibrary.core.view.ZLView;
import org.geometerplus.zlibrary.core.view.ZLViewEnums;
class NoneAnimationProvider extends AnimationProvider {
private final Paint myPaint = new Paint();
@ -61,22 +60,22 @@ class NoneAnimationProvider extends AnimationProvider {
}
@Override
ZLViewEnums.PageIndex getPageToScrollTo(int x, int y) {
ZLView.PageIndex getPageToScrollTo(int x, int y) {
if (myDirection == null) {
return ZLViewEnums.PageIndex.current;
return ZLView.PageIndex.current;
}
switch (myDirection) {
case rightToLeft:
return myStartX < x ? ZLViewEnums.PageIndex.previous : ZLViewEnums.PageIndex.next;
return myStartX < x ? ZLView.PageIndex.previous : ZLView.PageIndex.next;
case leftToRight:
return myStartX < x ? ZLViewEnums.PageIndex.next : ZLViewEnums.PageIndex.previous;
return myStartX < x ? ZLView.PageIndex.next : ZLView.PageIndex.previous;
case up:
return myStartY < y ? ZLViewEnums.PageIndex.previous : ZLViewEnums.PageIndex.next;
return myStartY < y ? ZLView.PageIndex.previous : ZLView.PageIndex.next;
case down:
return myStartY < y ? ZLViewEnums.PageIndex.next : ZLViewEnums.PageIndex.previous;
return myStartY < y ? ZLView.PageIndex.next : ZLView.PageIndex.previous;
}
return ZLViewEnums.PageIndex.current;
return ZLView.PageIndex.current;
}
@Override

View file

@ -20,7 +20,6 @@
package org.geometerplus.zlibrary.ui.android.view;
import org.geometerplus.zlibrary.core.view.ZLView;
import org.geometerplus.zlibrary.core.view.ZLViewEnums;
abstract class SimpleAnimationProvider extends AnimationProvider {
private float mySpeedFactor;
@ -30,22 +29,22 @@ abstract class SimpleAnimationProvider extends AnimationProvider {
}
@Override
ZLViewEnums.PageIndex getPageToScrollTo(int x, int y) {
ZLView.PageIndex getPageToScrollTo(int x, int y) {
if (myDirection == null) {
return ZLViewEnums.PageIndex.current;
return ZLView.PageIndex.current;
}
switch (myDirection) {
case rightToLeft:
return myStartX < x ? ZLViewEnums.PageIndex.previous : ZLViewEnums.PageIndex.next;
return myStartX < x ? ZLView.PageIndex.previous : ZLView.PageIndex.next;
case leftToRight:
return myStartX < x ? ZLViewEnums.PageIndex.next : ZLViewEnums.PageIndex.previous;
return myStartX < x ? ZLView.PageIndex.next : ZLView.PageIndex.previous;
case up:
return myStartY < y ? ZLViewEnums.PageIndex.previous : ZLViewEnums.PageIndex.next;
return myStartY < y ? ZLView.PageIndex.previous : ZLView.PageIndex.next;
case down:
return myStartY < y ? ZLViewEnums.PageIndex.next : ZLViewEnums.PageIndex.previous;
return myStartY < y ? ZLView.PageIndex.next : ZLView.PageIndex.previous;
}
return ZLViewEnums.PageIndex.current;
return ZLView.PageIndex.current;
}
@Override

View file

@ -26,7 +26,9 @@ import android.view.*;
import org.geometerplus.zlibrary.core.application.ZLApplication;
import org.geometerplus.zlibrary.core.application.ZLKeyBindings;
import org.geometerplus.zlibrary.core.view.*;
import org.geometerplus.zlibrary.core.view.ZLView;
import org.geometerplus.zlibrary.core.view.ZLViewWidget;
import org.geometerplus.android.fbreader.FBReader;
public class ZLAndroidWidget extends View implements ZLViewWidget, View.OnLongClickListener {
@ -64,7 +66,7 @@ public class ZLAndroidWidget extends View implements ZLViewWidget, View.OnLongCl
if (myScreenIsTouched) {
final ZLView view = ZLApplication.Instance().getCurrentView();
myScreenIsTouched = false;
view.onScrollingFinished(ZLViewEnums.PageIndex.current);
view.onScrollingFinished(ZLView.PageIndex.current);
}
}
@ -90,9 +92,9 @@ public class ZLAndroidWidget extends View implements ZLViewWidget, View.OnLongCl
}
private AnimationProvider myAnimationProvider;
private ZLViewEnums.Animation myAnimationType;
private ZLView.Animation myAnimationType;
private AnimationProvider getAnimationProvider() {
final ZLViewEnums.Animation type = ZLApplication.Instance().getCurrentView().getAnimationType();
final ZLView.Animation type = ZLApplication.Instance().getCurrentView().getAnimationType();
if (myAnimationProvider == null || myAnimationType != type) {
myAnimationType = type;
switch (type) {
@ -135,14 +137,14 @@ public class ZLAndroidWidget extends View implements ZLViewWidget, View.OnLongCl
switch (oldMode) {
case AnimatedScrollingForward:
{
final ZLViewEnums.PageIndex index = animator.getPageToScrollTo();
myBitmapManager.shift(index == ZLViewEnums.PageIndex.next);
final ZLView.PageIndex index = animator.getPageToScrollTo();
myBitmapManager.shift(index == ZLView.PageIndex.next);
view.onScrollingFinished(index);
ZLApplication.Instance().onRepaintFinished();
break;
}
case AnimatedScrollingBackward:
view.onScrollingFinished(ZLViewEnums.PageIndex.current);
view.onScrollingFinished(ZLView.PageIndex.current);
break;
}
onDrawStatic(canvas);
@ -160,7 +162,7 @@ public class ZLAndroidWidget extends View implements ZLViewWidget, View.OnLongCl
}
@Override
public void startManualScrolling(int x, int y, ZLViewEnums.Direction direction) {
public void startManualScrolling(int x, int y, ZLView.Direction direction) {
final AnimationProvider animator = getAnimationProvider();
animator.setup(direction, getWidth(), getMainAreaHeight());
animator.startManualScrolling(x, y);
@ -177,9 +179,9 @@ public class ZLAndroidWidget extends View implements ZLViewWidget, View.OnLongCl
}
@Override
public void startAnimatedScrolling(ZLViewEnums.PageIndex pageIndex, int x, int y, ZLViewEnums.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 == ZLViewEnums.PageIndex.current || !view.canScroll(pageIndex)) {
if (pageIndex == ZLView.PageIndex.current || !view.canScroll(pageIndex)) {
return;
}
final AnimationProvider animator = getAnimationProvider();
@ -191,9 +193,9 @@ public class ZLAndroidWidget extends View implements ZLViewWidget, View.OnLongCl
}
@Override
public void startAnimatedScrolling(ZLViewEnums.PageIndex pageIndex, ZLViewEnums.Direction direction, int speed) {
public void startAnimatedScrolling(ZLView.PageIndex pageIndex, ZLView.Direction direction, int speed) {
final ZLView view = ZLApplication.Instance().getCurrentView();
if (pageIndex == ZLViewEnums.PageIndex.current || !view.canScroll(pageIndex)) {
if (pageIndex == ZLView.PageIndex.current || !view.canScroll(pageIndex)) {
return;
}
final AnimationProvider animator = getAnimationProvider();
@ -216,7 +218,7 @@ public class ZLAndroidWidget extends View implements ZLViewWidget, View.OnLongCl
postInvalidate();
}
void drawOnBitmap(Bitmap bitmap, ZLViewEnums.PageIndex index) {
void drawOnBitmap(Bitmap bitmap, ZLView.PageIndex index) {
final ZLView view = ZLApplication.Instance().getCurrentView();
if (view == null) {
return;
@ -277,7 +279,7 @@ public class ZLAndroidWidget extends View implements ZLViewWidget, View.OnLongCl
private void onDrawStatic(final Canvas canvas) {
myBitmapManager.setSize(getWidth(), getMainAreaHeight());
canvas.drawBitmap(myBitmapManager.getBitmap(ZLViewEnums.PageIndex.current), 0, 0, myPaint);
canvas.drawBitmap(myBitmapManager.getBitmap(ZLView.PageIndex.current), 0, 0, myPaint);
drawFooter(canvas, null);
new Thread() {
@Override
@ -295,7 +297,7 @@ public class ZLAndroidWidget extends View implements ZLViewWidget, View.OnLongCl
),
view.isScrollbarShown() ? getVerticalScrollbarWidth() : 0
);
view.preparePage(context, ZLViewEnums.PageIndex.next);
view.preparePage(context, ZLView.PageIndex.next);
}
}.start();
}
@ -488,12 +490,12 @@ public class ZLAndroidWidget extends View implements ZLViewWidget, View.OnLongCl
}
final AnimationProvider animator = getAnimationProvider();
if (animator.inProgress()) {
final int from = view.getScrollbarThumbLength(ZLViewEnums.PageIndex.current);
final int from = view.getScrollbarThumbLength(ZLView.PageIndex.current);
final int to = view.getScrollbarThumbLength(animator.getPageToScrollTo());
final int percent = animator.getScrolledPercent();
return (from * (100 - percent) + to * percent) / 100;
} else {
return view.getScrollbarThumbLength(ZLViewEnums.PageIndex.current);
return view.getScrollbarThumbLength(ZLView.PageIndex.current);
}
}
@ -505,12 +507,12 @@ public class ZLAndroidWidget extends View implements ZLViewWidget, View.OnLongCl
}
final AnimationProvider animator = getAnimationProvider();
if (animator.inProgress()) {
final int from = view.getScrollbarThumbPosition(ZLViewEnums.PageIndex.current);
final int from = view.getScrollbarThumbPosition(ZLView.PageIndex.current);
final int to = view.getScrollbarThumbPosition(animator.getPageToScrollTo());
final int percent = animator.getScrolledPercent();
return (from * (100 - percent) + to * percent) / 100;
} else {
return view.getScrollbarThumbPosition(ZLViewEnums.PageIndex.current);
return view.getScrollbarThumbPosition(ZLView.PageIndex.current);
}
}