summaryrefslogtreecommitdiffstats
path: root/tests/TransitionTests/src
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2013-07-10 11:27:54 -0700
committerChet Haase <chet@google.com>2013-07-10 12:14:54 -0700
commitdc57d9dda559aaf06237b9124dc9ef27513bab31 (patch)
tree887177b3a22c8e087637a04daefa7cec6b83179a /tests/TransitionTests/src
parent0d21c220ddb1873133c24449404f82c28b19b8b4 (diff)
downloadframeworks_base-dc57d9dda559aaf06237b9124dc9ef27513bab31.zip
frameworks_base-dc57d9dda559aaf06237b9124dc9ef27513bab31.tar.gz
frameworks_base-dc57d9dda559aaf06237b9124dc9ef27513bab31.tar.bz2
Fix minor transition bugs
TransitionGroup.setDuration() was not propagating the new duration to future child transitions correctly. Also, Fade should restore a fully-opaque value when a transition ends, to prevent the problem of mid-stream canceled transitions causing vie3ws to get stuck with partially faded-in alpha values. Issue #9755995 Transitions: TransitionGroup.setDuration() not handled correctly Issue #9756655 Transitions: handle fading cancelation better Change-Id: Id44569c6f4152a26ee382d04c30a2f035a1ebcf3
Diffstat (limited to 'tests/TransitionTests/src')
-rw-r--r--tests/TransitionTests/src/com/android/transitiontests/CrossfadeImage.java68
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/TransitionTests/src/com/android/transitiontests/CrossfadeImage.java b/tests/TransitionTests/src/com/android/transitiontests/CrossfadeImage.java
new file mode 100644
index 0000000..28e055f
--- /dev/null
+++ b/tests/TransitionTests/src/com/android/transitiontests/CrossfadeImage.java
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+package com.android.transitiontests;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.transition.Crossfade;
+import android.view.transition.Move;
+import android.view.transition.Scene;
+import android.view.transition.Transition;
+import android.view.transition.TransitionGroup;
+import android.view.transition.TransitionManager;
+import android.widget.ImageView;
+
+public class CrossfadeImage extends Activity {
+ ViewGroup mSceneRoot;
+ static int mCurrentScene;
+ Scene mScene1, mScene2;
+ TransitionManager mTransitionManager;
+ boolean mExpanded = false;
+ Transition mTransition;
+ ImageView mImageView;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.crossfade_image);
+
+ ViewGroup container = (ViewGroup) findViewById(R.id.container);
+ mSceneRoot = container;
+
+ mImageView = (ImageView) findViewById(R.id.contact_picture);
+ mImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
+
+ Crossfade mCrossfade = new Crossfade();
+ mCrossfade.setTargetIds(R.id.contact_picture);
+
+ TransitionGroup group = new TransitionGroup();
+ group.setDuration(1500);
+ group.addTransitions(mCrossfade, new Move());
+ mTransition = group;
+ }
+
+ public void sendMessage(View view) {
+ TransitionManager.beginDelayedTransition(mSceneRoot, mTransition);
+ if (mExpanded) {
+ mImageView.setImageResource(R.drawable.self_portrait_square_100);
+ } else {
+ mImageView.setImageResource(R.drawable.self_portrait_square_200);
+ }
+ mExpanded = !mExpanded;
+ }
+}