First draft of Scenes & Transitions feature

This checkin has preliminary API (in flux, definitely changes still
to be made) and implementation for a new "Scenes & Transitions" feature.
The current implementation allows you to define different Scenes
(via layout resource IDs or callbacks) and Transitions to be used when
changing to those scenes. By default, scene changes will use AutoTransition,
which generally does the right thing.

There are no overview docs or tutorials yet. The best way to learn how things
work is to see the code for the various tests in
frameworks/base/tests/TransitionTests.

Expect the API to change. Expect the implementation to change (mostly to add
more functionality). Expect bugs, but tell me if things do not work
as expected.

Change-Id: Ib025a9f565678b225afa4759325cf6d496cc7215
diff --git a/tests/TransitionTests/src/com/android/transitiontests/CrossFadeDemo.java b/tests/TransitionTests/src/com/android/transitiontests/CrossFadeDemo.java
new file mode 100644
index 0000000..c428a73
--- /dev/null
+++ b/tests/TransitionTests/src/com/android/transitiontests/CrossFadeDemo.java
@@ -0,0 +1,67 @@
+/*
+ * 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.TransitionGroup;
+import android.view.transition.TransitionManager;
+import com.android.transitiontest.R;
+
+
+public class CrossFadeDemo extends Activity {
+
+    ViewGroup mSceneRoot;
+    static int mCurrentScene;
+    Scene mScene1, mScene2;
+    TransitionManager mTransitionManager;
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.crossfade);
+
+        View container = (View) findViewById(R.id.container);
+        mSceneRoot = (ViewGroup) container.getParent();
+
+        mScene1 = new Scene(mSceneRoot, R.layout.crossfade, this);
+        mScene2 = new Scene(mSceneRoot, R.layout.crossfade_1, this);
+
+        Crossfade crossfade = new Crossfade();
+        crossfade.setTargetIds(R.id.textview, R.id.textview1, R.id.textview2);
+        mTransitionManager = new TransitionManager();
+        TransitionGroup moveCrossFade = new TransitionGroup();
+        moveCrossFade.addTransitions(crossfade, new Move());
+        mTransitionManager.setTransition(mScene1, moveCrossFade);
+        mTransitionManager.setTransition(mScene2, moveCrossFade);
+        mCurrentScene = 1;
+    }
+
+    public void sendMessage(View view) {
+        if (mCurrentScene == 1) {
+            mTransitionManager.transitionTo(mScene2);
+            mCurrentScene = 2;
+        } else {
+            mTransitionManager.transitionTo(mScene1);
+            mCurrentScene = 1;
+        }
+    }
+}