summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChris Wren <cwren@android.com>2012-09-13 13:52:27 -0400
committerChris Wren <cwren@android.com>2012-09-13 14:03:17 -0400
commitf98687b22f4091083287ab7de7a0f3102bd9c1ba (patch)
tree72111af8655523c5c9768b39dcffcc8d0c9ee5b1 /src
parent70ef3e7da59212c3c4baedf92f418eb9012a4db3 (diff)
downloadandroid_packages_screensavers_PhotoTable-f98687b22f4091083287ab7de7a0f3102bd9c1ba.tar.gz
android_packages_screensavers_PhotoTable-f98687b22f4091083287ab7de7a0f3102bd9c1ba.tar.bz2
android_packages_screensavers_PhotoTable-f98687b22f4091083287ab7de7a0f3102bd9c1ba.zip
deal out new images in batches
Change-Id: I1637c4063a0f743efdde79e47c5f283ff5771f05
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dreams/phototable/PhotoTable.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/com/android/dreams/phototable/PhotoTable.java b/src/com/android/dreams/phototable/PhotoTable.java
index 076fe68..0c9c47f 100644
--- a/src/com/android/dreams/phototable/PhotoTable.java
+++ b/src/com/android/dreams/phototable/PhotoTable.java
@@ -76,6 +76,7 @@ public class PhotoTable extends FrameLayout {
private final float mThrowSpeed;
private final boolean mTapToExit;
private final int mTableCapacity;
+ private final int mRedealCount;
private final int mInset;
private final PhotoSourcePlexor mPhotoSource;
private final Resources mResources;
@@ -107,6 +108,7 @@ public class PhotoTable extends FrameLayout {
mThrowSpeed = mResources.getDimension(R.dimen.image_throw_speed);
mThrowRotation = (float) mResources.getInteger(R.integer.image_throw_rotatioan);
mTableCapacity = mResources.getInteger(R.integer.table_capacity);
+ mRedealCount = mResources.getInteger(R.integer.redeal_count);
mTapToExit = mResources.getBoolean(R.bool.enable_tap_to_exit);
mThrowInterpolator = new SoftLandingInterpolator(
mResources.getInteger(R.integer.soft_landing_time) / 1000000f,
@@ -394,8 +396,12 @@ public class PhotoTable extends FrameLayout {
.withEndAction(new Runnable() {
@Override
public void run() {
- while (mOnTable.size() > mTableCapacity) {
- fadeAway(mOnTable.poll(), false);
+ if (mOnTable.size() > mTableCapacity) {
+ while (mOnTable.size() > (mTableCapacity - mRedealCount)) {
+ fadeAway(mOnTable.poll(), false);
+ }
+ // zero delay because we already waited duration ms
+ scheduleNext(0);
}
}
});