Skip to content

Commit

Permalink
don't allow invalidate runnable to be queued multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
Dean Wild committed Mar 15, 2016
1 parent a2245ea commit 03b324e
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,17 @@ public void run() {


void invalidateAfter(long delay) {
postDelayed(new Runnable() {
@Override
public void run() {
invalidate();
}
}, delay);
removeCallbacks(invalidateRunnable);
postDelayed(invalidateRunnable, delay);
}

Runnable invalidateRunnable = new Runnable() {
@Override
public void run() {
invalidate();
}
};


@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
Expand Down

0 comments on commit 03b324e

Please sign in to comment.