diff options
author | Chris Wren <cwren@android.com> | 2013-03-14 13:34:06 -0400 |
---|---|---|
committer | Chris Wren <cwren@android.com> | 2013-03-14 18:10:59 -0400 |
commit | eb70217554d14807d73cae033b4f756c9b80fe3b (patch) | |
tree | 7138fe445984f4a252887666f8be03b05ea6430c /src/com/android/dreams/phototable/PhotoTouchListener.java | |
parent | 7ec52545cbf2f26dac8e5e0105147075c57956ac (diff) | |
download | android_packages_screensavers_PhotoTable-eb70217554d14807d73cae033b4f756c9b80fe3b.tar.gz android_packages_screensavers_PhotoTable-eb70217554d14807d73cae033b4f756c9b80fe3b.tar.bz2 android_packages_screensavers_PhotoTable-eb70217554d14807d73cae033b4f756c9b80fe3b.zip |
add keyboard navigation to photo table daydream
arrows: move focus
enter: select/deselect
x/del: throw away
Bug: 8387448
Change-Id: I45d9b2273051abd18aaa82a7e6201196b06f7ce0
Diffstat (limited to 'src/com/android/dreams/phototable/PhotoTouchListener.java')
-rw-r--r-- | src/com/android/dreams/phototable/PhotoTouchListener.java | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/src/com/android/dreams/phototable/PhotoTouchListener.java b/src/com/android/dreams/phototable/PhotoTouchListener.java index 8076e72..fd52749 100644 --- a/src/com/android/dreams/phototable/PhotoTouchListener.java +++ b/src/com/android/dreams/phototable/PhotoTouchListener.java @@ -21,8 +21,6 @@ import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; -import android.view.ViewPropertyAnimator; -import android.view.animation.DecelerateInterpolator; /** * Touch listener that implements phototable interactions. @@ -127,22 +125,10 @@ public class PhotoTouchListener implements View.OnTouchListener { final float halfShortSide = Math.min(photoWidth * mTableRatio, photoHeight * mTableRatio) / 2f; final View photo = target; - ViewPropertyAnimator animator = photo.animate() - .xBy(x1 - x0) - .yBy(y1 - y0) - .setDuration((int) (1000f * n / 60f)) - .setInterpolator(new DecelerateInterpolator(2f)); + boolean flingAway = y1 + halfShortSide < 0f || y1 - halfShortSide > tableHeight || + x1 + halfShortSide < 0f || x1 - halfShortSide > tableWidth; - if (y1 + halfShortSide < 0f || y1 - halfShortSide > tableHeight || - x1 + halfShortSide < 0f || x1 - halfShortSide > tableWidth) { - log("fling away"); - animator.withEndAction(new Runnable() { - @Override - public void run() { - mTable.fadeAway(photo, true); - } - }); - } + mTable.fling(photo, x1 - x0, y1 - y0, (int) (1000f * n / 60f), flingAway, false); } @Override @@ -158,7 +144,7 @@ public class PhotoTouchListener implements View.OnTouchListener { switch (action) { case MotionEvent.ACTION_DOWN: - mTable.moveToBackOfQueue(target); + mTable.moveToTopOfPile(target); mInitialTouchTime = ev.getEventTime(); mA = ev.getPointerId(ev.getActionIndex()); resetTouch(target); |