mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 18:29:23 +02:00
cleanup: local variables renaming
This commit is contained in:
parent
baeec07fe1
commit
815237582a
7 changed files with 40 additions and 40 deletions
|
@ -238,15 +238,15 @@ public final class FBView extends ZLTextView {
|
|||
final int minDiff = horizontal ?
|
||||
(w > h ? w / 4 : w / 3) :
|
||||
(h > w ? h / 4 : h / 3);
|
||||
final PageIndex viewPage =
|
||||
final PageIndex pageIndex =
|
||||
Math.abs(diff) < minDiff
|
||||
? PageIndex.current
|
||||
: (diff < 0 ? PageIndex.next : PageIndex.previous);
|
||||
if (getAnimationType() != Animation.none) {
|
||||
startAutoScrolling(viewPage, horizontal);
|
||||
startAutoScrolling(pageIndex, horizontal);
|
||||
} else {
|
||||
myReader.scrollViewToCenter();
|
||||
onScrollingFinished(viewPage);
|
||||
onScrollingFinished(pageIndex);
|
||||
myReader.repaintView();
|
||||
setScrollingActive(false);
|
||||
}
|
||||
|
|
|
@ -82,9 +82,9 @@ public abstract class ZLApplication {
|
|||
}
|
||||
}
|
||||
|
||||
public final void startViewAutoScrolling(ZLView.PageIndex viewPage, boolean horizontally) {
|
||||
public final void startViewAutoScrolling(ZLView.PageIndex pageIndex, boolean horizontally) {
|
||||
if (myWindow != null) {
|
||||
myWindow.startViewAutoScrolling(viewPage, horizontally);
|
||||
myWindow.startViewAutoScrolling(pageIndex, horizontally);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ abstract public class ZLApplicationWindow {
|
|||
abstract protected void repaintView();
|
||||
abstract protected void scrollViewManually(int startX, int startY, int endX, int endY, boolean horizontally);
|
||||
abstract protected void scrollViewToCenter();
|
||||
abstract protected void startViewAutoScrolling(ZLView.PageIndex viewPage, boolean horizontally);
|
||||
abstract protected void startViewAutoScrolling(ZLView.PageIndex pageIndex, boolean horizontally);
|
||||
|
||||
abstract protected void rotate();
|
||||
abstract protected boolean canRotate();
|
||||
|
|
|
@ -42,8 +42,8 @@ abstract public class ZLView {
|
|||
}
|
||||
public abstract Animation getAnimationType();
|
||||
|
||||
abstract public void paint(ZLPaintContext context, PageIndex viewPage);
|
||||
abstract public void onScrollingFinished(PageIndex viewPage);
|
||||
abstract public void paint(ZLPaintContext context, PageIndex pageIndex);
|
||||
abstract public void onScrollingFinished(PageIndex pageIndex);
|
||||
|
||||
public boolean onFingerPress(int x, int y) {
|
||||
return false;
|
||||
|
@ -87,6 +87,6 @@ abstract public class ZLView {
|
|||
|
||||
public abstract boolean isScrollbarShown();
|
||||
public abstract int getScrollbarFullSize();
|
||||
public abstract int getScrollbarThumbPosition(PageIndex viewPage);
|
||||
public abstract int getScrollbarThumbLength(PageIndex viewPage);
|
||||
public abstract int getScrollbarThumbPosition(PageIndex pageIndex);
|
||||
public abstract int getScrollbarThumbLength(PageIndex pageIndex);
|
||||
}
|
||||
|
|
|
@ -199,19 +199,19 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
|||
myScrollingIsActive = active;
|
||||
}
|
||||
|
||||
public final synchronized void startAutoScrolling(PageIndex viewPage, boolean horizontally) {
|
||||
public final synchronized void startAutoScrolling(PageIndex pageIndex, boolean horizontally) {
|
||||
if (isScrollingActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setScrollingActive(true);
|
||||
ZLApplication.Instance().startViewAutoScrolling(viewPage, horizontally);
|
||||
ZLApplication.Instance().startViewAutoScrolling(pageIndex, horizontally);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void onScrollingFinished(PageIndex viewPage) {
|
||||
public synchronized void onScrollingFinished(PageIndex pageIndex) {
|
||||
setScrollingActive(false);
|
||||
switch (viewPage) {
|
||||
switch (pageIndex) {
|
||||
case current:
|
||||
break;
|
||||
case previous:
|
||||
|
@ -252,7 +252,7 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized void paint(ZLPaintContext context, PageIndex viewPage) {
|
||||
public synchronized void paint(ZLPaintContext context, PageIndex pageIndex) {
|
||||
myContext = context;
|
||||
final ZLFile wallpaper = getWallpaperFile();
|
||||
if (wallpaper != null) {
|
||||
|
@ -266,7 +266,7 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
|||
}
|
||||
|
||||
ZLTextPage page;
|
||||
switch (viewPage) {
|
||||
switch (pageIndex) {
|
||||
default:
|
||||
case current:
|
||||
page = myCurrentPage;
|
||||
|
@ -324,8 +324,8 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
|||
}
|
||||
}
|
||||
|
||||
private ZLTextPage getPage(PageIndex viewPage) {
|
||||
switch (viewPage) {
|
||||
private ZLTextPage getPage(PageIndex pageIndex) {
|
||||
switch (pageIndex) {
|
||||
default:
|
||||
case current:
|
||||
return myCurrentPage;
|
||||
|
@ -357,11 +357,11 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
|||
return myModel.getTextLength(myModel.getParagraphsNumber() - 1);
|
||||
}
|
||||
|
||||
private final synchronized int getCurrentCharNumber(PageIndex viewPage, boolean startNotEndOfPage) {
|
||||
private final synchronized int getCurrentCharNumber(PageIndex pageIndex, boolean startNotEndOfPage) {
|
||||
if (myModel == null || myModel.getParagraphsNumber() == 0) {
|
||||
return 0;
|
||||
}
|
||||
ZLTextPage page = getPage(viewPage);
|
||||
ZLTextPage page = getPage(pageIndex);
|
||||
preparePaintInfo(page);
|
||||
if (startNotEndOfPage) {
|
||||
return Math.max(0, sizeOfTextBeforeCursor(page.StartCursor));
|
||||
|
@ -380,15 +380,15 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final synchronized int getScrollbarThumbPosition(PageIndex viewPage) {
|
||||
return scrollbarType() == SCROLLBAR_SHOW_AS_PROGRESS ? 0 : getCurrentCharNumber(viewPage, true);
|
||||
public final synchronized int getScrollbarThumbPosition(PageIndex pageIndex) {
|
||||
return scrollbarType() == SCROLLBAR_SHOW_AS_PROGRESS ? 0 : getCurrentCharNumber(pageIndex, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final synchronized int getScrollbarThumbLength(PageIndex viewPage) {
|
||||
public final synchronized int getScrollbarThumbLength(PageIndex pageIndex) {
|
||||
int start = scrollbarType() == SCROLLBAR_SHOW_AS_PROGRESS
|
||||
? 0 : getCurrentCharNumber(viewPage, true);
|
||||
int end = getCurrentCharNumber(viewPage, false);
|
||||
? 0 : getCurrentCharNumber(pageIndex, true);
|
||||
int end = getCurrentCharNumber(pageIndex, false);
|
||||
return Math.max(1, end - start);
|
||||
}
|
||||
|
||||
|
|
|
@ -91,10 +91,10 @@ public final class ZLAndroidApplicationWindow extends ZLApplicationWindow {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void startViewAutoScrolling(ZLView.PageIndex viewPage, boolean horizontally) {
|
||||
protected void startViewAutoScrolling(ZLView.PageIndex pageIndex, boolean horizontally) {
|
||||
final ZLAndroidWidget widget =
|
||||
((ZLAndroidLibrary)ZLAndroidLibrary.Instance()).getWidget();
|
||||
widget.startAutoScrolling(viewPage, horizontally);
|
||||
widget.startAutoScrolling(pageIndex, horizontally);
|
||||
}
|
||||
|
||||
public void rotate() {
|
||||
|
|
|
@ -237,7 +237,7 @@ public class ZLAndroidWidget extends View implements View.OnLongClickListener {
|
|||
myMainBitmap = mySecondaryBitmap;
|
||||
mySecondaryBitmap = swap;
|
||||
mySecondaryBitmapIsUpToDate = false;
|
||||
view.onScrollingFinished(myViewPageToScrollTo);
|
||||
view.onScrollingFinished(myPageToScrollTo);
|
||||
ZLApplication.Instance().onRepaintFinished();
|
||||
} else {
|
||||
view.onScrollingFinished(ZLView.PageIndex.current);
|
||||
|
@ -254,11 +254,11 @@ public class ZLAndroidWidget extends View implements View.OnLongClickListener {
|
|||
drawFooter(canvas);
|
||||
}
|
||||
|
||||
private ZLView.PageIndex myViewPageToScrollTo = ZLView.PageIndex.current;
|
||||
private ZLView.PageIndex myPageToScrollTo = ZLView.PageIndex.current;
|
||||
private boolean myScrollHorizontally;
|
||||
private void setPageToScrollTo(ZLView.PageIndex viewPage) {
|
||||
if (myViewPageToScrollTo != viewPage) {
|
||||
myViewPageToScrollTo = viewPage;
|
||||
private void setPageToScrollTo(ZLView.PageIndex pageIndex) {
|
||||
if (myPageToScrollTo != pageIndex) {
|
||||
myPageToScrollTo = pageIndex;
|
||||
mySecondaryBitmapIsUpToDate = false;
|
||||
}
|
||||
}
|
||||
|
@ -290,15 +290,15 @@ public class ZLAndroidWidget extends View implements View.OnLongClickListener {
|
|||
postInvalidate();
|
||||
}
|
||||
|
||||
public void startAutoScrolling(ZLView.PageIndex viewPage, boolean horizontally) {
|
||||
public void startAutoScrolling(ZLView.PageIndex pageIndex, boolean horizontally) {
|
||||
if (myMainBitmap == null) {
|
||||
return;
|
||||
}
|
||||
myScrollingInProgress = true;
|
||||
myScrollHorizontally = horizontally;
|
||||
switch (viewPage) {
|
||||
switch (pageIndex) {
|
||||
case current:
|
||||
switch (myViewPageToScrollTo) {
|
||||
switch (myPageToScrollTo) {
|
||||
case current:
|
||||
myScrollingSpeed = 0;
|
||||
break;
|
||||
|
@ -314,12 +314,12 @@ public class ZLAndroidWidget extends View implements View.OnLongClickListener {
|
|||
case previous:
|
||||
myScrollingSpeed = 3;
|
||||
myScrollingBound = horizontally ? getWidth() : getMainAreaHeight();
|
||||
setPageToScrollTo(viewPage);
|
||||
setPageToScrollTo(pageIndex);
|
||||
break;
|
||||
case next:
|
||||
myScrollingSpeed = -3;
|
||||
myScrollingBound = horizontally ? -getWidth() : -getMainAreaHeight();
|
||||
setPageToScrollTo(viewPage);
|
||||
setPageToScrollTo(pageIndex);
|
||||
break;
|
||||
}
|
||||
drawOnBitmap(mySecondaryBitmap);
|
||||
|
@ -348,7 +348,7 @@ public class ZLAndroidWidget extends View implements View.OnLongClickListener {
|
|||
);
|
||||
view.paint(
|
||||
context,
|
||||
bitmap == myMainBitmap ? ZLView.PageIndex.current : myViewPageToScrollTo
|
||||
bitmap == myMainBitmap ? ZLView.PageIndex.current : myPageToScrollTo
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -589,7 +589,7 @@ public class ZLAndroidWidget extends View implements View.OnLongClickListener {
|
|||
}
|
||||
if (myScrollingInProgress || (myScrollingShift != 0)) {
|
||||
final int from = view.getScrollbarThumbLength(ZLView.PageIndex.current);
|
||||
final int to = view.getScrollbarThumbLength(myViewPageToScrollTo);
|
||||
final int to = view.getScrollbarThumbLength(myPageToScrollTo);
|
||||
final int size = myScrollHorizontally ? getWidth() : getMainAreaHeight();
|
||||
final int shift = Math.abs(myScrollingShift);
|
||||
return (from * (size - shift) + to * shift) / size;
|
||||
|
@ -605,7 +605,7 @@ public class ZLAndroidWidget extends View implements View.OnLongClickListener {
|
|||
}
|
||||
if (myScrollingInProgress || (myScrollingShift != 0)) {
|
||||
final int from = view.getScrollbarThumbPosition(ZLView.PageIndex.current);
|
||||
final int to = view.getScrollbarThumbPosition(myViewPageToScrollTo);
|
||||
final int to = view.getScrollbarThumbPosition(myPageToScrollTo);
|
||||
final int size = myScrollHorizontally ? getWidth() : getMainAreaHeight();
|
||||
final int shift = Math.abs(myScrollingShift);
|
||||
return (from * (size - shift) + to * shift) / size;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue