blob: 0ecf1f42d531a13a89202fcde1b8b1e120ca4652 [file] [log] [blame]
Chet Haasefaebd8f2012-05-18 14:17:57 -07001/*
2 * Copyright (C) 2013 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package com.android.transitiontests;
17
18import android.app.Activity;
19import android.os.Bundle;
20import android.view.View;
21import android.view.ViewGroup;
22import android.view.transition.Scene;
23import android.widget.Button;
24import android.view.transition.Fade;
25import android.view.transition.Move;
26import android.view.transition.TextChange;
27import android.view.transition.TransitionGroup;
28import android.view.transition.TransitionManager;
29import com.android.transitiontest.R;
30
31public class ClippingText extends Activity {
32
33 Button mRemovingButton, mInvisibleButton, mGoneButton;
34 Scene mScene1, mScene2;
35 ViewGroup mSceneRoot;
36 // static Fade sFade = new Fade(R.id.removingButton, R.id.invisibleButton, R.id.goneButton);
37 Fade fader;
38 TransitionGroup mChanger;
39
40 @Override
41 public void onCreate(Bundle savedInstanceState) {
42 super.onCreate(savedInstanceState);
43 setContentView(R.layout.clipping_text_1);
44
45 View container = (View) findViewById(R.id.container);
46 mSceneRoot = (ViewGroup) container.getParent();
47
48 mScene1 = new Scene(mSceneRoot, R.layout.clipping_text_1, this);
49 mScene2 = new Scene(mSceneRoot, R.layout.clipping_text_2, this);
50
51 mChanger = new TransitionGroup(TransitionGroup.TOGETHER);
52 Move move = new Move();
53 move.setResizeClip(true);
54 mChanger.addTransitions(move, new TextChange());
55
56 mSceneRoot.setCurrentScene(mScene1);
57 }
58
59 public void sendMessage(View view) {
60 if (mSceneRoot.getCurrentScene() == mScene1) {
61 TransitionManager.go(mScene2, mChanger);
62 } else {
63 TransitionManager.go(mScene1, mChanger);
64 }
65 }
66}