summaryrefslogtreecommitdiffstats
path: root/tests/TransitionTests
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2013-09-20 16:33:08 -0700
committerChet Haase <chet@google.com>2013-09-26 13:38:12 -0700
commitb7a7fc9d233bad507ce893882352618b13647058 (patch)
tree852dc972097c9064c161b44676823949427e1206 /tests/TransitionTests
parentc31f118825778cff15a1c1b9d1171f2ad178a013 (diff)
downloadframeworks_base-b7a7fc9d233bad507ce893882352618b13647058.zip
frameworks_base-b7a7fc9d233bad507ce893882352618b13647058.tar.gz
frameworks_base-b7a7fc9d233bad507ce893882352618b13647058.tar.bz2
Make fading transitions work better
Previously, a Fade transition would only affect a view if its parent hierarchy was not also affected between the start/end states. This caused problems for views which were removed from their parents between scenes when their parents' visibility also changed between those scenes. The effect would be that the transition would fade the parent... but the child would no longer be in that parent, so the user would just see the child view blink out. This fix ensure that views are faded appropriately by fading them regardless the parent hierarchy; if a view is removed from its parent, fade it out. Additionally, if that view has not been removed from its parent, but its parent is no longer parented *and* scene being transitioned from is based on a layout resource file (and thus the views are considered temporary after transitioning), then it is removed from its parent to be faded out in the overlay. Also, renamed TextChange to ChangeText to be more consistent with other transition class names. Change-Id: I4e0e7dfc9e9d95c7a4ca586534b6d204c4f3bae0
Diffstat (limited to 'tests/TransitionTests')
-rw-r--r--tests/TransitionTests/res/layout/crossfade_multiple.xml5
-rw-r--r--tests/TransitionTests/res/values/strings.xml5
-rw-r--r--tests/TransitionTests/src/com/android/transitiontests/ChangingText.java4
-rw-r--r--tests/TransitionTests/src/com/android/transitiontests/ClippingText.java4
-rw-r--r--tests/TransitionTests/src/com/android/transitiontests/CrossfadeMultiple.java28
5 files changed, 29 insertions, 17 deletions
diff --git a/tests/TransitionTests/res/layout/crossfade_multiple.xml b/tests/TransitionTests/res/layout/crossfade_multiple.xml
index ca32ecb..3e6d551 100644
--- a/tests/TransitionTests/res/layout/crossfade_multiple.xml
+++ b/tests/TransitionTests/res/layout/crossfade_multiple.xml
@@ -33,6 +33,11 @@
android:onClick="changeTransitionType"
android:id="@+id/textfade2"
android:text="@string/textfade2"/>
+ <RadioButton android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:onClick="changeTransitionType"
+ android:id="@+id/textfade3"
+ android:text="@string/textfade3"/>
</RadioGroup>
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent"
diff --git a/tests/TransitionTests/res/values/strings.xml b/tests/TransitionTests/res/values/strings.xml
index 9cf7a94..e3cff48 100644
--- a/tests/TransitionTests/res/values/strings.xml
+++ b/tests/TransitionTests/res/values/strings.xml
@@ -55,6 +55,7 @@
<string name="reveal">Reveal</string>
<string name="crossfade">Crossfade</string>
<string name="inout">In/Out</string>
- <string name="textfade1">T1</string>
- <string name="textfade2">T2</string>
+ <string name="textfade1">CT</string>
+ <string name="textfade2">CTO</string>
+ <string name="textfade3">CTI</string>
</resources>
diff --git a/tests/TransitionTests/src/com/android/transitiontests/ChangingText.java b/tests/TransitionTests/src/com/android/transitiontests/ChangingText.java
index a1ddd74..01d46b2 100644
--- a/tests/TransitionTests/src/com/android/transitiontests/ChangingText.java
+++ b/tests/TransitionTests/src/com/android/transitiontests/ChangingText.java
@@ -22,7 +22,7 @@ import android.view.ViewGroup;
import android.transition.Scene;
import android.transition.TransitionSet;
import android.transition.ChangeBounds;
-import android.transition.TextChange;
+import android.transition.ChangeText;
import android.transition.TransitionManager;
public class ChangingText extends Activity {
@@ -44,7 +44,7 @@ public class ChangingText extends Activity {
mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.changing_text_2, this);
mChanger = new TransitionSet().setOrdering(TransitionSet.ORDERING_TOGETHER);
- mChanger.addTransition(new ChangeBounds()).addTransition(new TextChange());
+ mChanger.addTransition(new ChangeBounds()).addTransition(new ChangeText());
mCurrentScene = mScene1;
}
diff --git a/tests/TransitionTests/src/com/android/transitiontests/ClippingText.java b/tests/TransitionTests/src/com/android/transitiontests/ClippingText.java
index 85702fa..54c44e2 100644
--- a/tests/TransitionTests/src/com/android/transitiontests/ClippingText.java
+++ b/tests/TransitionTests/src/com/android/transitiontests/ClippingText.java
@@ -23,7 +23,7 @@ import android.view.ViewGroup;
import android.transition.Scene;
import android.widget.Button;
import android.transition.Fade;
-import android.transition.TextChange;
+import android.transition.ChangeText;
import android.transition.TransitionSet;
import android.transition.TransitionManager;
@@ -51,7 +51,7 @@ public class ClippingText extends Activity {
mChanger = new TransitionSet().setOrdering(TransitionSet.ORDERING_TOGETHER);
ChangeBounds changeBounds = new ChangeBounds();
changeBounds.setResizeClip(true);
- mChanger.addTransition(changeBounds).addTransition(new TextChange());
+ mChanger.addTransition(changeBounds).addTransition(new ChangeText());
mCurrentScene = mScene1;
}
diff --git a/tests/TransitionTests/src/com/android/transitiontests/CrossfadeMultiple.java b/tests/TransitionTests/src/com/android/transitiontests/CrossfadeMultiple.java
index d784f75..469ee8b 100644
--- a/tests/TransitionTests/src/com/android/transitiontests/CrossfadeMultiple.java
+++ b/tests/TransitionTests/src/com/android/transitiontests/CrossfadeMultiple.java
@@ -21,7 +21,7 @@ import android.transition.ChangeBounds;
import android.view.View;
import android.view.ViewGroup;
import android.transition.Crossfade;
-import android.transition.TextChange;
+import android.transition.ChangeText;
import android.transition.Transition;
import android.transition.TransitionSet;
import android.transition.TransitionManager;
@@ -41,7 +41,7 @@ public class CrossfadeMultiple extends Activity {
Button mButton;
Crossfade mCrossfade;
TransitionSet mCrossfadeGroup;
- TransitionSet mTextChangeGroup1, mTextChangeGroup2;
+ TransitionSet mTextChangeGroup1, mTextChangeGroup2, mTextChangeGroup3;
TransitionSet mInOutGroup;
@Override
@@ -74,18 +74,21 @@ public class CrossfadeMultiple extends Activity {
mInOutGroup.addTransition(inOut).addTransition(changeBounds);
mTextChangeGroup1 = new TransitionSet();
- TextChange textChangeInOut = new TextChange();
- textChangeInOut.setChangeBehavior(TextChange.CHANGE_BEHAVIOR_OUT_IN);
- mTextChangeGroup1.addTransition(textChangeInOut).addTransition(new ChangeBounds());
+ ChangeText changeTextInOut = new ChangeText();
+ changeTextInOut.setChangeBehavior(ChangeText.CHANGE_BEHAVIOR_OUT_IN);
+ mTextChangeGroup1.addTransition(changeTextInOut).addTransition(new ChangeBounds());
mTextChangeGroup2 = new TransitionSet();
mTextChangeGroup2.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
- TextChange textChangeOut = new TextChange();
- textChangeOut.setChangeBehavior(TextChange.CHANGE_BEHAVIOR_OUT);
- TextChange textChangeIn = new TextChange();
- textChangeIn.setChangeBehavior(TextChange.CHANGE_BEHAVIOR_IN);
- mTextChangeGroup2.addTransition(textChangeOut).addTransition(new ChangeBounds()).
- addTransition(textChangeIn);
+ ChangeText changeTextOut = new ChangeText();
+ changeTextOut.setChangeBehavior(ChangeText.CHANGE_BEHAVIOR_OUT);
+ mTextChangeGroup2.addTransition(changeTextOut).addTransition(new ChangeBounds());
+
+ mTextChangeGroup3 = new TransitionSet();
+ mTextChangeGroup3.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
+ ChangeText changeTextIn = new ChangeText();
+ changeTextIn.setChangeBehavior(ChangeText.CHANGE_BEHAVIOR_IN);
+ mTextChangeGroup3.addTransition(changeTextIn).addTransition(new ChangeBounds());
}
public void sendMessage(View view) {
@@ -135,6 +138,9 @@ public class CrossfadeMultiple extends Activity {
case R.id.textfade2:
mTransition = mTextChangeGroup2;
break;
+ case R.id.textfade3:
+ mTransition = mTextChangeGroup3;
+ break;
}
}
}