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 --- res/values-sw600dp/config.xml | 3 +++ res/values-sw800dp/config.xml | 4 ++-- res/values/config.xml | 4 ++-- src/com/android/dreams/phototable/PhotoTable.java | 23 +++++++++-------------- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/res/values-sw600dp/config.xml b/res/values-sw600dp/config.xml index 4a8a67f..e1ad849 100644 --- a/res/values-sw600dp/config.xml +++ b/res/values-sw600dp/config.xml @@ -16,5 +16,8 @@ 750000 + + + 300000 diff --git a/res/values-sw800dp/config.xml b/res/values-sw800dp/config.xml index eeefc3a..699e15a 100644 --- a/res/values-sw800dp/config.xml +++ b/res/values-sw800dp/config.xml @@ -15,10 +15,10 @@ --> - 90000 + 75000 - 10000 + 5000 500000 diff --git a/res/values/config.xml b/res/values/config.xml index d8d745d..36835c9 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -18,7 +18,7 @@ 45000 - 4000 + 3000 10000 @@ -33,7 +33,7 @@ 10 - 3 + 5 500000 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