diff options
| author | George Mount <mount@google.com> | 2014-04-15 09:01:32 -0700 |
|---|---|---|
| committer | George Mount <mount@google.com> | 2014-04-29 13:08:35 -0700 |
| commit | 608b87d9e57b71a86374a439bf5c3febd1e142f2 (patch) | |
| tree | 6a808cc00034c2aafd63e6c41c7ce2e9c4f35ff1 /core/java/android/transition/MoveImage.java | |
| parent | f976c3d42bc2f14333bae5ed26d96c45d207a443 (diff) | |
| download | frameworks_base-608b87d9e57b71a86374a439bf5c3febd1e142f2.zip frameworks_base-608b87d9e57b71a86374a439bf5c3febd1e142f2.tar.gz frameworks_base-608b87d9e57b71a86374a439bf5c3febd1e142f2.tar.bz2 | |
Add Transform and ClipBounds Transitions.
Made MoveImage use an overlay view. Drawables
cover all Views in the overlay and there may
be a desire to order the overlays.
Change-Id: Ic7b81f0d26d8cce3f475c2eebbce01538bc55d46
Diffstat (limited to 'core/java/android/transition/MoveImage.java')
| -rw-r--r-- | core/java/android/transition/MoveImage.java | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/core/java/android/transition/MoveImage.java b/core/java/android/transition/MoveImage.java index d68e971..e4c3939 100644 --- a/core/java/android/transition/MoveImage.java +++ b/core/java/android/transition/MoveImage.java @@ -170,13 +170,20 @@ public class MoveImage extends Transition { drawable = drawable.getConstantState().newDrawable(); final MatrixClippedDrawable matrixClippedDrawable = new MatrixClippedDrawable(drawable); + final ImageView overlayImage = new ImageView(imageView.getContext()); + final ViewGroupOverlay overlay = sceneRoot.getOverlay(); + overlay.add(overlayImage); + overlayImage.setLeft(0); + overlayImage.setTop(0); + overlayImage.setRight(sceneRoot.getWidth()); + overlayImage.setBottom(sceneRoot.getBottom()); + overlayImage.setScaleType(ImageView.ScaleType.MATRIX); + overlayImage.setImageDrawable(matrixClippedDrawable); matrixClippedDrawable.setMatrix(startMatrix); matrixClippedDrawable.setBounds(startBounds); matrixClippedDrawable.setClipRect(startClip); imageView.setVisibility(View.INVISIBLE); - final ViewGroupOverlay overlay = sceneRoot.getOverlay(); - overlay.add(matrixClippedDrawable); ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(matrixClippedDrawable, changes.toArray(new PropertyValuesHolder[changes.size()])); @@ -184,19 +191,24 @@ public class MoveImage extends Transition { @Override public void onAnimationEnd(Animator animation) { imageView.setVisibility(View.VISIBLE); - overlay.remove(matrixClippedDrawable); + overlay.remove(overlayImage); } @Override public void onAnimationPause(Animator animation) { imageView.setVisibility(View.VISIBLE); - overlay.remove(matrixClippedDrawable); + overlayImage.setVisibility(View.INVISIBLE); } @Override public void onAnimationResume(Animator animation) { imageView.setVisibility(View.INVISIBLE); - overlay.add(matrixClippedDrawable); + overlayImage.setVisibility(View.VISIBLE); + } + + @Override + public void onAnimationCancel(Animator animation) { + onAnimationEnd(animation); } }; |
