From 387363c426e097c358bd41367e0a8f4339fc8dc3 Mon Sep 17 00:00:00 2001 From: Chris Wren Date: Wed, 17 Oct 2012 16:04:15 -0400 Subject: tune re-deal behavior on photo table. Bug: 7669353 Change-Id: I17aaf289067cbd688dba5cd317541b98bb4ee3dd --- src/com/android/dreams/phototable/PhotoTable.java | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/com/android/dreams/phototable/PhotoTable.java b/src/com/android/dreams/phototable/PhotoTable.java index 50212c9..36b274c 100644 --- a/src/com/android/dreams/phototable/PhotoTable.java +++ b/src/com/android/dreams/phototable/PhotoTable.java @@ -119,7 +119,7 @@ public class PhotoTable extends FrameLayout { mStarted = false; } - + public void setDream(DreamService dream) { mDream = dream; } @@ -297,6 +297,13 @@ public class PhotoTable extends FrameLayout { log("drop it"); table.throwOnTable(photo); + if (mOnTable.size() > mTableCapacity) { + int targetSize = Math.max(0, mOnTable.size() - mRedealCount); + while (mOnTable.size() > targetSize) { + fadeAway(mOnTable.poll(), false); + } + } + if(table.mOnTable.size() < table.mTableCapacity) { table.scheduleNext(table.mFastDropPeriod); } @@ -399,19 +406,7 @@ public class PhotoTable extends FrameLayout { .x(x) .y(y) .setDuration(duration) - .setInterpolator(interpolator) - .withEndAction(new Runnable() { - @Override - public void run() { - if (mOnTable.size() > mTableCapacity) { - while (mOnTable.size() > (mTableCapacity - mRedealCount)) { - fadeAway(mOnTable.poll(), false); - } - // zero delay because we already waited duration ms - scheduleNext(0); - } - } - }); + .setInterpolator(interpolator); } /** wrap all orientations to the interval [-180, 180). */ -- cgit v1.2.3