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