summaryrefslogtreecommitdiffstats
path: root/core/tests/coretests/src/android/animation/ObjectAnimatorEventsTest.java
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2011-07-11 17:01:56 -0700
committerChet Haase <chet@google.com>2011-07-12 11:55:51 -0700
commit7dfacdb1c820f955cb3cd6032ff5fbc2dd7d9df5 (patch)
treee3fa36e513a54fb14d2797014c640026afd5f963 /core/tests/coretests/src/android/animation/ObjectAnimatorEventsTest.java
parent221bfab8429b91ddd4f5835f399a1c9628122cbd (diff)
downloadframeworks_base-7dfacdb1c820f955cb3cd6032ff5fbc2dd7d9df5.zip
frameworks_base-7dfacdb1c820f955cb3cd6032ff5fbc2dd7d9df5.tar.gz
frameworks_base-7dfacdb1c820f955cb3cd6032ff5fbc2dd7d9df5.tar.bz2
Fix Animator cancel() behavior
Previously, calling cancel() on an Animator would cause onAnimationCancel events to be sent to all listeners. This was confusing for listeners that were keying off this event for performing other actions, when the original animator wasn't truly canceled (because it wasn't even running, or had already been canceled earlier). This change hinges listener notification on the animator actually running; no events are sent otherwise. Also added the first set of Animator tests to verify that this behavior is correct. Change-Id: I81ab56559b5c0343c8dc7880e1c8235f3020975b
Diffstat (limited to 'core/tests/coretests/src/android/animation/ObjectAnimatorEventsTest.java')
-rw-r--r--core/tests/coretests/src/android/animation/ObjectAnimatorEventsTest.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/core/tests/coretests/src/android/animation/ObjectAnimatorEventsTest.java b/core/tests/coretests/src/android/animation/ObjectAnimatorEventsTest.java
new file mode 100644
index 0000000..606a939
--- /dev/null
+++ b/core/tests/coretests/src/android/animation/ObjectAnimatorEventsTest.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+package android.animation;
+
+import android.widget.Button;
+import com.android.frameworks.coretests.R;
+
+/**
+ * Listener tests for ObjectAnimator.
+ */
+public class ObjectAnimatorEventsTest extends EventsTest {
+
+ @Override
+ public void setUp() throws Exception {
+ final BasicAnimatorActivity activity = getActivity();
+ Button button = (Button) activity.findViewById(R.id.animatingButton);
+
+ mAnimator = ObjectAnimator.ofFloat(button, "translationX", 0, 100);
+ super.setUp();
+ }
+
+}