blob: c3201f28e0c2092727851fbeb044781f65553517 [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;
Chet Haasefaebd8f2012-05-18 14:17:57 -070029
30public class ClippingText extends Activity {
31
32 Button mRemovingButton, mInvisibleButton, mGoneButton;
33 Scene mScene1, mScene2;
34 ViewGroup mSceneRoot;
35 // static Fade sFade = new Fade(R.id.removingButton, R.id.invisibleButton, R.id.goneButton);
36 Fade fader;
37 TransitionGroup mChanger;
38
39 @Override
40 public void onCreate(Bundle savedInstanceState) {
41 super.onCreate(savedInstanceState);
42 setContentView(R.layout.clipping_text_1);
43
44 View container = (View) findViewById(R.id.container);
45 mSceneRoot = (ViewGroup) container.getParent();
46
47 mScene1 = new Scene(mSceneRoot, R.layout.clipping_text_1, this);
48 mScene2 = new Scene(mSceneRoot, R.layout.clipping_text_2, this);
49
50 mChanger = new TransitionGroup(TransitionGroup.TOGETHER);
51 Move move = new Move();
52 move.setResizeClip(true);
53 mChanger.addTransitions(move, new TextChange());
54
55 mSceneRoot.setCurrentScene(mScene1);
56 }
57
58 public void sendMessage(View view) {
59 if (mSceneRoot.getCurrentScene() == mScene1) {
60 TransitionManager.go(mScene2, mChanger);
61 } else {
62 TransitionManager.go(mScene1, mChanger);
63 }
64 }
65}