mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 02:39:23 +02:00
sporadic program freeze has been fixed
This commit is contained in:
parent
34add4aec3
commit
692c749ef6
3 changed files with 44 additions and 88 deletions
|
@ -43,7 +43,6 @@ public final class FBView extends ZLTextView {
|
|||
}
|
||||
|
||||
public void setModel(ZLTextModel model) {
|
||||
myIsManualScrollingActive = false;
|
||||
super.setModel(model);
|
||||
if (myFooter != null) {
|
||||
myFooter.resetTOCMarks();
|
||||
|
@ -52,7 +51,6 @@ public final class FBView extends ZLTextView {
|
|||
|
||||
private int myStartX;
|
||||
private int myStartY;
|
||||
private boolean myIsManualScrollingActive;
|
||||
private boolean myIsBrightnessAdjustmentInProgress;
|
||||
private int myStartBrightness;
|
||||
|
||||
|
@ -77,10 +75,6 @@ public final class FBView extends ZLTextView {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (isScrollingActive()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (myReader.FooterIsSensitiveOption.getValue()) {
|
||||
Footer footer = getFooterArea();
|
||||
if (footer != null && y > myContext.getHeight() - footer.getTapHeight()) {
|
||||
|
@ -128,10 +122,6 @@ public final class FBView extends ZLTextView {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (isScrollingActive()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (myReader.FooterIsSensitiveOption.getValue()) {
|
||||
Footer footer = getFooterArea();
|
||||
if (footer != null && y > myContext.getHeight() - footer.getTapHeight()) {
|
||||
|
@ -158,8 +148,6 @@ public final class FBView extends ZLTextView {
|
|||
fingerScrolling == ScrollingPreferences.FingerScrolling.byTapAndFlick) {
|
||||
myStartX = x;
|
||||
myStartY = y;
|
||||
setScrollingActive(true);
|
||||
myIsManualScrollingActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,7 +168,6 @@ public final class FBView extends ZLTextView {
|
|||
}
|
||||
}
|
||||
|
||||
if (isScrollingActive() && myIsManualScrollingActive) {
|
||||
final boolean horizontal = ScrollingPreferences.Instance().HorizontalOption.getValue();
|
||||
final int diff = horizontal ? x - myStartX : y - myStartY;
|
||||
final Direction direction = horizontal ? Direction.rightToLeft : Direction.up;
|
||||
|
@ -201,12 +188,9 @@ public final class FBView extends ZLTextView {
|
|||
myReader.scrollViewManually(myStartX, myStartY, x, y, direction);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onFingerRelease(int x, int y) {
|
||||
if (super.onFingerRelease(x, y)) {
|
||||
|
@ -215,9 +199,6 @@ public final class FBView extends ZLTextView {
|
|||
|
||||
synchronized (this) {
|
||||
myIsBrightnessAdjustmentInProgress = false;
|
||||
if (isScrollingActive() && myIsManualScrollingActive) {
|
||||
setScrollingActive(false);
|
||||
myIsManualScrollingActive = false;
|
||||
final boolean horizontal = ScrollingPreferences.Instance().HorizontalOption.getValue();
|
||||
final int diff = horizontal ? x - myStartX : y - myStartY;
|
||||
boolean doScroll = false;
|
||||
|
@ -244,11 +225,9 @@ public final class FBView extends ZLTextView {
|
|||
: (diff < 0 ? PageIndex.next : PageIndex.previous);
|
||||
startAutoScrolling(pageIndex, horizontal ? Direction.rightToLeft : Direction.up, ScrollingPreferences.Instance().AnimationSpeedOption.getValue());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onFingerLongPress(int x, int y) {
|
||||
if (super.onFingerLongPress(x, y)) {
|
||||
|
|
|
@ -67,7 +67,6 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
|||
myCurrentPage.reset();
|
||||
myPreviousPage.reset();
|
||||
myNextPage.reset();
|
||||
setScrollingActive(false);
|
||||
if (myModel != null) {
|
||||
final int paragraphsNumber = myModel.getParagraphsNumber();
|
||||
if (paragraphsNumber > 0) {
|
||||
|
@ -195,35 +194,16 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
|||
return (myModel == null) || myModel.getMarks().isEmpty();
|
||||
}
|
||||
|
||||
private volatile boolean myScrollingIsActive;
|
||||
protected boolean isScrollingActive() {
|
||||
return myScrollingIsActive;
|
||||
}
|
||||
protected void setScrollingActive(boolean active) {
|
||||
myScrollingIsActive = active;
|
||||
}
|
||||
|
||||
public final synchronized void startAutoScrolling(PageIndex pageIndex, Direction direction, int speed) {
|
||||
if (isScrollingActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setScrollingActive(true);
|
||||
ZLApplication.Instance().startViewAutoScrolling(pageIndex, direction, speed);
|
||||
}
|
||||
|
||||
public final synchronized void startAutoScrolling(PageIndex pageIndex, Direction direction, int x, int y, int speed) {
|
||||
if (isScrollingActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setScrollingActive(true);
|
||||
ZLApplication.Instance().startViewAutoScrolling(pageIndex, direction, x, y, speed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void onScrollingFinished(PageIndex pageIndex) {
|
||||
setScrollingActive(false);
|
||||
switch (pageIndex) {
|
||||
case current:
|
||||
break;
|
||||
|
@ -970,10 +950,6 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
|||
}
|
||||
|
||||
public synchronized final void scrollPage(boolean forward, int scrollingMode, int value) {
|
||||
if (isScrollingActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
preparePaintInfo(myCurrentPage);
|
||||
myPreviousPage.reset();
|
||||
myNextPage.reset();
|
||||
|
|
|
@ -190,6 +190,7 @@ public class ZLAndroidWidget extends View implements View.OnLongClickListener {
|
|||
animator.startAutoScrolling(true, -3, direction, w, h, x, y, speed);
|
||||
break;
|
||||
}
|
||||
animator.doStep();
|
||||
postInvalidate();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue