diff options
author | nicolasroard <nicolasroard@google.com> | 2013-02-12 02:24:34 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-02-12 02:24:34 +0000 |
commit | 1d160fd11e594a7ae77ae09d9f561b02cc9030a0 (patch) | |
tree | bf6052668c6ff275f680f6b5f81ddb752d759984 /src/com/android/gallery3d/filtershow/PanelController.java | |
parent | 3e926284099152f14a78910c744d462d13a044e5 (diff) | |
parent | d3b009b2c15c607c0b4bcc72412c45d231e26ca2 (diff) | |
download | android_packages_apps_Snap-1d160fd11e594a7ae77ae09d9f561b02cc9030a0.tar.gz android_packages_apps_Snap-1d160fd11e594a7ae77ae09d9f561b02cc9030a0.tar.bz2 android_packages_apps_Snap-1d160fd11e594a7ae77ae09d9f561b02cc9030a0.zip |
Merge "Adding support for ICS" into gb-ub-photos-bryce
Diffstat (limited to 'src/com/android/gallery3d/filtershow/PanelController.java')
-rw-r--r-- | src/com/android/gallery3d/filtershow/PanelController.java | 86 |
1 files changed, 60 insertions, 26 deletions
diff --git a/src/com/android/gallery3d/filtershow/PanelController.java b/src/com/android/gallery3d/filtershow/PanelController.java index ce7216289..a8ec3c236 100644 --- a/src/com/android/gallery3d/filtershow/PanelController.java +++ b/src/com/android/gallery3d/filtershow/PanelController.java @@ -16,6 +16,7 @@ package com.android.gallery3d.filtershow; +import android.annotation.TargetApi; import android.content.Context; import android.text.Html; import android.view.View; @@ -48,6 +49,10 @@ public class PanelController implements OnClickListener { private boolean mDisableFilterButtons = false; private boolean mFixedAspect = false; + public static boolean useAnimations() { + return true; + } + public void setFixedAspect(boolean t) { mFixedAspect = t; } @@ -86,16 +91,28 @@ public class PanelController implements OnClickListener { } else { delta = w; } - anim.x(delta); + if (PanelController.useAnimations()) { + anim.x(delta); + } else { + mContainer.setX(delta); + } } else if (move == VERTICAL_MOVE) { - anim.y(h); - } - anim.setDuration(ANIM_DURATION).withLayer().withEndAction(new Runnable() { - @Override - public void run() { - mContainer.setVisibility(View.GONE); + if (PanelController.useAnimations()) { + anim.y(h); + } else { + mContainer.setY(h); } - }); + } + if (PanelController.useAnimations()) { + anim.setDuration(ANIM_DURATION).withLayer().withEndAction(new Runnable() { + @Override + public void run() { + mContainer.setVisibility(View.GONE); + } + }); + } else { + mContainer.setVisibility(View.GONE); + } return anim; } @@ -107,18 +124,20 @@ public class PanelController implements OnClickListener { ViewPropertyAnimator anim = mContainer.animate(); int w = mRowPanel.getWidth(); int h = mRowPanel.getHeight(); - if (move == HORIZONTAL_MOVE) { - if (oldPos < mPosition) { - mContainer.setX(w); - } else { - mContainer.setX(-w); + if (useAnimations()) { + if (move == HORIZONTAL_MOVE) { + if (oldPos < mPosition) { + mContainer.setX(w); + } else { + mContainer.setX(-w); + } + anim.x(0); + } else if (move == VERTICAL_MOVE) { + mContainer.setY(h); + anim.y(0); } - anim.x(0); - } else if (move == VERTICAL_MOVE) { - mContainer.setY(h); - anim.y(0); + anim.setDuration(ANIM_DURATION).withLayer(); } - anim.setDuration(ANIM_DURATION).withLayer(); return anim; } } @@ -368,10 +387,14 @@ public class PanelController implements OnClickListener { if (mUtilityPanel != null && mUtilityPanel.selected()) { ViewPropertyAnimator anim1 = mUtilityPanel.unselect(); removedUtilityPanel = true; - anim1.start(); + if (anim1 != null) { + anim1.start(); + } if (mCurrentPanel == view) { ViewPropertyAnimator anim2 = current.select(-1, VERTICAL_MOVE); - anim2.start(); + if (anim2 != null) { + anim2.start(); + } showDefaultImageView(); } } @@ -387,15 +410,22 @@ public class PanelController implements OnClickListener { currentPos = current.getPosition(); } ViewPropertyAnimator anim1 = panel.select(currentPos, HORIZONTAL_MOVE); - anim1.start(); + if (anim1 != null) { + anim1.start(); + } if (current != null) { ViewPropertyAnimator anim2 = current.unselect(panel.getPosition(), HORIZONTAL_MOVE); - anim2.start(); + if (anim2 != null) { + anim2.start(); + } } } else { ViewPropertyAnimator anim = panel.select(-1, VERTICAL_MOVE); - anim.start(); + if (anim != null) { + anim.start(); + } } + showDefaultImageView(); mCurrentPanel = view; } @@ -481,13 +511,17 @@ public class PanelController implements OnClickListener { } } - if (mUtilityPanel != null && !mUtilityPanel.selected() && doPanelTransition ) { + if (mUtilityPanel != null && !mUtilityPanel.selected() && doPanelTransition) { Panel current = mPanels.get(mCurrentPanel); ViewPropertyAnimator anim1 = current.unselect(-1, VERTICAL_MOVE); - anim1.start(); + if (anim1 != null) { + anim1.start(); + } if (mUtilityPanel != null) { ViewPropertyAnimator anim2 = mUtilityPanel.select(); - anim2.start(); + if (anim2 != null) { + anim2.start(); + } } } |