summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wren <cwren@android.com>2013-04-11 08:22:31 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-04-11 08:22:31 -0700
commitb03c9db455e905299be0d5c7a670ba6e4ec091d0 (patch)
treecf33a1e6b5f8505181f0bf9a628a28593cc27b4a
parent85211917374bbb5e50677700aacecfbc9b8b4f31 (diff)
parent3910ecc7c3a93485d32f8c1eac79e47dbf3753fb (diff)
downloadandroid_packages_screensavers_PhotoTable-b03c9db455e905299be0d5c7a670ba6e4ec091d0.tar.gz
android_packages_screensavers_PhotoTable-b03c9db455e905299be0d5c7a670ba6e4ec091d0.tar.bz2
android_packages_screensavers_PhotoTable-b03c9db455e905299be0d5c7a670ba6e4ec091d0.zip
am 3910ecc7: story mode: declutter by fading out the backgroun images.
* commit '3910ecc7c3a93485d32f8c1eac79e47dbf3753fb': story mode: declutter by fading out the backgroun images.
-rw-r--r--res/values-land-notouch/config.xml24
-rw-r--r--res/values/config.xml2
-rw-r--r--src/com/android/dreams/phototable/PhotoTable.java57
3 files changed, 76 insertions, 7 deletions
diff --git a/res/values-land-notouch/config.xml b/res/values-land-notouch/config.xml
new file mode 100644
index 0000000..c9d537f
--- /dev/null
+++ b/res/values-land-notouch/config.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+
+ <!-- Maximum number of photos to leave on the table. -->
+ <integer name="table_capacity">8</integer>
+
+ <!-- Number of images to discard at a time. -->
+ <integer name="redeal_count">4</integer>
+
+</resources> \ No newline at end of file
diff --git a/res/values/config.xml b/res/values/config.xml
index 72e7b11..84299b1 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -101,7 +101,7 @@
<bool name="enable_story_mode">true</bool>
<!-- Duration ion milliseconds for the pickup animation. -->
- <integer name="photo_pickup_duration">1000</integer>
+ <integer name="photo_pickup_duration">2000</integer>
<!-- Milliseconds that the selection will remain without user interaction. -->
<integer name="max_selection_time">30000</integer>
diff --git a/src/com/android/dreams/phototable/PhotoTable.java b/src/com/android/dreams/phototable/PhotoTable.java
index 4480818..7f4f61a 100644
--- a/src/com/android/dreams/phototable/PhotoTable.java
+++ b/src/com/android/dreams/phototable/PhotoTable.java
@@ -15,6 +15,9 @@
*/
package com.android.dreams.phototable;
+import android.animation.Animator;
+import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
@@ -34,6 +37,7 @@ import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewPropertyAnimator;
+import android.view.animation.Animation;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.FrameLayout;
@@ -41,6 +45,7 @@ import android.widget.ImageView;
import java.util.Formatter;
import java.util.LinkedList;
+import java.util.List;
import java.util.Random;
/**
@@ -174,6 +179,9 @@ public class PhotoTable extends FrameLayout {
if (hasSelection()) {
dropOnTable(mSelection);
mPhotoSource.donePaging(getBitmap(mSelection));
+ if (mStoryModeEnabled) {
+ fadeInExcept(mSelection);
+ }
mSelection = null;
}
for (int slot = 0; slot < mOnDeck.length; slot++) {
@@ -194,6 +202,9 @@ public class PhotoTable extends FrameLayout {
clearSelection();
mSelection = selected;
promoteSelection();
+ if (mStoryModeEnabled) {
+ fadeOutExcept(mSelection);
+ }
}
}
@@ -581,6 +592,44 @@ public class PhotoTable extends FrameLayout {
}
}
+ /** De-emphasize the other photos on the table. */
+ public void fadeOutExcept(final View photo) {
+ List<Animator> animations = new LinkedList<Animator>();
+ for (View background: mOnTable) {
+ if (background != photo) {
+ // fade out to transparent.
+ background.animate().cancel();
+ animations.add(ObjectAnimator.ofFloat(background, "alpha", 0f));
+ }
+ }
+ if (animations.size() > 0) {
+ AnimatorSet set = new AnimatorSet();
+ set.playTogether(animations);
+ set.setDuration(mPickUpDuration);
+ set.start();
+ }
+ }
+
+
+ /** Return the other photos to foreground status. */
+ public void fadeInExcept(final View photo) {
+ List<Animator> animations = new LinkedList<Animator>();
+ for (View background: mOnTable) {
+ if (background != photo) {
+ // fade back to full opacity.
+ background.animate().cancel();
+ animations.add(ObjectAnimator.ofFloat(background, "alpha", 1f));
+ }
+ }
+ if (animations.size() > 0) {
+ AnimatorSet set = new AnimatorSet();
+ set.playTogether(animations);
+ set.setDuration(mPickUpDuration);
+ set.start();
+ }
+ }
+
+
/** Dispose of the photo gracefully, in case we can see some of it. */
public void fadeAway(final View photo, final boolean replace) {
// fade out of view
@@ -589,7 +638,7 @@ public class PhotoTable extends FrameLayout {
photo.animate()
.withLayer()
.alpha(0f)
- .setDuration(1000)
+ .setDuration(mPickUpDuration)
.withEndAction(new Runnable() {
@Override
public void run() {
@@ -797,11 +846,6 @@ public class PhotoTable extends FrameLayout {
float x = (getWidth() - photoWidth) / 2f;
float y = (getHeight() - photoHeight) / 2f;
- float x0 = photo.getX();
- float y0 = photo.getY();
- float dx = x - x0;
- float dy = y - y0;
-
photo.setRotation(wrapAngle(photo.getRotation()));
log("animate it");
@@ -809,6 +853,7 @@ public class PhotoTable extends FrameLayout {
photo.animate()
.rotation(0f)
.rotationY(0f)
+ .alpha(1f)
.scaleX(scale)
.scaleY(scale)
.x(x)