Skip to content

Commit 03d378d

Browse files
committed
fix paging logic.(feilongfl#265)
1 parent bcbcf47 commit 03d378d

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

app/src/main/java/com/hiroshi/cimoc/fresco/processor/MangaPostprocessor.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,16 @@ public CloseableReference<Bitmap> process(Bitmap sourceBitmap, PlatformBitmapFac
6262

6363
private void preparePaging(boolean reverse) {
6464
if (needHorizontalPaging()) {
65-
mWidth = mWidth / 2;
66-
if (mImage.getState() == ImageUrl.STATE_NULL) {
67-
mImage.setState(ImageUrl.STATE_PAGE_1);
65+
int mBase = 2;
66+
mWidth = mWidth / mBase;
67+
mImage.nextState();
68+
if(mImage.getState() < mBase) {
6869
RxBus.getInstance().post(new RxEvent(RxEvent.EVENT_PICTURE_PAGING, mImage));
6970
}
70-
mPosX = mImage.getState() == ImageUrl.STATE_PAGE_1 ? mWidth : 0;
71-
if (reverse)
72-
mPosX = mImage.getState() == ImageUrl.STATE_PAGE_1 ? 0 : mWidth;
71+
7372
mPosY = 0;
73+
mPosX = reverse? (mBase - mImage.getState()) : (mImage.getState()-1);
74+
mPosX *= mWidth;
7475
} else if (needVerticalPaging()) {
7576
int mBase = mHeight / (mWidth * 2);
7677
mHeight = mHeight / mBase;
@@ -80,9 +81,8 @@ private void preparePaging(boolean reverse) {
8081
}
8182

8283
mPosX = 0;
83-
mPosY = (mImage.getState()-1) * mHeight;
84-
if (reverse)
85-
mPosY = (mBase - mImage.getState()) * mHeight;
84+
mPosY = reverse? (mBase - mImage.getState()) : (mImage.getState()-1);
85+
mPosY *= mHeight;
8686
}
8787
}
8888

0 commit comments

Comments
 (0)