diff options
author | Chet Haase <chet@google.com> | 2013-06-03 07:30:21 -0700 |
---|---|---|
committer | Chet Haase <chet@google.com> | 2013-06-03 16:37:05 -0700 |
commit | 867a86613d4152a93423300f83597300e6ebeebe (patch) | |
tree | 9087a8ca942f453fb2da7555cd04c5aa2083213d /tests/TransitionTests/src/com | |
parent | d18607980d86f03ffd838321ac3d511fa820b3e0 (diff) | |
download | frameworks_base-867a86613d4152a93423300f83597300e6ebeebe.zip frameworks_base-867a86613d4152a93423300f83597300e6ebeebe.tar.gz frameworks_base-867a86613d4152a93423300f83597300e6ebeebe.tar.bz2 |
Various fixes/cleanup in Scenes and Transitions
setDuration() wasn't handled correctly for TransitionGroup; it should
propagate the value to its children.
Also, videos with no ids were not being handled correctly. The transition code was
using the default id on those views (-1) to store start/end data about the view,
causing multiple non-id views to clobber values in the hashmaps. The correct approach
should be to ignore default id values - only store information about the view
instances, not about the unset ids.
Also, added a new test InterruptTest to be used to fix the current behavior of
not handling situations where new transitions start while old ones are still taking place.
Change-Id: I4e880bdbb33cc26d487bceb0d56e463e72f7621f
Diffstat (limited to 'tests/TransitionTests/src/com')
-rw-r--r-- | tests/TransitionTests/src/com/android/transitiontests/ChangingText.java | 2 | ||||
-rw-r--r-- | tests/TransitionTests/src/com/android/transitiontests/InterruptionTest.java | 74 |
2 files changed, 74 insertions, 2 deletions
diff --git a/tests/TransitionTests/src/com/android/transitiontests/ChangingText.java b/tests/TransitionTests/src/com/android/transitiontests/ChangingText.java index 3bb7100..05bed5f 100644 --- a/tests/TransitionTests/src/com/android/transitiontests/ChangingText.java +++ b/tests/TransitionTests/src/com/android/transitiontests/ChangingText.java @@ -29,10 +29,8 @@ import android.view.transition.TransitionManager; public class ChangingText extends Activity { - Button mRemovingButton, mInvisibleButton, mGoneButton; Scene mScene1, mScene2; ViewGroup mSceneRoot; - Fade fader; TransitionGroup mChanger; @Override diff --git a/tests/TransitionTests/src/com/android/transitiontests/InterruptionTest.java b/tests/TransitionTests/src/com/android/transitiontests/InterruptionTest.java new file mode 100644 index 0000000..47cf002 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/InterruptionTest.java @@ -0,0 +1,74 @@ +/* + * 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.AutoTransition; +import android.view.transition.Move; +import android.view.transition.Scene; +import android.view.transition.TextChange; +import android.view.transition.Transition; +import android.view.transition.TransitionGroup; +import android.view.transition.TransitionManager; +import android.widget.RadioButton; + +public class InterruptionTest extends Activity { + + RadioButton mScene1RB, mScene2RB, mScene3RB, mScene4RB; + private Scene mScene1; + private Scene mScene2; + private Scene mScene3; + private Scene mScene4; + Transition mAutoTransition = new AutoTransition(); + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.interruption); + + View container = (View) findViewById(R.id.container); + ViewGroup sceneRoot = (ViewGroup) findViewById(R.id.sceneRoot); + + mScene1 = new Scene(sceneRoot, R.layout.interruption_inner_1, this); + mScene2 = new Scene(sceneRoot, R.layout.interruption_inner_2, this); + mScene3 = new Scene(sceneRoot, R.layout.interruption_inner_3, this); + mScene4 = new Scene(sceneRoot, R.layout.interruption_inner_4, this); + + mScene1RB = (RadioButton) findViewById(R.id.scene1RB); + mScene2RB = (RadioButton) findViewById(R.id.scene2RB); + mScene3RB = (RadioButton) findViewById(R.id.scene3RB); + mScene4RB = (RadioButton) findViewById(R.id.scene4RB); + + sceneRoot.setCurrentScene(mScene1); + + mAutoTransition.setDuration(1500); + } + + public void onRadioButtonClicked(View clickedButton) { + if (clickedButton == mScene1RB) { + TransitionManager.go(mScene1, mAutoTransition); + } else if (clickedButton == mScene2RB) { + TransitionManager.go(mScene2, mAutoTransition); + } else if (clickedButton == mScene3RB) { + TransitionManager.go(mScene3, mAutoTransition); + } else { + TransitionManager.go(mScene4, mAutoTransition); + } + } +} |