Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
Fight with the flash issue when flipping backward
Browse files Browse the repository at this point in the history
Issue #52
  • Loading branch information
Aphid Mobile committed May 1, 2013
1 parent 8f230f7 commit f6dabbf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Binary file modified FlipView/Demo/APK/Aphid-FlipView-Demo.apk
Binary file not shown.
9 changes: 6 additions & 3 deletions FlipView/FlipLibrary/src/com/aphidmobile/flip/FlipCards.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ public synchronized void draw(FlipRenderer renderer, GL10 gl) {
frontCards.buildTexture(renderer, gl);
backCards.buildTexture(renderer, gl);

if (!TextureUtils.isValidTexture(frontCards.getTexture()) && !TextureUtils
.isValidTexture(backCards.getTexture())) {
if (!TextureUtils.isValidTexture(frontCards.getTexture()) &&
!TextureUtils.isValidTexture(backCards.getTexture())) {
return;
}

Expand Down Expand Up @@ -263,7 +263,10 @@ public synchronized void draw(FlipRenderer renderer, GL10 gl) {
}
}

firstDrawFinished = true;
if ((frontCards.getView() == null || TextureUtils.isValidTexture(frontCards.getTexture())) &&
(backCards.getView() == null || TextureUtils.isValidTexture(backCards.getTexture()))
)
firstDrawFinished = true;
}

public void invalidateTexture() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ private void setupAdapterView(View view, boolean addToTop, boolean isReusedView)

private void updateVisibleView(int index) {
for (int i = 0; i < bufferedViews.size(); i++) {
bufferedViews.get(i).setVisibility(index == i ? VISIBLE : INVISIBLE);
bufferedViews.get(i).setVisibility(index == i ? VISIBLE : GONE);
}
}

Expand Down Expand Up @@ -525,7 +525,7 @@ void flippedToView(final int indexInAdapter, boolean isPost) {
}
bufferIndex = bufferedViews.indexOf(old) + 1;
requestLayout();
updateVisibleView(inFlipAnimation ? -1 : bufferIndex);
updateVisibleView(bufferIndex);
}
} else if (indexInAdapter == adapterIndex - 1) {
if (adapterIndex > 0) {
Expand All @@ -539,7 +539,7 @@ void flippedToView(final int indexInAdapter, boolean isPost) {
}
bufferIndex = bufferedViews.indexOf(old) - 1;
requestLayout();
updateVisibleView(inFlipAnimation ? -1 : bufferIndex);
updateVisibleView(bufferIndex);
}
} else {
AphidLog.e("Should not happen: indexInAdapter %d, adapterIndex %d", indexInAdapter,
Expand Down

0 comments on commit f6dabbf

Please sign in to comment.