summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/values/config.xml3
-rw-r--r--src/com/android/dreams/phototable/PhotoTable.java10
2 files changed, 11 insertions, 2 deletions
diff --git a/res/values/config.xml b/res/values/config.xml
index bc137bc..1a7b220 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -32,6 +32,9 @@
<!-- Maximum number of photos to leave on the table.-->
<integer name="table_capacity">10</integer>
+ <!-- Number of images to discard at a time.-->
+ <integer name="redeal_count">3</integer>
+
<!-- Parts per million ratio between image size and screen size. -->
<integer name="image_ratio">500000</integer>
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);
}
}
});