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

Commit

Permalink
Fix a display issue when flipping backward on the first page
Browse files Browse the repository at this point in the history
Issue #52
  • Loading branch information
Aphid Mobile committed Apr 28, 2013
1 parent 2dca94e commit 8f230f7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
Binary file modified FlipView/Demo/APK/Aphid-FlipView-Demo.apk
Binary file not shown.
12 changes: 12 additions & 0 deletions FlipView/FlipLibrary/src/com/aphidmobile/flip/FlipCards.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public class FlipCards {
private FlipViewController controller;

private volatile boolean visible = false;

private volatile boolean firstDrawFinished = false;

private int maxIndex = 0;

Expand All @@ -75,6 +77,14 @@ public void setVisible(boolean visible) {
this.visible = visible;
}

public boolean isFirstDrawFinished() {
return firstDrawFinished;
}

public void setFirstDrawFinished(boolean firstDrawFinished) {
this.firstDrawFinished = firstDrawFinished;
}

boolean refreshPageView(View view) {
boolean match = false;
if (frontCards.getView() == view) {
Expand Down Expand Up @@ -252,6 +262,8 @@ public synchronized void draw(FlipRenderer renderer, GL10 gl) {
backCards.getBottomCard().draw(gl);
}
}

firstDrawFinished = true;
}

public void invalidateTexture() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ public void onSurfaceChanged(GL10 gl, int width, int height) {

@Override
public void onDrawFrame(GL10 gl) {
if (cards.isVisible() && cards.isFirstDrawFinished())
gl.glClearColor(1f, 1f, 1f, 1f);
else
gl.glClearColor(0f, 0f, 0f, 0f);
gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

synchronized (postDestroyTextures) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ void showFlipAnimation() {
inFlipAnimation = true;

cards.setVisible(true);
cards.setFirstDrawFinished(false);
surfaceView.requestRender();
}
}
Expand Down

0 comments on commit 8f230f7

Please sign in to comment.