diff options
Diffstat (limited to 'tests/TransitionTests')
98 files changed, 4620 insertions, 0 deletions
diff --git a/tests/TransitionTests/Android.mk b/tests/TransitionTests/Android.mk new file mode 100644 index 0000000..22fa638 --- /dev/null +++ b/tests/TransitionTests/Android.mk @@ -0,0 +1,18 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := optional + +# Only compile source java files in this apk. +LOCAL_SRC_FILES := $(call all-java-files-under, src) + +LOCAL_PACKAGE_NAME := TransitionTests + +LOCAL_STATIC_JAVA_LIBRARIES += android-common + +LOCAL_PROGUARD_ENABLED := disabled + +include $(BUILD_PACKAGE) + +# Use the following include to make our test apk. +include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/tests/TransitionTests/AndroidManifest.xml b/tests/TransitionTests/AndroidManifest.xml new file mode 100644 index 0000000..35e7b69 --- /dev/null +++ b/tests/TransitionTests/AndroidManifest.xml @@ -0,0 +1,253 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.transitiontests" + android:versionCode="1" + android:versionName="1.0"> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + <application + android:icon="@drawable/icon" + android:label="@string/app_name" + android:hardwareAccelerated="true" + android:theme="@style/AppTheme"> + <activity android:label="@string/states_test1" + android:name="ScenesTestv21"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="@string/states_test_auto_targets" + android:name="ScenesTestAutoTargets"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="@string/states_test_auto_transition" + android:name="ScenesTestAutoTransition"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="@string/states_test_auto_transition2" + android:name="ScenesTestAutoTransition2"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="@string/contacts_expansion" + android:name="ContactsExpansion"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="Demo0" + android:name="Demo0"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="Demo1" + android:name="Demo1"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="Demo2" + android:name="Demo2"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="Demo3" + android:name="Demo3"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="Demo4" + android:name="Demo4"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="Demo5" + android:name="Demo5"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="LoginActivity" + android:name="LoginActivity"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="LoginActivityFromResources" + android:name="LoginActivityFromResources"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="OverlayTest" + android:name="OverlayTest"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="ResourceLoadingTest" + android:name="ResourceLoadingTest"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="FadingTest" + android:name="FadingTest"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="UniqueIds" + android:name="UniqueIds"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="HitRectBug" + android:name="HitRectBug"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="SequenceTest" + android:name="SequenceTest"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="SequenceTestSimple" + android:name="SequenceTestSimple"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="ChangingText" + android:name="ChangingText"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="ClippingText" + android:name="ClippingText"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="ListViewAddRemove" + android:name="ListViewAddRemove"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="ListViewAddRemoveNoTransition" + android:name="ListViewAddRemoveNoTransition"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="CrossFadeDemo" + android:name="CrossFadeDemo"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="Reparenting" + android:name="Reparenting"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="SurfaceAndTextureViews" + android:name="SurfaceAndTextureViews"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="InstanceTargets" + android:name="InstanceTargets"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="InterruptionTest" + android:name="InterruptionTest"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="DelayedTransition" + android:name="DelayedTransition"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="FadingHierachy" + android:name=".FadingHierarchy"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="HierarchicalMove" + android:name=".HierarchicalMove"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="CrossfadeImage" + android:name=".CrossfadeImage"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:label="CrossfadeMultiple" + android:name=".CrossfadeMultiple"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + + </application> + +</manifest> diff --git a/tests/TransitionTests/res/drawable-hdpi/icon.png b/tests/TransitionTests/res/drawable-hdpi/icon.png Binary files differnew file mode 100644 index 0000000..8074c4c --- /dev/null +++ b/tests/TransitionTests/res/drawable-hdpi/icon.png diff --git a/tests/TransitionTests/res/drawable-ldpi/icon.png b/tests/TransitionTests/res/drawable-ldpi/icon.png Binary files differnew file mode 100644 index 0000000..1095584 --- /dev/null +++ b/tests/TransitionTests/res/drawable-ldpi/icon.png diff --git a/tests/TransitionTests/res/drawable-mdpi/icon.png b/tests/TransitionTests/res/drawable-mdpi/icon.png Binary files differnew file mode 100644 index 0000000..a07c69f --- /dev/null +++ b/tests/TransitionTests/res/drawable-mdpi/icon.png diff --git a/tests/TransitionTests/res/drawable-nodpi/arrow_thumbnail.png b/tests/TransitionTests/res/drawable-nodpi/arrow_thumbnail.png Binary files differnew file mode 100644 index 0000000..5cae8f2 --- /dev/null +++ b/tests/TransitionTests/res/drawable-nodpi/arrow_thumbnail.png diff --git a/tests/TransitionTests/res/drawable-nodpi/self_portrait_square.jpg b/tests/TransitionTests/res/drawable-nodpi/self_portrait_square.jpg Binary files differnew file mode 100644 index 0000000..8cce1c1 --- /dev/null +++ b/tests/TransitionTests/res/drawable-nodpi/self_portrait_square.jpg diff --git a/tests/TransitionTests/res/drawable-nodpi/self_portrait_square_100.jpg b/tests/TransitionTests/res/drawable-nodpi/self_portrait_square_100.jpg Binary files differnew file mode 100644 index 0000000..26c0a85 --- /dev/null +++ b/tests/TransitionTests/res/drawable-nodpi/self_portrait_square_100.jpg diff --git a/tests/TransitionTests/res/drawable-nodpi/self_portrait_square_200.jpg b/tests/TransitionTests/res/drawable-nodpi/self_portrait_square_200.jpg Binary files differnew file mode 100644 index 0000000..f18ae5b --- /dev/null +++ b/tests/TransitionTests/res/drawable-nodpi/self_portrait_square_200.jpg diff --git a/tests/TransitionTests/res/drawable-nodpi/self_portrait_square_400.jpg b/tests/TransitionTests/res/drawable-nodpi/self_portrait_square_400.jpg Binary files differnew file mode 100644 index 0000000..3923fd1 --- /dev/null +++ b/tests/TransitionTests/res/drawable-nodpi/self_portrait_square_400.jpg diff --git a/tests/TransitionTests/res/layout/activity_login.xml b/tests/TransitionTests/res/layout/activity_login.xml new file mode 100644 index 0000000..2aaafc0 --- /dev/null +++ b/tests/TransitionTests/res/layout/activity_login.xml @@ -0,0 +1,86 @@ +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <TextView + android:id="@+id/password" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignRight="@+id/username" + android:layout_below="@+id/username" + android:layout_marginTop="30dp" + android:textColor="#7f7f7f" + android:text="@string/password" + android:textAppearance="?android:attr/textAppearanceLarge" /> + + <EditText + android:id="@+id/usernameEdit" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignTop="@+id/username" + android:layout_marginLeft="14dp" + android:layout_toRightOf="@+id/username" + android:ems="10" /> + + <TextView + android:id="@+id/username" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_alignParentTop="true" + android:layout_marginLeft="20dp" + android:layout_marginTop="51dp" + android:text="@string/username" + android:textAppearance="?android:attr/textAppearanceLarge" /> + + <EditText + android:id="@+id/passwordEdit" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignBaseline="@+id/password" + android:layout_alignBottom="@+id/password" + android:layout_alignLeft="@+id/usernameEdit" + android:layout_alignParentRight="true" + android:editable="false" + android:ems="10" > + + <requestFocus /> + </EditText> + + <Button + android:id="@+id/cancel" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + android:layout_marginBottom="14dp" + android:layout_toLeftOf="@+id/passwordEdit" + android:onClick="sendMessage" + android:text="@string/cancel" /> + + <Button + android:id="@+id/submit" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignBaseline="@+id/cancel" + android:layout_alignBottom="@+id/cancel" + android:layout_alignLeft="@+id/passwordEdit" + android:layout_marginLeft="41dp" + android:onClick="sendMessage" + android:text="@string/submit" /> + + <TextView + android:id="@+id/newuser" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@+id/passwordEdit" + android:layout_centerHorizontal="true" + android:layout_marginTop="16dp" + android:textColor="#0000ff" + android:text="@string/new_user" + android:clickable="true" + android:onClick="sendMessage" + android:textAppearance="?android:attr/textAppearanceMedium" + android:textStyle="italic" /> + +</RelativeLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/button_template.xml b/tests/TransitionTests/res/layout/button_template.xml new file mode 100644 index 0000000..9b867f2 --- /dev/null +++ b/tests/TransitionTests/res/layout/button_template.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> + +<Button xmlns:android="http://schemas.android.com/apk/res/android" + android:onClick="sendMessage" + android:id="@+id/button" + android:layout_width="wrap_content" + android:layout_height="wrap_content"> + +</Button>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/changing_text_1.xml b/tests/TransitionTests/res/layout/changing_text_1.xml new file mode 100644 index 0000000..88086a3 --- /dev/null +++ b/tests/TransitionTests/res/layout/changing_text_1.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/submit" + android:onClick="sendMessage" + android:id="@+id/sceneSwitchButton"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/shortText1" + android:background="#8f8f8f" + android:id="@+id/textview1"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/buttona" + android:text="@string/button"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/longText1" + android:background="#8f8f8f" + android:id="@+id/textview2"/> + + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/buttonb" + android:text="@string/button"/> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/changing_text_2.xml b/tests/TransitionTests/res/layout/changing_text_2.xml new file mode 100644 index 0000000..91fdfef --- /dev/null +++ b/tests/TransitionTests/res/layout/changing_text_2.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/submit" + android:onClick="sendMessage" + android:id="@+id/sceneSwitchButton"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/longText2" + android:background="#8f8f8f" + android:id="@+id/textview1"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/buttona" + android:text="@string/button"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/shortText2" + android:background="#8f8f8f" + android:id="@+id/textview2"/> + + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/buttonb" + android:text="@string/button"/> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/clipping_text_1.xml b/tests/TransitionTests/res/layout/clipping_text_1.xml new file mode 100644 index 0000000..5fe45ab --- /dev/null +++ b/tests/TransitionTests/res/layout/clipping_text_1.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/submit" + android:onClick="sendMessage" + android:id="@+id/sceneSwitchButton"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/shortText1" + android:background="#8f8f8f" + android:id="@+id/textview1"/> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/clipping_text_2.xml b/tests/TransitionTests/res/layout/clipping_text_2.xml new file mode 100644 index 0000000..3a0e3f4 --- /dev/null +++ b/tests/TransitionTests/res/layout/clipping_text_2.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <Button + android:layout_width="500dip" + android:layout_height="wrap_content" + android:text="@string/submit" + android:onClick="sendMessage" + android:id="@+id/sceneSwitchButton"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/longText2" + android:background="#8f8f8f" + android:id="@+id/textview1"/> +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/contact_collapsed.xml b/tests/TransitionTests/res/layout/contact_collapsed.xml new file mode 100644 index 0000000..bfa97df --- /dev/null +++ b/tests/TransitionTests/res/layout/contact_collapsed.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="horizontal" + android:background="#fff" + android:layout_width="fill_parent" + android:id="@+id/topContainer" + android:layout_height="wrap_content"> + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/contact_arrow" + android:src="@drawable/arrow_thumbnail"/> + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/contact_picture"/> + <LinearLayout android:orientation="vertical" + android:layout_width="0dip" + android:id="@+id/itemContainer" + android:background="#ccc" + android:layout_weight="1" + android:layout_height="wrap_content"> + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:id="@+id/contact_name"/> + <LinearLayout android:orientation="vertical" + android:visibility="gone" + android:id="@+id/expanded_info" + android:layout_width="wrap_content" + android:layout_height="wrap_content"> + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:id="@+id/contact_street"/> + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:id="@+id/contact_city"/> + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:id="@+id/contact_phone"/> + <TextView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:id="@+id/contact_email"/> + </LinearLayout> + </LinearLayout> +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/contact_expanded.xml b/tests/TransitionTests/res/layout/contact_expanded.xml new file mode 100644 index 0000000..4007d4a --- /dev/null +++ b/tests/TransitionTests/res/layout/contact_expanded.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="horizontal" + android:background="#fff" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/contact_arrow" + android:src="@drawable/arrow_thumbnail"/> + <LinearLayout android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:id="@+id/contact_name"/> + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:id="@+id/contact_street"/> + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:id="@+id/contact_city"/> + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:id="@+id/contact_phone"/> + <TextView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:id="@+id/contact_email"/> + </LinearLayout> + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/contact_picture"/> +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/contacts_list.xml b/tests/TransitionTests/res/layout/contacts_list.xml new file mode 100644 index 0000000..d38704c --- /dev/null +++ b/tests/TransitionTests/res/layout/contacts_list.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:id="@+id/contactsContainer" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + + + +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/crossfade.xml b/tests/TransitionTests/res/layout/crossfade.xml new file mode 100644 index 0000000..d766ce1 --- /dev/null +++ b/tests/TransitionTests/res/layout/crossfade.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:id="@+id/container"> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:onClick="sendMessage" + android:id="@+id/button"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/shortText1" + android:id="@+id/textview"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/longText1" + android:id="@+id/textview1"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/someText" + android:id="@+id/textview2"/> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/crossfade_1.xml b/tests/TransitionTests/res/layout/crossfade_1.xml new file mode 100644 index 0000000..4cc5bc9 --- /dev/null +++ b/tests/TransitionTests/res/layout/crossfade_1.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:id="@+id/container"> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:onClick="sendMessage" + android:id="@+id/button"/> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/shortText2" + android:id="@+id/textview"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/longText2" + android:id="@+id/textview1"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/someText" + android:id="@+id/textview2"/> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/crossfade_image.xml b/tests/TransitionTests/res/layout/crossfade_image.xml new file mode 100644 index 0000000..c46327a --- /dev/null +++ b/tests/TransitionTests/res/layout/crossfade_image.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/self_portrait_square_100" + android:onClick="sendMessage" + android:id="@+id/contact_picture"/> + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/self_portrait_square_100" + android:onClick="sendMessage" + android:id="@+id/contact_picture1"/> + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/self_portrait_square_100" + android:onClick="sendMessage" + android:id="@+id/contact_picture2"/> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/crossfade_multiple.xml b/tests/TransitionTests/res/layout/crossfade_multiple.xml new file mode 100644 index 0000000..ca32ecb --- /dev/null +++ b/tests/TransitionTests/res/layout/crossfade_multiple.xml @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <RadioGroup android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + <RadioButton android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:onClick="changeTransitionType" + android:id="@+id/reveal" + android:text="@string/reveal"/> + <RadioButton android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:onClick="changeTransitionType" + android:id="@+id/crossfade" + android:text="@string/crossfade"/> + <RadioButton android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:onClick="changeTransitionType" + android:id="@+id/inout" + android:text="@string/inout"/> + <RadioButton android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:onClick="changeTransitionType" + android:id="@+id/textfade1" + android:text="@string/textfade1"/> + <RadioButton android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:onClick="changeTransitionType" + android:id="@+id/textfade2" + android:text="@string/textfade2"/> + </RadioGroup> + <LinearLayout android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:onClick="sendMessage" + android:text="@string/state1" + android:id="@+id/button1"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:onClick="sendMessage" + android:text="@string/state2" + android:id="@+id/button2"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:onClick="sendMessage" + android:text="@string/state3" + android:id="@+id/button3"/> + </LinearLayout> + + <LinearLayout android:orientation="vertical" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent"> + <Button + android:layout_width="100dip" + android:layout_height="100dip" + android:textSize="40dip" + android:text="@string/a" + android:id="@+id/button"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textSize="40dip" + android:text="@string/state1" + android:id="@+id/textview"/> + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/self_portrait_square_100" + android:onClick="sendMessage" + android:id="@+id/imageview"/> + </LinearLayout> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/fading_hierarchy.xml b/tests/TransitionTests/res/layout/fading_hierarchy.xml new file mode 100644 index 0000000..a24a6b6 --- /dev/null +++ b/tests/TransitionTests/res/layout/fading_hierarchy.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/submit" + android:onClick="sendMessage" + android:id="@+id/sceneSwitchButton"/> + <LinearLayout + android:orientation="horizontal" + android:layout_width="wrap_content" + android:layout_height="wrap_content"> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/button"/> + <LinearLayout + android:orientation="vertical" + android:id="@+id/removingContainer" + android:layout_width="wrap_content" + android:layout_height="200dip"> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/removingButton" + android:id="@+id/removingButton"/> + </LinearLayout> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/button"/> + </LinearLayout> +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/fading_test.xml b/tests/TransitionTests/res/layout/fading_test.xml new file mode 100644 index 0000000..3728b5e --- /dev/null +++ b/tests/TransitionTests/res/layout/fading_test.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/submit" + android:onClick="sendMessage" + android:id="@+id/sceneSwitchButton"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/removingButton" + android:id="@+id/removingButton"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/invisibleButton" + android:id="@+id/invisibleButton"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/goneButton" + android:id="@+id/goneButton"/> + + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/button" + android:text="@string/button"/> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/fading_test_scene_2.xml b/tests/TransitionTests/res/layout/fading_test_scene_2.xml new file mode 100644 index 0000000..baf5b4d --- /dev/null +++ b/tests/TransitionTests/res/layout/fading_test_scene_2.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/submit" + android:onClick="sendMessage" + android:id="@+id/sceneSwitchButton"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/invisibleButton" + android:visibility="invisible" + android:id="@+id/invisibleButton"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/goneButton" + android:visibility="gone" + android:id="@+id/goneButton"/> + + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/button" + android:text="@string/button"/> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/fading_test_simple.xml b/tests/TransitionTests/res/layout/fading_test_simple.xml new file mode 100644 index 0000000..d201eca --- /dev/null +++ b/tests/TransitionTests/res/layout/fading_test_simple.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/submit" + android:onClick="sendMessage" + android:id="@+id/sceneSwitchButton"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/removingButton" + android:id="@+id/removingButton"/> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/fading_test_simple2.xml b/tests/TransitionTests/res/layout/fading_test_simple2.xml new file mode 100644 index 0000000..80f3f94 --- /dev/null +++ b/tests/TransitionTests/res/layout/fading_test_simple2.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginLeft="50dip" + android:text="@string/submit" + android:onClick="sendMessage" + android:id="@+id/sceneSwitchButton"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/removingButton" + android:visibility="invisible" + android:id="@+id/removingButton"/> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/hierarchical_move.xml b/tests/TransitionTests/res/layout/hierarchical_move.xml new file mode 100644 index 0000000..1e70ba9 --- /dev/null +++ b/tests/TransitionTests/res/layout/hierarchical_move.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/submit" + android:onClick="sendMessage" + android:id="@+id/sceneSwitchButton"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/button0" + android:id="@+id/button0"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/button1" + android:id="@+id/button1"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/button2" + android:id="@+id/button2"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/button3" + android:id="@+id/button3"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/button4" + android:id="@+id/button4"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/button5" + android:id="@+id/button5"/> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/incorrect_password.xml b/tests/TransitionTests/res/layout/incorrect_password.xml new file mode 100644 index 0000000..af59618 --- /dev/null +++ b/tests/TransitionTests/res/layout/incorrect_password.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent" > + + <Button + android:id="@+id/okay" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + android:layout_centerHorizontal="true" + android:layout_marginBottom="164dp" + android:onClick="sendMessage" + android:text="@string/okay" /> + + <TextView + android:id="@+id/incorrectpassword" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_above="@+id/okay" + android:layout_centerHorizontal="true" + android:layout_marginBottom="93dp" + android:text="@string/incorrect_password" + android:textAppearance="?android:attr/textAppearanceLarge" /> + + <TextView + android:id="@+id/tryagain" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignTop="@+id/incorrectpassword" + android:layout_centerHorizontal="true" + android:layout_marginTop="35dp" + android:text="@string/try_again" + android:textAppearance="?android:attr/textAppearanceLarge" /> + +</RelativeLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/instance_targets.xml b/tests/TransitionTests/res/layout/instance_targets.xml new file mode 100644 index 0000000..5677d52 --- /dev/null +++ b/tests/TransitionTests/res/layout/instance_targets.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> + +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:id="@+id/container"> + + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:onClick="sendMessage" + android:id="@+id/button0"/> + + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@+id/button0" + android:onClick="sendMessage" + android:id="@+id/button1"/> + + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@+id/button1" + android:onClick="sendMessage" + android:id="@+id/button2"/> + + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@+id/button2" + android:onClick="sendMessage" + android:id="@+id/button3"/> + + +</RelativeLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/interruption.xml b/tests/TransitionTests/res/layout/interruption.xml new file mode 100644 index 0000000..9fdb27a --- /dev/null +++ b/tests/TransitionTests/res/layout/interruption.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <RadioGroup android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + <RadioButton android:id="@+id/scene1RB" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/state1" + android:onClick="onRadioButtonClicked"/> + <RadioButton android:id="@+id/scene2RB" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/state2" + android:onClick="onRadioButtonClicked"/> + <RadioButton android:id="@+id/scene3RB" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/state3" + android:onClick="onRadioButtonClicked"/> + <RadioButton android:id="@+id/scene4RB" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/state4" + android:onClick="onRadioButtonClicked"/> + </RadioGroup> + + <LinearLayout + android:orientation="vertical" + android:id="@+id/sceneRoot" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <include layout="@layout/interruption_inner_1"/> + + </LinearLayout> + + +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/interruption_inner_1.xml b/tests/TransitionTests/res/layout/interruption_inner_1.xml new file mode 100644 index 0000000..f82dfb0 --- /dev/null +++ b/tests/TransitionTests/res/layout/interruption_inner_1.xml @@ -0,0 +1,20 @@ +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:id="@+id/buttonContainer"> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/button" + android:layout_alignParentTop="true" + android:layout_alignParentLeft="true" + android:text="@string/state1"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/button1" + android:layout_alignLeft="@+id/button" + android:layout_below="@+id/button" + android:text="@string/state1"/> + +</RelativeLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/interruption_inner_2.xml b/tests/TransitionTests/res/layout/interruption_inner_2.xml new file mode 100644 index 0000000..e6821d6 --- /dev/null +++ b/tests/TransitionTests/res/layout/interruption_inner_2.xml @@ -0,0 +1,20 @@ +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:id="@+id/buttonContainer"> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentTop="true" + android:id="@+id/button" + android:layout_alignParentRight="true" + android:text="@string/state2"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/button1" + android:layout_alignLeft="@+id/button" + android:layout_below="@+id/button" + android:text="@string/state2"/> + +</RelativeLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/interruption_inner_3.xml b/tests/TransitionTests/res/layout/interruption_inner_3.xml new file mode 100644 index 0000000..4e40150 --- /dev/null +++ b/tests/TransitionTests/res/layout/interruption_inner_3.xml @@ -0,0 +1,20 @@ +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:id="@+id/buttonContainer"> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/button" + android:layout_alignParentBottom="true" + android:layout_alignParentLeft="true" + android:text="@string/state3"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/button1" + android:layout_alignLeft="@+id/button" + android:layout_above="@+id/button" + android:text="@string/state3"/> + +</RelativeLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/interruption_inner_4.xml b/tests/TransitionTests/res/layout/interruption_inner_4.xml new file mode 100644 index 0000000..8c3661e --- /dev/null +++ b/tests/TransitionTests/res/layout/interruption_inner_4.xml @@ -0,0 +1,20 @@ +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:id="@+id/buttonContainer"> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/button" + android:layout_alignParentBottom="true" + android:layout_alignParentRight="true" + android:text="@string/state4"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/button1" + android:layout_alignLeft="@+id/button" + android:layout_above="@+id/button" + android:text="@string/state4"/> + +</RelativeLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/list_view_add_remove.xml b/tests/TransitionTests/res/layout/list_view_add_remove.xml new file mode 100644 index 0000000..230511f --- /dev/null +++ b/tests/TransitionTests/res/layout/list_view_add_remove.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <ListView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:id="@+id/listview"/> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/login_password.xml b/tests/TransitionTests/res/layout/login_password.xml new file mode 100644 index 0000000..1e75694 --- /dev/null +++ b/tests/TransitionTests/res/layout/login_password.xml @@ -0,0 +1,86 @@ +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".LoginActivity" > + + <TextView + android:id="@+id/password" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignRight="@+id/username" + android:layout_below="@+id/username" + android:layout_marginTop="30dp" + android:text="@string/password" + android:textAppearance="?android:attr/textAppearanceLarge" /> + + <EditText + android:id="@+id/usernameEdit" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignTop="@+id/username" + android:layout_marginLeft="14dp" + android:layout_toRightOf="@+id/username" + android:ems="10" /> + + <TextView + android:id="@+id/username" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_alignParentTop="true" + android:layout_marginLeft="20dp" + android:layout_marginTop="51dp" + android:text="@string/username" + android:textAppearance="?android:attr/textAppearanceLarge" /> + + <EditText + android:id="@+id/passwordEdit" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignBaseline="@+id/password" + android:layout_alignBottom="@+id/password" + android:layout_alignLeft="@+id/usernameEdit" + android:layout_alignParentRight="true" + android:ems="10" > + + <requestFocus /> + </EditText> + + <Button + android:id="@+id/cancel" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + android:layout_marginBottom="14dp" + android:layout_toLeftOf="@+id/passwordEdit" + android:onClick="sendMessage" + android:text="@string/cancel" /> + + <Button + android:id="@+id/submit" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignBaseline="@+id/cancel" + android:layout_alignBottom="@+id/cancel" + android:layout_alignLeft="@+id/passwordEdit" + android:layout_marginLeft="41dp" + android:onClick="sendMessage" + android:text="@string/submit" /> + + <TextView + android:id="@+id/newuser" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@+id/passwordEdit" + android:layout_centerHorizontal="true" + android:layout_marginTop="16dp" + android:textColor="#0000ff" + android:text="@string/new_user" + android:clickable="true" + android:onClick="sendMessage" + android:textAppearance="?android:attr/textAppearanceMedium" + android:textStyle="italic" /> + +</RelativeLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/main.xml b/tests/TransitionTests/res/layout/main.xml new file mode 100644 index 0000000..b42318e --- /dev/null +++ b/tests/TransitionTests/res/layout/main.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:id="@+id/container"> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/button"/> +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/new_user.xml b/tests/TransitionTests/res/layout/new_user.xml new file mode 100644 index 0000000..f8dfab0 --- /dev/null +++ b/tests/TransitionTests/res/layout/new_user.xml @@ -0,0 +1,92 @@ +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:id="@+id/container" + tools:context=".LoginActivity" > + + <TextView + android:id="@+id/password" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignRight="@+id/username" + android:layout_below="@+id/username" + android:layout_marginTop="30dp" + android:text="@string/password" + android:textAppearance="?android:attr/textAppearanceLarge" /> + + <EditText + android:id="@+id/usernameEdit" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignTop="@+id/username" + android:layout_marginLeft="14dp" + android:layout_toRightOf="@+id/username" + android:ems="10" /> + + <TextView + android:id="@+id/username" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_alignParentTop="true" + android:layout_marginLeft="20dp" + android:layout_marginTop="51dp" + android:text="@string/username" + android:textAppearance="?android:attr/textAppearanceLarge" /> + + <EditText + android:id="@+id/passwordEdit" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignBaseline="@+id/password" + android:layout_alignBottom="@+id/password" + android:layout_alignLeft="@+id/usernameEdit" + android:layout_alignParentRight="true" + android:ems="10" > + + <requestFocus /> + </EditText> + + <Button + android:id="@+id/cancel" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + android:layout_marginBottom="14dp" + android:layout_toLeftOf="@+id/passwordEdit" + android:onClick="sendMessage" + android:text="@string/cancel" /> + + <Button + android:id="@+id/submit" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignBaseline="@+id/cancel" + android:layout_alignBottom="@+id/cancel" + android:layout_alignLeft="@+id/passwordEdit" + android:layout_marginLeft="41dp" + android:onClick="sendMessage" + android:text="@string/submit" /> + + <EditText + android:id="@+id/retypeEdit" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignBaseline="@+id/retype" + android:layout_alignBottom="@+id/retype" + android:layout_alignLeft="@+id/passwordEdit" + android:layout_alignParentRight="true" + android:ems="10" /> + + <TextView + android:id="@+id/retype" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@+id/passwordEdit" + android:layout_marginTop="26dp" + android:layout_toLeftOf="@+id/usernameEdit" + android:text="@string/retype" + android:textAppearance="?android:attr/textAppearanceLarge" /> + +</RelativeLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/overlay_test.xml b/tests/TransitionTests/res/layout/overlay_test.xml new file mode 100644 index 0000000..edd0393 --- /dev/null +++ b/tests/TransitionTests/res/layout/overlay_test.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:id="@+id/container" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/button" + android:text="@string/start" + android:onClick="onClick"/> + + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/fadingButton" + android:id="@+id/fadingButton"/> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/reparenting.xml b/tests/TransitionTests/res/layout/reparenting.xml new file mode 100644 index 0000000..b3bfbb9 --- /dev/null +++ b/tests/TransitionTests/res/layout/reparenting.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:id="@+id/container"> + <LinearLayout + android:orientation="horizontal" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/container1"/> + <LinearLayout + android:orientation="vertical" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/container2"/> +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/resources_test_layout.xml b/tests/TransitionTests/res/layout/resources_test_layout.xml new file mode 100644 index 0000000..48affa0 --- /dev/null +++ b/tests/TransitionTests/res/layout/resources_test_layout.xml @@ -0,0 +1,3 @@ +<?xml version="1.0" encoding="utf-8"?> +<ImageView + src="@drawable/icon"/>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/results_screen.xml b/tests/TransitionTests/res/layout/results_screen.xml new file mode 100644 index 0000000..8550a5e --- /dev/null +++ b/tests/TransitionTests/res/layout/results_screen.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:background="#7f7f7f" + android:id="@+id/container"> + <LinearLayout android:orientation="horizontal" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="top|right" + android:id="@+id/searchContainer"> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/searchText" + android:id="@+id/searchText"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/searchButton" + android:onClick="sendMessage" + android:id="@+id/searchButton"/> + </LinearLayout> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:text="@string/resultsTitle" + android:id="@+id/resultsText"/> + <LinearLayout android:layout_width="match_parent" + android:layout_height="0dip" + android:layout_weight="1" + android:orientation="vertical" + android:id="@+id/resultsList"> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/placeholder"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/placeholder"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/placeholder"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/placeholder"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/placeholder"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/placeholder"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/placeholder"/> + + </LinearLayout> +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/search_screen.xml b/tests/TransitionTests/res/layout/search_screen.xml new file mode 100644 index 0000000..947702b --- /dev/null +++ b/tests/TransitionTests/res/layout/search_screen.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:background="#000000" + android:id="@+id/container"> + <LinearLayout android:orientation="horizontal" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:id="@+id/searchContainer"> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/searchText" + android:id="@+id/searchText"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/searchButton" + android:onClick="sendMessage" + android:id="@+id/searchButton"/> + </LinearLayout> +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/success.xml b/tests/TransitionTests/res/layout/success.xml new file mode 100644 index 0000000..9c265ef --- /dev/null +++ b/tests/TransitionTests/res/layout/success.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent" > + + <TextView + android:id="@+id/loginsuccessful" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerHorizontal="true" + android:layout_marginBottom="93dp" + android:text="@string/login_successful" + android:textAppearance="?android:attr/textAppearanceLarge" /> + + <TextView + android:id="@+id/firstactivityscreen" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignTop="@+id/loginsuccessful" + android:layout_centerHorizontal="true" + android:layout_marginTop="35dp" + android:text="@string/first_activity_screen" + android:textAppearance="?android:attr/textAppearanceLarge" /> + + <Button + android:id="@+id/reset" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + android:layout_centerHorizontal="true" + android:layout_marginBottom="164dp" + android:onClick="sendMessage" + android:text="@string/reset" /> + +</RelativeLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/surface_texture_views.xml b/tests/TransitionTests/res/layout/surface_texture_views.xml new file mode 100644 index 0000000..9260bc0 --- /dev/null +++ b/tests/TransitionTests/res/layout/surface_texture_views.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <Button + android:text="@string/toggle" + android:id="@+id/toggleButton" + android:layout_width="wrap_content" + android:layout_height="wrap_content"/> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/two_buttons.xml b/tests/TransitionTests/res/layout/two_buttons.xml new file mode 100644 index 0000000..23d59f8 --- /dev/null +++ b/tests/TransitionTests/res/layout/two_buttons.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:id="@+id/container"> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/button1"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/button2"/> +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/unique_id_test.xml b/tests/TransitionTests/res/layout/unique_id_test.xml new file mode 100644 index 0000000..9b7eb10 --- /dev/null +++ b/tests/TransitionTests/res/layout/unique_id_test.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent"> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/layout/username_taken.xml b/tests/TransitionTests/res/layout/username_taken.xml new file mode 100644 index 0000000..9484e69 --- /dev/null +++ b/tests/TransitionTests/res/layout/username_taken.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent" > + + <Button + android:id="@+id/okay" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + android:layout_centerHorizontal="true" + android:layout_marginBottom="164dp" + android:onClick="sendMessage" + android:text="@string/okay" /> + + <TextView + android:id="@+id/usernametaken" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_above="@+id/okay" + android:layout_centerHorizontal="true" + android:layout_marginBottom="93dp" + android:text="@string/username_taken" + android:textAppearance="?android:attr/textAppearanceLarge" /> + + <TextView + android:id="@+id/textView2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignTop="@+id/usernametaken" + android:layout_centerHorizontal="true" + android:layout_marginTop="35dp" + android:text="@string/try_again" + android:textAppearance="?android:attr/textAppearanceLarge" /> + +</RelativeLayout>
\ No newline at end of file diff --git a/tests/TransitionTests/res/transition/colorizer_transition.xml b/tests/TransitionTests/res/transition/colorizer_transition.xml new file mode 100644 index 0000000..12f4be7 --- /dev/null +++ b/tests/TransitionTests/res/transition/colorizer_transition.xml @@ -0,0 +1,6 @@ +<recolor xmlns:android="http://schemas.android.com/apk/res/android"> + <targets> + <target android:targetId="@id/password"/> + <target android:targetId="@id/passwordEdit"/> + </targets> +</recolor>
\ No newline at end of file diff --git a/tests/TransitionTests/res/transition/fader.xml b/tests/TransitionTests/res/transition/fader.xml new file mode 100644 index 0000000..c71fd94 --- /dev/null +++ b/tests/TransitionTests/res/transition/fader.xml @@ -0,0 +1 @@ +<fade/>
\ No newline at end of file diff --git a/tests/TransitionTests/res/transition/login_slider_transition.xml b/tests/TransitionTests/res/transition/login_slider_transition.xml new file mode 100644 index 0000000..2317857 --- /dev/null +++ b/tests/TransitionTests/res/transition/login_slider_transition.xml @@ -0,0 +1,22 @@ +<transitionSet xmlns:android="http://schemas.android.com/apk/res/android"> + <slide> + <targets> + <target android:targetId="@id/retype"/> + <target android:targetId="@id/retypeEdit"/> + </targets> + </slide> + <recolor> + <targets> + <target android:targetId="@id/password"/> + <target android:targetId="@id/passwordEdit"/> + </targets> + </recolor> + <fade/> +</transitionSet> + +<!-- + TransitionSet slider = new TransitionSet(); + slider.addTransition(new Slide(R.id.retype, R.id.retypeEdit)); + slider.addTransition(new Recolor(R.id.password, R.id.passwordEdit)); + slider.addTransition(new Fade()); +-->
\ No newline at end of file diff --git a/tests/TransitionTests/res/transition/login_transition_mgr.xml b/tests/TransitionTests/res/transition/login_transition_mgr.xml new file mode 100644 index 0000000..5d07be0 --- /dev/null +++ b/tests/TransitionTests/res/transition/login_transition_mgr.xml @@ -0,0 +1,14 @@ +<transitionManager xmlns:android="http://schemas.android.com/apk/res/android"> + <transition android:fromScene="@layout/activity_login" android:toScene="@layout/new_user" + android:transition="@transition/login_slider_transition"/> + <transition android:fromScene="@layout/login_password" android:toScene="@layout/new_user" + android:transition="@transition/login_slider_transition"/> + <transition android:fromScene="@layout/new_user" android:toScene="@layout/activity_login" + android:transition="@transition/login_slider_transition"/> + <transition android:fromScene="@layout/new_user" android:toScene="@layout/login_password" + android:transition="@transition/login_slider_transition"/> + <transition android:fromScene="@layout/activity_login" android:toScene="@layout/login_password" + android:transition="@transition/colorizer_transition"/> + <transition android:fromScene="@layout/login_password" android:toScene="@layout/activity_login" + android:transition="@transition/colorizer_transition"/> +</transitionManager> diff --git a/tests/TransitionTests/res/transition/mover.xml b/tests/TransitionTests/res/transition/mover.xml new file mode 100644 index 0000000..b23d2a5 --- /dev/null +++ b/tests/TransitionTests/res/transition/mover.xml @@ -0,0 +1 @@ +<changeBounds/>
\ No newline at end of file diff --git a/tests/TransitionTests/res/transition/mover_fader.xml b/tests/TransitionTests/res/transition/mover_fader.xml new file mode 100644 index 0000000..ef11676 --- /dev/null +++ b/tests/TransitionTests/res/transition/mover_fader.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<transitionSet xmlns:android="http://schemas.android.com/apk/res/android"> + <fade/> + <changeBounds/> +</transitionSet>
\ No newline at end of file diff --git a/tests/TransitionTests/res/transition/my_scene.xml b/tests/TransitionTests/res/transition/my_scene.xml new file mode 100644 index 0000000..b8278c9 --- /dev/null +++ b/tests/TransitionTests/res/transition/my_scene.xml @@ -0,0 +1,3 @@ +<scene > + +</scene>
\ No newline at end of file diff --git a/tests/TransitionTests/res/transition/my_transition.xml b/tests/TransitionTests/res/transition/my_transition.xml new file mode 100644 index 0000000..022313c --- /dev/null +++ b/tests/TransitionTests/res/transition/my_transition.xml @@ -0,0 +1,20 @@ +<transitionSet xmlns:android="http://schemas.android.com/apk/res/android"> + <fade></fade> + <transitionSet> + <changeBounds android:duration="500"> + <targets> + <target android:targetId="@id/container"/> + <target android:targetId="@id/resultsList"/> + </targets> + </changeBounds> + <transitionSet> + <targets> + <target android:targetId="@id/container"/> + <target android:targetId="@id/resultsList"/> + </targets> + <fade android:startOffset="25"/> + </transitionSet> + <recolor/> + </transitionSet> + <changeBounds/> +</transitionSet>
\ No newline at end of file diff --git a/tests/TransitionTests/res/transition/my_transition_mgr.xml b/tests/TransitionTests/res/transition/my_transition_mgr.xml new file mode 100644 index 0000000..5d8f799 --- /dev/null +++ b/tests/TransitionTests/res/transition/my_transition_mgr.xml @@ -0,0 +1,6 @@ +<transitionManager xmlns:android="http://schemas.android.com/apk/res/android"> + <transition android:fromScene="@layout/search_screen" android:toScene="@layout/results_screen" + android:transition="@transition/mover_fader"/> + <transition android:fromScene="@layout/results_screen" android:toScene="@layout/search_screen" + android:transition="@transition/mover_fader"/> +</transitionManager>
\ No newline at end of file diff --git a/tests/TransitionTests/res/transition/username_taken_scene.xml b/tests/TransitionTests/res/transition/username_taken_scene.xml new file mode 100644 index 0000000..b2f050e --- /dev/null +++ b/tests/TransitionTests/res/transition/username_taken_scene.xml @@ -0,0 +1,2 @@ +<scene xmlns:android="http://schemas.android.com/apk/res/android" + android:layout="@layout/username_taken"/>
\ No newline at end of file diff --git a/tests/TransitionTests/res/values-v11/styles.xml b/tests/TransitionTests/res/values-v11/styles.xml new file mode 100644 index 0000000..541752f --- /dev/null +++ b/tests/TransitionTests/res/values-v11/styles.xml @@ -0,0 +1,11 @@ +<resources> + + <!-- + Base application theme for API 11+. This theme completely replaces + AppBaseTheme from res/values/styles.xml on API 11+ devices. + --> + <style name="AppBaseTheme" parent="android:Theme.Holo.Light"> + <!-- API 11 theme customizations can go here. --> + </style> + +</resources>
\ No newline at end of file diff --git a/tests/TransitionTests/res/values-v14/styles.xml b/tests/TransitionTests/res/values-v14/styles.xml new file mode 100644 index 0000000..f20e015 --- /dev/null +++ b/tests/TransitionTests/res/values-v14/styles.xml @@ -0,0 +1,12 @@ +<resources> + + <!-- + Base application theme for API 14+. This theme completely replaces + AppBaseTheme from BOTH res/values/styles.xml and + res/values-v11/styles.xml on API 14+ devices. + --> + <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar"> + <!-- API 14 theme customizations can go here. --> + </style> + +</resources>
\ No newline at end of file diff --git a/tests/TransitionTests/res/values/strings.xml b/tests/TransitionTests/res/values/strings.xml new file mode 100644 index 0000000..9cf7a94 --- /dev/null +++ b/tests/TransitionTests/res/values/strings.xml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="app_name">StatesTest</string> + <string name="states_test1">StatesTestv21</string> + <string name="states_test_auto_targets">StatesTestAutoTargets</string> + <string name="states_test_auto_transition">StatesTestAutoTransition</string> + <string name="states_test_auto_transition2">StatesTestAutoTransition2</string> + <string name="contacts_expansion">ContactsExpansion</string> + <string name="states_test3">StatesTest3</string> + <string name="states_test4">StatesTest4</string> + <string name="states_test5">StatesTest5</string> + <string name="states_test6">StatesTest6</string> + <string name="button">Button</string> + <string name="searchButton">Search</string> + <string name="searchText">This is some text</string> + <string name="resultsTitle">Search Results</string> + <string name="placeholder">Blah Blah Blah</string> + <string name="username">Username:</string> + <string name="password">Password:</string> + <string name="retype">Retype:</string> + <string name="new_user">New User?</string> + <string name="incorrect_password">Incorrect password:</string> + <string name="try_again">Please try again.</string> + <string name="login_successful">Success!</string> + <string name="first_activity_screen">First activity screen</string> + <string name="username_taken">Username taken:</string> + <string name="cancel">Cancel</string> + <string name="submit">Submit</string> + <string name="okay">Okay</string> + <string name="reset">Reset</string> + <string name="fadingButton">Fading Button</string> + <string name="removingButton">Removing Button</string> + <string name="invisibleButton">invisible Button</string> + <string name="goneButton">Gone Button</string> + <string name="start">Start</string> + <string name="toggle">Toggle State</string> + <string name="someText">This is some text</string> + <string name="shortText1">This is some short text</string> + <string name="shortText2">Not much text here</string> + <string name="longText1">This is the beginning of the Spring of my discontent. In the event of a real emergency, you would be notified by email. Fear not, for death comes swiftly.</string> + <string name="longText2">When do we get to eat? I like all things, especially following strong leaders, and mangy cats. Break glass in emergency. The purpose of a framework is to provide the facilities and functionality of a powerful toolkit with the simplicity of a refrigerator.</string> + <string name="state1">State 1</string> + <string name="state2">State 2</string> + <string name="state3">State 3</string> + <string name="state4">State 4</string> + <string name="button0">Button 0</string> + <string name="button1">Button 1</string> + <string name="button2">Button 2</string> + <string name="button3">Button 3</string> + <string name="button4">Button 4</string> + <string name="button5">Button 5</string> + <string name="a">A</string> + <string name="b">B</string> + <string name="c">C</string> + <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> +</resources> diff --git a/tests/TransitionTests/res/values/styles.xml b/tests/TransitionTests/res/values/styles.xml new file mode 100644 index 0000000..4a10ca4 --- /dev/null +++ b/tests/TransitionTests/res/values/styles.xml @@ -0,0 +1,20 @@ +<resources> + + <!-- + Base application theme, dependent on API level. This theme is replaced + by AppBaseTheme from res/values-vXX/styles.xml on newer devices. + --> + <style name="AppBaseTheme" parent="android:Theme.Light"> + <!-- + Theme customizations available in newer API levels can go in + res/values-vXX/styles.xml, while customizations related to + backward-compatibility can go here. + --> + </style> + + <!-- Application theme. --> + <style name="AppTheme" parent="AppBaseTheme"> + <!-- All customizations that are NOT specific to a particular API-level can go here. --> + </style> + +</resources>
\ No newline at end of file diff --git a/tests/TransitionTests/src/com/android/transitiontests/ChangingText.java b/tests/TransitionTests/src/com/android/transitiontests/ChangingText.java new file mode 100644 index 0000000..a1ddd74 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/ChangingText.java @@ -0,0 +1,61 @@ +/* + * 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.transition.Scene; +import android.transition.TransitionSet; +import android.transition.ChangeBounds; +import android.transition.TextChange; +import android.transition.TransitionManager; + +public class ChangingText extends Activity { + + Scene mScene1, mScene2; + ViewGroup mSceneRoot; + TransitionSet mChanger; + Scene mCurrentScene; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.changing_text_1); + + View container = findViewById(R.id.container); + mSceneRoot = (ViewGroup) container.getParent(); + + mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.changing_text_1, this); + mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.changing_text_2, this); + + mChanger = new TransitionSet().setOrdering(TransitionSet.ORDERING_TOGETHER); + mChanger.addTransition(new ChangeBounds()).addTransition(new TextChange()); + + mCurrentScene = mScene1; + } + + public void sendMessage(View view) { + if (mCurrentScene == mScene1) { + TransitionManager.go(mScene2, mChanger); + mCurrentScene = mScene2; + } else { + TransitionManager.go(mScene1, mChanger); + mCurrentScene = mScene1; + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/ClippingText.java b/tests/TransitionTests/src/com/android/transitiontests/ClippingText.java new file mode 100644 index 0000000..85702fa --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/ClippingText.java @@ -0,0 +1,68 @@ +/* + * 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.transition.ChangeBounds; +import android.view.View; +import android.view.ViewGroup; +import android.transition.Scene; +import android.widget.Button; +import android.transition.Fade; +import android.transition.TextChange; +import android.transition.TransitionSet; +import android.transition.TransitionManager; + +public class ClippingText extends Activity { + + Button mRemovingButton, mInvisibleButton, mGoneButton; + Scene mScene1, mScene2; + ViewGroup mSceneRoot; + // static Fade sFade = new Fade(R.id.removingButton, R.id.invisibleButton, R.id.goneButton); + Fade fader; + TransitionSet mChanger; + Scene mCurrentScene; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.clipping_text_1); + + View container = (View) findViewById(R.id.container); + mSceneRoot = (ViewGroup) container.getParent(); + + mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.clipping_text_1, this); + mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.clipping_text_2, this); + + mChanger = new TransitionSet().setOrdering(TransitionSet.ORDERING_TOGETHER); + ChangeBounds changeBounds = new ChangeBounds(); + changeBounds.setResizeClip(true); + mChanger.addTransition(changeBounds).addTransition(new TextChange()); + + mCurrentScene = mScene1; + } + + public void sendMessage(View view) { + if (mCurrentScene == mScene1) { + TransitionManager.go(mScene2, mChanger); + mCurrentScene = mScene2; + } else { + TransitionManager.go(mScene1, mChanger); + mCurrentScene = mScene1; + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/ContactsExpansion.java b/tests/TransitionTests/src/com/android/transitiontests/ContactsExpansion.java new file mode 100644 index 0000000..f687da3 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/ContactsExpansion.java @@ -0,0 +1,124 @@ +/* + * 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.content.Context; +import android.os.Bundle; +import android.transition.ChangeBounds; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.transition.Fade; +import android.transition.Scene; +import android.transition.Transition; +import android.transition.TransitionSet; +import android.widget.ImageView; +import android.widget.TextView; +import android.transition.Crossfade; +import android.transition.Rotate; +import android.transition.TransitionManager; + +public class ContactsExpansion extends Activity { + + String contactsData[] = { + "Alan Green", "56 Bob Street", "Boston, MA 02134", "617-555-5555", "blatt@blatt.com", + "Bob Foonman", "92 The Avenue", "Chico, CA 78456", "510-555-5556", "bob@jerk.com", + "Tracey Sue", "95 Houses Street", "San Jose, CA 96504", "415-555-5557", "ts@thing.com", + }; + + View currentItem = null; + + TransitionSet mMyAutoTransition = new TransitionSet(). + setOrdering(TransitionSet.ORDERING_SEQUENTIAL); + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.contacts_list); + ViewGroup contactsContainer = (ViewGroup) findViewById(R.id.contactsContainer); + + int contactsIndex = 0; + addContact(contactsContainer, contactsIndex, R.drawable.self_portrait_square_100); + contactsIndex += 5; + addContact(contactsContainer, contactsIndex, R.drawable.self_portrait_square_100); + contactsIndex += 5; + addContact(contactsContainer, contactsIndex, R.drawable.self_portrait_square_100); + + } + + private void addContact(ViewGroup container, int dataIndex, int thumbnailID) { + LayoutInflater inflater = (LayoutInflater) + getSystemService(Context.LAYOUT_INFLATER_SERVICE); + View contactItem = inflater.inflate(R.layout.contact_collapsed, container, false); + ImageView thumbnailView = (ImageView) contactItem.findViewById(R.id.contact_picture); + thumbnailView.setImageResource(thumbnailID); + ((TextView)contactItem.findViewById(R.id.contact_name)).setText(contactsData[dataIndex++]); + ((TextView)contactItem.findViewById(R.id.contact_street)). + setText(contactsData[dataIndex++]); + ((TextView)contactItem.findViewById(R.id.contact_city)).setText(contactsData[dataIndex++]); + ((TextView)contactItem.findViewById(R.id.contact_phone)).setText(contactsData[dataIndex++]); + ((TextView)contactItem.findViewById(R.id.contact_email)).setText(contactsData[dataIndex++]); + container.addView(contactItem); + + final TransitionSet myTransition = new TransitionSet(); + myTransition.addTransition(new Fade(Fade.IN)). + addTransition(new Rotate().addTarget(R.id.contact_arrow)). + addTransition(new ChangeBounds()). + addTransition(new Fade(Fade.OUT)). + addTransition(new Crossfade().addTarget(R.id.contact_picture)); + final ToggleScene toggleScene = new ToggleScene(container, myTransition); + contactItem.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + currentItem = v; + toggleScene.changeToScene(); + } + }); + } + + class ToggleScene { + boolean expanded = false; + Scene mScene; + Transition mTransition; + + ToggleScene(ViewGroup rootView, Transition transition) { + mScene = new Scene(rootView); + mTransition = transition; + mScene.setEnterAction(new Runnable() { + @Override + public void run() { + if (currentItem != null) { + System.out.println("onsceneChanged: currentItem = " + currentItem); + View expandedContainer = currentItem.findViewById(R.id.expanded_info); + expandedContainer.setVisibility(expanded ? View.GONE : View.VISIBLE); + ImageView thumbnailView = + (ImageView) currentItem.findViewById(R.id.contact_picture); + thumbnailView.setImageResource(expanded ? R.drawable.self_portrait_square_100 : + R.drawable.self_portrait_square_200); + ImageView arrow = (ImageView) currentItem.findViewById(R.id.contact_arrow); + arrow.setRotation(expanded ? 0 : 90); + expanded = !expanded; + } + } + }); + } + + void changeToScene() { + TransitionManager.go(mScene, mTransition); + } + }; +} 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..5bb0e77 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/CrossFadeDemo.java @@ -0,0 +1,69 @@ +/* + * 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.transition.ChangeBounds; +import android.view.View; +import android.view.ViewGroup; +import android.transition.Crossfade; +import android.transition.Scene; +import android.transition.TransitionSet; +import android.transition.TransitionManager; + + +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 = Scene.getSceneForLayout(mSceneRoot, R.layout.crossfade, this); + mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.crossfade_1, this); + + Crossfade crossfade = new Crossfade(); + crossfade.setFadeBehavior(Crossfade.FADE_BEHAVIOR_CROSSFADE); + crossfade.setResizeBehavior(Crossfade.RESIZE_BEHAVIOR_NONE); + crossfade.addTarget(R.id.textview).addTarget(R.id.textview1). + addTarget(R.id.textview2); + mTransitionManager = new TransitionManager(); + TransitionSet moveCrossFade = new TransitionSet(); + moveCrossFade.addTransition(crossfade).addTransition(new ChangeBounds()); + 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; + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/CrossfadeImage.java b/tests/TransitionTests/src/com/android/transitiontests/CrossfadeImage.java new file mode 100644 index 0000000..1f278b9 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/CrossfadeImage.java @@ -0,0 +1,68 @@ +/* + * 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.transition.Crossfade; +import android.transition.ChangeBounds; +import android.transition.Scene; +import android.transition.Transition; +import android.transition.TransitionSet; +import android.transition.TransitionManager; +import android.widget.ImageView; + +public class CrossfadeImage extends Activity { + ViewGroup mSceneRoot; + static int mCurrentScene; + Scene mScene1, mScene2; + TransitionManager mTransitionManager; + boolean mExpanded = false; + Transition mTransition; + ImageView mImageView; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.crossfade_image); + + ViewGroup container = (ViewGroup) findViewById(R.id.container); + mSceneRoot = container; + + mImageView = (ImageView) findViewById(R.id.contact_picture); + mImageView.setScaleType(ImageView.ScaleType.FIT_CENTER); + + Crossfade mCrossfade = new Crossfade(); + mCrossfade.addTarget(R.id.contact_picture); + + TransitionSet group = new TransitionSet(); + group.setDuration(1500); + group.addTransition(mCrossfade).addTransition(new ChangeBounds()); + mTransition = group; + } + + public void sendMessage(View view) { + TransitionManager.beginDelayedTransition(mSceneRoot, mTransition); + if (mExpanded) { + mImageView.setImageResource(R.drawable.self_portrait_square_100); + } else { + mImageView.setImageResource(R.drawable.self_portrait_square_200); + } + mExpanded = !mExpanded; + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/CrossfadeMultiple.java b/tests/TransitionTests/src/com/android/transitiontests/CrossfadeMultiple.java new file mode 100644 index 0000000..d784f75 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/CrossfadeMultiple.java @@ -0,0 +1,140 @@ +/* + * 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.transition.ChangeBounds; +import android.view.View; +import android.view.ViewGroup; +import android.transition.Crossfade; +import android.transition.TextChange; +import android.transition.Transition; +import android.transition.TransitionSet; +import android.transition.TransitionManager; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.TextView; + +import static android.widget.LinearLayout.LayoutParams; + +public class CrossfadeMultiple extends Activity { + ViewGroup mSceneRoot; + static int mCurrentScene; + TransitionManager mTransitionManager; + Transition mTransition; + ImageView mImageView; + TextView mTextView; + Button mButton; + Crossfade mCrossfade; + TransitionSet mCrossfadeGroup; + TransitionSet mTextChangeGroup1, mTextChangeGroup2; + TransitionSet mInOutGroup; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.crossfade_multiple); + + ViewGroup container = (ViewGroup) findViewById(R.id.container); + mSceneRoot = container; + + mButton = (Button) findViewById(R.id.button); + mImageView = (ImageView) findViewById(R.id.imageview); + mTextView = (TextView) findViewById(R.id.textview); + + mCrossfade = new Crossfade(); + mCrossfade.addTarget(R.id.button).addTarget(R.id.textview).addTarget(R.id.imageview); + + mCrossfadeGroup = new TransitionSet(); + mCrossfadeGroup.setDuration(300); + mCrossfadeGroup.addTransition(mCrossfade).addTransition(new ChangeBounds()); + mTransition = mCrossfadeGroup; + + mInOutGroup = new TransitionSet(); + Crossfade inOut = new Crossfade(); + inOut.setDuration(300); + inOut.setFadeBehavior(Crossfade.FADE_BEHAVIOR_OUT_IN); + ChangeBounds changeBounds = new ChangeBounds(); + changeBounds.setStartDelay(150); + changeBounds.setDuration(0); + 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()); + + 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); + } + + public void sendMessage(View view) { + TransitionManager.beginDelayedTransition(mSceneRoot, mTransition); + int id = view.getId(); + LayoutParams params = null; + switch (id) { + case R.id.button1: + params = new LayoutParams(200, 200); + mButton.setText("A"); + mTextView.setText("1111111"); + mImageView.setImageResource(R.drawable.self_portrait_square_100); + break; + case R.id.button2: + params = new LayoutParams(400, 200); + mButton.setText("B"); + mTextView.setText("2222222"); + mImageView.setImageResource(R.drawable.self_portrait_square_200); + break; + case R.id.button3: + params = new LayoutParams(200, 400); + mButton.setText("C"); + mTextView.setText("3333333"); + mImageView.setImageResource(R.drawable.self_portrait_square_400); + break; + } + mButton.setLayoutParams(params); + } + + public void changeTransitionType(View view) { + int id = view.getId(); + switch (id) { + case R.id.reveal: + mCrossfade.setFadeBehavior(Crossfade.FADE_BEHAVIOR_REVEAL); + mTransition = mCrossfadeGroup; + break; + case R.id.crossfade: + mCrossfade.setFadeBehavior(Crossfade.FADE_BEHAVIOR_CROSSFADE); + mTransition = mCrossfadeGroup; + break; + case R.id.inout: + mTransition = mInOutGroup; + break; + case R.id.textfade1: + mTransition = mTextChangeGroup1; + break; + case R.id.textfade2: + mTransition = mTextChangeGroup2; + break; + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/DelayedTransition.java b/tests/TransitionTests/src/com/android/transitiontests/DelayedTransition.java new file mode 100644 index 0000000..fe5f05a --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/DelayedTransition.java @@ -0,0 +1,66 @@ +/* + * 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.transition.TransitionManager; +import android.widget.Button; +import android.widget.LinearLayout; +import static android.widget.LinearLayout.LayoutParams; + +public class DelayedTransition extends Activity { + + private static final int SEARCH_SCREEN = 0; + private static final int RESULTS_SCREEN = 1; + ViewGroup mSceneRoot; + static int mCurrentScene; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.two_buttons); + + final Button button1 = (Button) findViewById(R.id.button1); + final Button button2 = (Button) findViewById(R.id.button2); + final LinearLayout container = (LinearLayout) findViewById(R.id.container); + button1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int buttonWidth = button1.getWidth(); + int containerWidth = container.getWidth(); + if (buttonWidth < containerWidth) { + TransitionManager.beginDelayedTransition(container, null); + button1.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, + LayoutParams.WRAP_CONTENT)); + TransitionManager.beginDelayedTransition(container, null); + button2.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, + LayoutParams.MATCH_PARENT)); + } else { + TransitionManager.beginDelayedTransition(container, null); + button1.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, + LayoutParams.WRAP_CONTENT)); + TransitionManager.beginDelayedTransition(container, null); + button2.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, + LayoutParams.WRAP_CONTENT)); + } + } + }); + } + +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/Demo0.java b/tests/TransitionTests/src/com/android/transitiontests/Demo0.java new file mode 100644 index 0000000..d52ab1d --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/Demo0.java @@ -0,0 +1,59 @@ +/* + * 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.content.Context; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + + +public class Demo0 extends Activity { + + private static final int SEARCH_SCREEN = 0; + private static final int RESULTS_SCREEN = 1; + ViewGroup mSceneRoot; + static int mCurrentScene; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.search_screen); + + View container = (View) findViewById(R.id.container); + mSceneRoot = (ViewGroup) container.getParent(); + + mCurrentScene = SEARCH_SCREEN; + } + + public void sendMessage(View view) { + if (mCurrentScene == RESULTS_SCREEN) { + mSceneRoot.removeAllViews(); + LayoutInflater inflater = (LayoutInflater) + getSystemService(Context.LAYOUT_INFLATER_SERVICE); + inflater.inflate(R.layout.search_screen, mSceneRoot); + mCurrentScene = SEARCH_SCREEN; + } else { + mSceneRoot.removeAllViews(); + LayoutInflater inflater = (LayoutInflater) + getSystemService(Context.LAYOUT_INFLATER_SERVICE); + inflater.inflate(R.layout.results_screen, mSceneRoot); + mCurrentScene = RESULTS_SCREEN; + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/Demo1.java b/tests/TransitionTests/src/com/android/transitiontests/Demo1.java new file mode 100644 index 0000000..5b5eb15 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/Demo1.java @@ -0,0 +1,88 @@ +/* + * 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.content.Context; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.transition.Fade; +import android.transition.ChangeBounds; +import android.transition.Scene; +import android.transition.TransitionSet; +import android.transition.TransitionManager; + + +public class Demo1 extends Activity { + ViewGroup mSceneRoot; + static Scene mCurrentScene; + boolean mFirstTime = true; + Scene mSearchScreen, mResultsScreen; + TransitionManager mTransitionManager = null; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.search_screen); + + View container = (View) findViewById(R.id.container); + mSceneRoot = (ViewGroup) container.getParent(); + +// mResultsScreen = new MyScene(mSceneRoot, R.layout.results_screen); +// mSearchScreen = new MyScene(mSceneRoot, R.layout.search_screen); + mResultsScreen = new Scene(mSceneRoot); + mResultsScreen.setEnterAction(new Runnable() { + @Override + public void run() { + LayoutInflater inflater = (LayoutInflater) + getSystemService(Context.LAYOUT_INFLATER_SERVICE); + inflater.inflate(R.layout.results_screen, mSceneRoot); + } + }); + mSearchScreen = new Scene(mSceneRoot); + mSearchScreen.setEnterAction(new Runnable() { + @Override + public void run() { + LayoutInflater inflater = (LayoutInflater) + getSystemService(Context.LAYOUT_INFLATER_SERVICE); + inflater.inflate(R.layout.search_screen, mSceneRoot); + } + }); + + } + + public void sendMessage(View view) { + if (mFirstTime) { + mFirstTime = false; + TransitionSet transition = new TransitionSet(); + transition.addTransition(new Fade().addTarget(R.id.resultsText). + addTarget(R.id.resultsList)). + addTransition(new ChangeBounds().addTarget(R.id.searchContainer)); + mTransitionManager = new TransitionManager(); + mTransitionManager.setTransition(mSearchScreen, transition); + mTransitionManager.setTransition(mResultsScreen, transition); + } + if (mCurrentScene == mResultsScreen) { + mTransitionManager.transitionTo(mSearchScreen); + mCurrentScene = mSearchScreen; + } else { + mTransitionManager.transitionTo(mResultsScreen); + mCurrentScene = mResultsScreen; + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/Demo2.java b/tests/TransitionTests/src/com/android/transitiontests/Demo2.java new file mode 100644 index 0000000..0f3257b --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/Demo2.java @@ -0,0 +1,76 @@ +/* + * 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.transition.Fade; +import android.transition.ChangeBounds; +import android.transition.Recolor; +import android.transition.Scene; +import android.transition.TransitionSet; +import android.transition.TransitionManager; + +public class Demo2 extends Activity { + ViewGroup mSceneRoot; + static Scene mCurrentScene; + boolean mFirstTime = true; + Scene mSearchScreen, mResultsScreen; + TransitionManager mTransitionManager = null; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.search_screen); + + View container = (View) findViewById(R.id.container); + mSceneRoot = (ViewGroup) container.getParent(); + + } + + public void sendMessage(View view) { + if (mFirstTime) { + mFirstTime = false; + // Non-resource approach of creating scenes +// mSearchScreen = new Scene(this, mSceneRoot, R.layout.search_screen); +// mResultsScreen = new Scene(this, mSceneRoot, R.layout.results_screen); + try { + mSearchScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.search_screen, this); + mResultsScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.search_screen, this); + } catch (Exception e) { + System.out.println("Problem loading scene resource: " + e); + } + + TransitionSet transition = new TransitionSet(); + transition.addTransition(new Fade().addTarget(R.id.resultsText). + addTarget(R.id.resultsList)). + addTransition(new ChangeBounds().addTarget(R.id.searchContainer)). + addTransition(new Recolor().addTarget(R.id.container)); + mTransitionManager = new TransitionManager(); + mTransitionManager.setTransition(mSearchScreen, transition); + mTransitionManager.setTransition(mResultsScreen, transition); + } + if (mCurrentScene == mResultsScreen) { + mTransitionManager.transitionTo(mSearchScreen); + mCurrentScene = mSearchScreen; + } else { + mTransitionManager.transitionTo(mResultsScreen); + mCurrentScene = mResultsScreen; + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/Demo3.java b/tests/TransitionTests/src/com/android/transitiontests/Demo3.java new file mode 100644 index 0000000..0ffa1f5 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/Demo3.java @@ -0,0 +1,64 @@ +/* + * 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.transition.ChangeBounds; +import android.view.View; +import android.view.ViewGroup; +import android.transition.Fade; +import android.transition.Recolor; +import android.transition.Scene; +import android.transition.TransitionSet; +import android.transition.TransitionManager; + + +public class Demo3 extends Activity { + ViewGroup mSceneRoot; + static Scene mCurrentScene; + Scene mSearchScreen, mResultsScreen; + TransitionManager mTransitionManager = null; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.search_screen); + + View container = (View) findViewById(R.id.container); + mSceneRoot = (ViewGroup) container.getParent(); + + mSearchScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.search_screen, this); + mResultsScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.results_screen, this); + + TransitionSet transition = new TransitionSet(); + transition.addTransition(new Fade()).addTransition(new ChangeBounds()).addTransition(new Recolor()); + + mTransitionManager = new TransitionManager(); + mTransitionManager.setTransition(mSearchScreen, transition); + mTransitionManager.setTransition(mResultsScreen, transition); + } + + public void sendMessage(View view) { + if (mCurrentScene == mResultsScreen) { + mTransitionManager.transitionTo(mSearchScreen); + mCurrentScene = mSearchScreen; + } else { + mTransitionManager.transitionTo(mResultsScreen); + mCurrentScene = mResultsScreen; + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/Demo4.java b/tests/TransitionTests/src/com/android/transitiontests/Demo4.java new file mode 100644 index 0000000..3aadbb0 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/Demo4.java @@ -0,0 +1,75 @@ +/* + * 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.transition.ChangeBounds; +import android.view.View; +import android.view.ViewGroup; +import android.transition.Fade; +import android.transition.Recolor; +import android.transition.Scene; +import android.transition.TransitionSet; +import android.transition.TransitionManager; + + +public class Demo4 extends Activity { + ViewGroup mSceneRoot; + static Scene mCurrentScene; + Scene mSearchScreen, mResultsScreen; + TransitionManager mTransitionManager = null; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.search_screen); + + View container = (View) findViewById(R.id.container); + mSceneRoot = (ViewGroup) container.getParent(); + + mSearchScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.search_screen, this); + mResultsScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.results_screen, this); + + TransitionSet transitionToResults = new TransitionSet(); + Fade fade = new Fade(); + fade.addTarget(R.id.resultsText).addTarget(R.id.resultsList); + fade.setStartDelay(300); + fade.setDuration(1000); + transitionToResults.addTransition(fade). + addTransition(new ChangeBounds().addTarget(R.id.searchContainer)). + addTransition(new Recolor().addTarget(R.id.container)); + + TransitionSet transitionToSearch = new TransitionSet(); + transitionToSearch.addTransition(fade). + addTransition(new ChangeBounds().addTarget(R.id.searchContainer)). + addTransition(new Recolor().addTarget(R.id.container)); + + mTransitionManager = new TransitionManager(); + mTransitionManager.setTransition(mSearchScreen, transitionToSearch); + mTransitionManager.setTransition(mResultsScreen, transitionToResults); + } + + public void sendMessage(View view) { + if (mCurrentScene == mResultsScreen) { + mTransitionManager.transitionTo(mSearchScreen); + mCurrentScene = mSearchScreen; + } else { + mTransitionManager.transitionTo(mResultsScreen); + mCurrentScene = mResultsScreen; + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/Demo5.java b/tests/TransitionTests/src/com/android/transitiontests/Demo5.java new file mode 100644 index 0000000..c36abda --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/Demo5.java @@ -0,0 +1,53 @@ +/* + * 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.transition.Scene; +import android.transition.TransitionManager; + + +public class Demo5 extends Activity { + ViewGroup mSceneRoot; + static Scene mCurrentScene; + Scene mSearchScreen, mResultsScreen; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.search_screen); + + View container = (View) findViewById(R.id.container); + mSceneRoot = (ViewGroup) container.getParent(); + + mSearchScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.search_screen, this); + mResultsScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.results_screen, this); + + } + + public void sendMessage(View view) { + if (mCurrentScene == mResultsScreen) { + TransitionManager.go(mSearchScreen); + mCurrentScene = mSearchScreen; + } else { + TransitionManager.go(mResultsScreen); + mCurrentScene = mResultsScreen; + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/FadingHierarchy.java b/tests/TransitionTests/src/com/android/transitiontests/FadingHierarchy.java new file mode 100644 index 0000000..d497abe --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/FadingHierarchy.java @@ -0,0 +1,53 @@ +/* + * 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.transition.TransitionManager; +import android.widget.Button; + +public class FadingHierarchy extends Activity { + + ViewGroup mRemovingContainer, mContainer; + Button mRemovingButton; + boolean mVisible = true; + ViewGroup mInnerContainerParent; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.fading_hierarchy); + + mContainer = (ViewGroup) findViewById(R.id.container); + mRemovingContainer = (ViewGroup) findViewById(R.id.removingContainer); + mInnerContainerParent = (ViewGroup) mRemovingContainer.getParent(); + + mRemovingButton = (Button) findViewById(R.id.removingButton); + } + + public void sendMessage(View view) { + TransitionManager.beginDelayedTransition(mContainer, null); + if (mVisible) { + mInnerContainerParent.removeView(mRemovingContainer); + } else { + mInnerContainerParent.addView(mRemovingContainer); + } + mVisible = !mVisible; + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/FadingTest.java b/tests/TransitionTests/src/com/android/transitiontests/FadingTest.java new file mode 100644 index 0000000..29fb868 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/FadingTest.java @@ -0,0 +1,77 @@ +/* + * 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.transition.Scene; +import android.widget.Button; +import android.transition.Fade; +import android.transition.TransitionManager; + + +public class FadingTest extends Activity { + + Button mRemovingButton, mInvisibleButton, mGoneButton; + Scene mScene1, mScene2; + ViewGroup mSceneRoot; + static Fade sFade = new Fade(); + Scene mCurrentScene; + + static { + sFade.addTarget(R.id.removingButton).addTarget(R.id.invisibleButton). + addTarget(R.id.goneButton); + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.fading_test); + + View container = (View) findViewById(R.id.container); + mSceneRoot = (ViewGroup) container.getParent(); + + + mRemovingButton = (Button) findViewById(R.id.removingButton); + mInvisibleButton = (Button) findViewById(R.id.invisibleButton); + mGoneButton = (Button) findViewById(R.id.goneButton); + + mGoneButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + mGoneButton.setAlpha(mGoneButton.getAlpha() < 1 ? 1 : .6f); + } + }); + + mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.fading_test, this); + mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.fading_test_scene_2, this); + + mCurrentScene = mScene1; + } + + public void sendMessage(View view) { + if (mCurrentScene == mScene1) { + TransitionManager.go(mScene2); + mCurrentScene = mScene2; + } else { + TransitionManager.go(mScene1); + mCurrentScene = mScene1; + } + } + +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/HierarchicalMove.java b/tests/TransitionTests/src/com/android/transitiontests/HierarchicalMove.java new file mode 100644 index 0000000..1146e20 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/HierarchicalMove.java @@ -0,0 +1,108 @@ +/* + * 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.transition.ChangeBounds; +import android.view.View; +import android.view.ViewGroup; +import android.transition.Transition; +import android.transition.TransitionSet; +import android.transition.TransitionManager; +import android.widget.Button; + +import static android.widget.LinearLayout.LayoutParams; + +public class HierarchicalMove extends Activity { + + Button[] buttons = new Button[6]; + ViewGroup mSceneRoot; + boolean wide = false; + Transition mTransition; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.hierarchical_move); + + View container = (View) findViewById(R.id.container); + mSceneRoot = (ViewGroup) container.getParent(); + + buttons[0] = (Button) findViewById(R.id.button0); + buttons[1] = (Button) findViewById(R.id.button1); + buttons[2] = (Button) findViewById(R.id.button2); + buttons[3] = (Button) findViewById(R.id.button3); + buttons[4] = (Button) findViewById(R.id.button4); + buttons[5] = (Button) findViewById(R.id.button5); + + // Move button0, then buttons 1/2 together, then buttons 3/4/5 sequentially: + // group (seq) + // Move 0 + // group (seq) + // group (together) + // Move 1 + // Move 2 + // group (sequentially) + // Move 3 + // Move 4/5 + TransitionSet rootTransition = new TransitionSet(). + setOrdering(TransitionSet.ORDERING_SEQUENTIAL); + + // button0 + Transition move0 = new ChangeBounds(); + move0.addTarget(buttons[0]); + + // buttons 1/2/3/4/5 + TransitionSet group12345 = new TransitionSet(). + setOrdering(TransitionSet.ORDERING_SEQUENTIAL); + + // buttons 1/2 + TransitionSet group12 = new TransitionSet(). + setOrdering(TransitionSet.ORDERING_TOGETHER); + ChangeBounds changeBounds1 = new ChangeBounds(); + changeBounds1.addTarget(buttons[1]); + ChangeBounds changeBounds2 = new ChangeBounds(); + changeBounds2.addTarget(buttons[2]); + group12.addTransition(changeBounds1).addTransition(changeBounds2); + + TransitionSet group345 = new TransitionSet(). + setOrdering(TransitionSet.ORDERING_SEQUENTIAL); + ChangeBounds changeBounds3 = new ChangeBounds(); + changeBounds3.addTarget(buttons[3]); + ChangeBounds changeBounds45 = new ChangeBounds(); + changeBounds45.addTarget(buttons[4]).addTarget(buttons[5]); + group345.addTransition(changeBounds3).addTransition(changeBounds45); + + group12345.addTransition(move0).addTransition(group12).addTransition(group345); + + rootTransition.addTransition(group12345); + rootTransition.setDuration(1000); + mTransition = rootTransition; + + } + + public void sendMessage(View view) { + TransitionManager.beginDelayedTransition(mSceneRoot, mTransition); + int widthSpec = wide ? LayoutParams.WRAP_CONTENT : LayoutParams.MATCH_PARENT; + LayoutParams params = new LayoutParams(widthSpec, LayoutParams.WRAP_CONTENT); + for (int i = 0; i < buttons.length; ++i) { + buttons[i].setLayoutParams(params); + } + wide = !wide; + } + +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/HitRectBug.java b/tests/TransitionTests/src/com/android/transitiontests/HitRectBug.java new file mode 100644 index 0000000..9f19405 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/HitRectBug.java @@ -0,0 +1,91 @@ +/* + * 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.animation.ObjectAnimator; +import android.animation.ValueAnimator; +import android.app.Activity; +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.Rect; +import android.os.Bundle; +import android.view.View; +import android.widget.ImageView; +import android.widget.RelativeLayout; + + +public class HitRectBug extends Activity { + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(new TestDrawingView(this)); + } + + public static class TestDrawingView extends RelativeLayout + { + private Rect mRect = new Rect(); + private Paint mPaint; + private ImageView mImageView; + + public TestDrawingView(Context context) + { + super(context); + setWillNotDraw(false); + + mPaint = new Paint(); + mPaint.setColor(Color.RED); + mPaint.setStyle(Paint.Style.STROKE); + + mImageView = new ImageView(context); + mImageView.setLeft(100); + mImageView.setRight(200); + mImageView.setImageResource(R.drawable.self_portrait_square); + mImageView.setScaleX(3); + mImageView.setScaleY(3); +// mImageView.setRotation(145); + + ObjectAnimator anim = ObjectAnimator.ofFloat(mImageView, View.ROTATION, 0, 360); + anim.setRepeatCount(ValueAnimator.INFINITE); + anim.setDuration(5000); + anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(ValueAnimator animation) { + invalidate(); + } + }); + anim.start(); + RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(128, 128); + params.addRule(RelativeLayout.CENTER_IN_PARENT); + addView(mImageView, params); + } + + @Override + protected void onDraw(Canvas canvas) + { + super.onDraw(canvas); + } + + @Override + protected void dispatchDraw(Canvas canvas) { + super.dispatchDraw(canvas); + mImageView.getHitRect(mRect); + canvas.drawRect(mRect, mPaint); + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/InstanceTargets.java b/tests/TransitionTests/src/com/android/transitiontests/InstanceTargets.java new file mode 100644 index 0000000..a06ba8f --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/InstanceTargets.java @@ -0,0 +1,60 @@ +/* + * 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.transition.ChangeBounds; +import android.transition.TransitionManager; +import android.widget.Button; + +import static android.widget.RelativeLayout.ALIGN_PARENT_LEFT; +import static android.widget.RelativeLayout.ALIGN_PARENT_RIGHT; +import static android.widget.RelativeLayout.LayoutParams; + +public class InstanceTargets extends Activity { + + ViewGroup mSceneRoot; + static int mCurrentScene; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.instance_targets); + + View container = (View) findViewById(R.id.container); + mSceneRoot = (ViewGroup) container; + } + + public void sendMessage(final View view) { + TransitionManager.beginDelayedTransition(mSceneRoot, new ChangeBounds().addTarget(view)); + for (int i = 0; i < mSceneRoot.getChildCount(); ++i) { + Button button = (Button) mSceneRoot.getChildAt(i); + LayoutParams params = (LayoutParams) button.getLayoutParams(); + int rules[] = params.getRules(); + if (rules[ALIGN_PARENT_RIGHT] != 0) { + params.removeRule(ALIGN_PARENT_RIGHT); + params.addRule(ALIGN_PARENT_LEFT); + } else { + params.removeRule(ALIGN_PARENT_LEFT); + params.addRule(ALIGN_PARENT_RIGHT); + } + button.setLayoutParams(params); + } + } +} 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..c26e93f --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/InterruptionTest.java @@ -0,0 +1,75 @@ +/* + * 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.transition.ChangeBounds; +import android.view.View; +import android.view.ViewGroup; +import android.transition.Scene; +import android.transition.TransitionSet; +import android.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; + TransitionSet mSequencedMove = new TransitionSet(). + setOrdering(TransitionSet.ORDERING_SEQUENTIAL); + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.interruption); + + ViewGroup sceneRoot = (ViewGroup) findViewById(R.id.sceneRoot); + + mScene1 = Scene.getSceneForLayout(sceneRoot, R.layout.interruption_inner_1, this); + mScene2 = Scene.getSceneForLayout(sceneRoot, R.layout.interruption_inner_2, this); + mScene3 = Scene.getSceneForLayout(sceneRoot, R.layout.interruption_inner_3, this); + mScene4 = Scene.getSceneForLayout(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); + + ChangeBounds changeBounds1 = new ChangeBounds(); + changeBounds1.addTarget(R.id.button); + ChangeBounds changeBounds2 = new ChangeBounds(); + changeBounds2.addTarget(R.id.button1); + + mSequencedMove.addTransition(changeBounds1).addTransition(changeBounds2); + mSequencedMove.setDuration(1000); + } + + public void onRadioButtonClicked(View clickedButton) { + if (clickedButton == mScene1RB) { + TransitionManager.go(mScene1, mSequencedMove); + } else if (clickedButton == mScene2RB) { + TransitionManager.go(mScene2, mSequencedMove); + } else if (clickedButton == mScene3RB) { + TransitionManager.go(mScene3, mSequencedMove); + } else { + TransitionManager.go(mScene4, mSequencedMove); + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/ListViewAddRemove.java b/tests/TransitionTests/src/com/android/transitiontests/ListViewAddRemove.java new file mode 100644 index 0000000..6629770 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/ListViewAddRemove.java @@ -0,0 +1,167 @@ +/* + * 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.content.Context; +import android.os.Bundle; +import android.view.View; +import android.view.ViewTreeObserver; +import android.transition.Fade; +import android.transition.Scene; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.LinearLayout; +import android.widget.ListView; +import android.widget.TextView; +import android.transition.AutoTransition; +import android.transition.ChangeBounds; +import android.transition.Transition; +import android.transition.TransitionSet; +import android.transition.TransitionManager; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +public class ListViewAddRemove extends Activity { + + final ArrayList<String> numList = new ArrayList<String>(); + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.list_view_add_remove); + + final LinearLayout container = (LinearLayout) findViewById(R.id.container); + + final ListView listview = (ListView) findViewById(R.id.listview); + for (int i = 0; i < 200; ++i) { + numList.add(Integer.toString(i)); + } + final StableArrayAdapter adapter = new StableArrayAdapter(this, + android.R.layout.simple_list_item_1, numList); + listview.setAdapter(adapter); + + final ViewTreeObserver observer = container.getViewTreeObserver(); + observer.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + public void onGlobalLayout() { + System.out.println("-------------------------------------"); + System.out.println("onLayoutListener: listview view tops: "); + for (int i = 0; i < listview.getChildCount(); ++i) { + TextView view = (TextView) listview.getChildAt(i); + System.out.println(" " + view.getText() + ": " + view.getTop()); + } + } + }); + + final Scene mySceneChanger = new Scene(listview); + + mySceneChanger.setEnterAction(new Runnable() { + @Override + public void run() { + numList.remove(mItemToDelete); + adapter.notifyDataSetChanged(); + } + }); + final Transition myTransition = new AutoTransition(); + final TransitionSet noFadeIn = new TransitionSet(). + setOrdering(TransitionSet.ORDERING_SEQUENTIAL); + Fade fadeIn = new Fade(Fade.IN); + fadeIn.setDuration(50); + noFadeIn.addTransition(new Fade(Fade.OUT)).addTransition(new ChangeBounds()).addTransition(fadeIn); + + myTransition.addListener(new Transition.TransitionListenerAdapter() { + @Override + public void onTransitionStart(Transition transition) { + System.out.println("---------ListView Tops: Before--------"); + for (int i = 0; i < listview.getChildCount(); ++i) { + TextView view = (TextView) listview.getChildAt(i); + int position = listview.getPositionForView(view); + } + } + + @Override + public void onTransitionEnd(Transition transition) { + System.out.println("---------ListView Tops: After--------"); + for (int i = 0; i < listview.getChildCount(); ++i) { + TextView view = (TextView) listview.getChildAt(i); + int position = listview.getPositionForView(view); + if (view.hasTransientState()) { +// view.setHasTransientState(false); + } + } + myTransition.removeListener(this); + } + }); + + listview.setOnItemClickListener(new AdapterView.OnItemClickListener() { + + @Override + public void onItemClick(AdapterView<?> parent, final View view, int position, long id) { + System.out.println("---------ListView Tops: OnClick--------"); + String item = (String) parent.getItemAtPosition(position); + for (int i = 0; i < listview.getChildCount(); ++i) { + TextView v = (TextView) listview.getChildAt(i); + if (!item.equals(v.getText())) { +// v.setHasTransientState(true); + } + } +// listview.setHasTransientState(true); + mItemToDelete = item; +// numList.remove(item); + TransitionManager.go(mySceneChanger, noFadeIn); +// view.postDelayed(new Runnable() { +// @Override +// public void run() { +// for (int i = 0; i < listview.getChildCount(); ++i) { +// TextView v = (TextView) listview.getChildAt(i); +// v.setHasTransientState(false); +// } +// } +// }, 200); + } + + }); + } + + String mItemToDelete = null; + + private class StableArrayAdapter extends ArrayAdapter<String> { + + HashMap<String, Integer> mIdMap = new HashMap<String, Integer>(); + + public StableArrayAdapter(Context context, int textViewResourceId, + List<String> objects) { + super(context, textViewResourceId, objects); + for (int i = 0; i < objects.size(); ++i) { + mIdMap.put(objects.get(i), i); + } + } + + @Override + public long getItemId(int position) { + String item = getItem(position); + return mIdMap.get(item); + } + + @Override + public boolean hasStableIds() { + return true; + } + + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/ListViewAddRemoveNoTransition.java b/tests/TransitionTests/src/com/android/transitiontests/ListViewAddRemoveNoTransition.java new file mode 100644 index 0000000..4eeba4d --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/ListViewAddRemoveNoTransition.java @@ -0,0 +1,103 @@ +/* + * 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.content.Context; +import android.os.Bundle; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.LinearLayout; +import android.widget.ListView; +import android.widget.TextView; + + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +public class ListViewAddRemoveNoTransition extends Activity { + + final ArrayList<String> numList = new ArrayList<String>(); + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.list_view_add_remove); + + final LinearLayout container = (LinearLayout) findViewById(R.id.container); + + final ListView listview = (ListView) findViewById(R.id.listview); + for (int i = 0; i < 200; ++i) { + numList.add(Integer.toString(i)); + } + final StableArrayAdapter adapter = new StableArrayAdapter(this, + android.R.layout.simple_list_item_1, numList); + listview.setAdapter(adapter); + + listview.setOnItemClickListener(new AdapterView.OnItemClickListener() { + + @Override + public void onItemClick(AdapterView<?> parent, final View view, int position, long id) { + String item = (String) parent.getItemAtPosition(position); + for (int i = 0; i < listview.getChildCount(); ++i) { + TextView v = (TextView) listview.getChildAt(i); + if (!item.equals(v.getText())) { + v.setHasTransientState(true); + } + } + numList.remove(item); + adapter.notifyDataSetChanged(); + view.postDelayed(new Runnable() { + @Override + public void run() { + for (int i = 0; i < listview.getChildCount(); ++i) { + TextView v = (TextView) listview.getChildAt(i); + v.setHasTransientState(false); + } + } + }, 200); + } + + }); + } + + private class StableArrayAdapter extends ArrayAdapter<String> { + + HashMap<String, Integer> mIdMap = new HashMap<String, Integer>(); + + public StableArrayAdapter(Context context, int textViewResourceId, + List<String> objects) { + super(context, textViewResourceId, objects); + for (int i = 0; i < objects.size(); ++i) { + mIdMap.put(objects.get(i), i); + } + } + + @Override + public long getItemId(int position) { + String item = getItem(position); + return mIdMap.get(item); + } + + @Override + public boolean hasStableIds() { + return true; + } + + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/LoginActivity.java b/tests/TransitionTests/src/com/android/transitiontests/LoginActivity.java new file mode 100644 index 0000000..92bbb85 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/LoginActivity.java @@ -0,0 +1,105 @@ +/* + * 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.transition.Scene; +import android.widget.TextView; +import android.transition.Fade; +import android.transition.Recolor; +import android.transition.Slide; +import android.transition.Transition; +import android.transition.TransitionSet; +import android.transition.TransitionManager; + + +public class LoginActivity extends Activity { + ViewGroup mSceneRoot; + Scene mCurrentScene; + TransitionManager mTransitionManager; + Scene mLoginScene, mPasswordScene, mIncorrectPasswordScene, mSuccessScene, mUsernameTakenScene, + mNewUserScene; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_login); + View container = (View) findViewById(R.id.container); + mSceneRoot = (ViewGroup) container.getParent(); + + mLoginScene = Scene.getSceneForLayout(mSceneRoot, R.layout.activity_login, this); + mPasswordScene = Scene.getSceneForLayout(mSceneRoot, R.layout.login_password, this); + mIncorrectPasswordScene = Scene.getSceneForLayout(mSceneRoot, R.layout.incorrect_password, this); + mUsernameTakenScene = Scene.getSceneForLayout(mSceneRoot, R.layout.username_taken, this); + mSuccessScene = Scene.getSceneForLayout(mSceneRoot, R.layout.success, this); + mNewUserScene = Scene.getSceneForLayout(mSceneRoot, R.layout.new_user, this); + + mTransitionManager = new TransitionManager(); + + // Custom transitions in/out of NewUser screen - slide in the 2nd password UI + TransitionSet slider = new TransitionSet(); + slider.addTransition(new Slide().addTarget(R.id.retype).addTarget(R.id.retypeEdit)); + slider.addTransition(new Recolor().addTarget(R.id.password). + addTarget(R.id.passwordEdit)); + slider.addTransition(new Fade()); + mTransitionManager.setTransition(mLoginScene, mNewUserScene, slider); + mTransitionManager.setTransition(mPasswordScene, mNewUserScene, slider); + mTransitionManager.setTransition(mNewUserScene, mLoginScene, slider); + mTransitionManager.setTransition(mNewUserScene, mPasswordScene, slider); + + // Custom transitions with recoloring password field + Transition colorizer = new Recolor().addTarget(R.id.password). + addTarget(R.id.passwordEdit); + mTransitionManager.setTransition(mLoginScene, mPasswordScene, colorizer); + mTransitionManager.setTransition(mPasswordScene, mLoginScene, colorizer); + + mCurrentScene = mLoginScene; + } + + public void applyScene(Scene scene) { + mTransitionManager.transitionTo(scene); + mCurrentScene = scene; + } + + public void sendMessage(View view) { + TextView textView = (TextView) view; + CharSequence text = textView.getText(); + if (text.equals("Cancel")) { + applyScene(mLoginScene); + } else if (text.equals("Submit")) { + if (mCurrentScene == mLoginScene) { + applyScene(mPasswordScene); + } else if (mCurrentScene == mPasswordScene) { + applyScene(Math.random() < .5 ? mSuccessScene : mIncorrectPasswordScene); + } else if (mCurrentScene == mNewUserScene) { + applyScene(Math.random() < .5 ? mSuccessScene : mUsernameTakenScene); + } + } else if (text.equals("New User?")) { + applyScene(mNewUserScene); + } else if (text.equals("Okay")) { + if (mCurrentScene == mIncorrectPasswordScene) { + applyScene(mPasswordScene); + } else { // username taken scene + applyScene(mNewUserScene); + } + } else if (text.equals("Reset")) { + applyScene(mLoginScene); + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/LoginActivityFromResources.java b/tests/TransitionTests/src/com/android/transitiontests/LoginActivityFromResources.java new file mode 100644 index 0000000..600c791 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/LoginActivityFromResources.java @@ -0,0 +1,91 @@ +/* + * 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.transition.Scene; +import android.transition.TransitionInflater; +import android.widget.TextView; +import android.transition.TransitionManager; + + +public class LoginActivityFromResources extends Activity { + ViewGroup mSceneRoot; + Scene mCurrentScene; + TransitionManager mTransitionManager = null; + Scene mLoginScene, mPasswordScene, mIncorrectPasswordScene, mSuccessScene, mUsernameTakenScene, + mNewUserScene; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_login); + View container = findViewById(R.id.container); + mSceneRoot = (ViewGroup) container.getParent(); + + } + + public void applyScene(Scene scene) { + mTransitionManager.transitionTo(scene); + mCurrentScene = scene; + } + + public void sendMessage(View view) { + if (mTransitionManager == null) { + TransitionInflater inflater = TransitionInflater.from(this); + + mLoginScene = Scene.getSceneForLayout(mSceneRoot, R.layout.activity_login, this); + mPasswordScene = Scene.getSceneForLayout(mSceneRoot, R.layout.login_password, this); + mIncorrectPasswordScene = Scene.getSceneForLayout(mSceneRoot, R.layout + .incorrect_password, this); + mUsernameTakenScene = Scene.getSceneForLayout(mSceneRoot, R.layout.username_taken, this); + mSuccessScene = Scene.getSceneForLayout(mSceneRoot, R.layout.success, this); + mNewUserScene = Scene.getSceneForLayout(mSceneRoot, R.layout.new_user, this); + + mTransitionManager = + inflater.inflateTransitionManager(R.transition.login_transition_mgr, + mSceneRoot); + + mCurrentScene = mLoginScene; + } + TextView textView = (TextView) view; + CharSequence text = textView.getText(); + if (text.equals("Cancel")) { + applyScene(mLoginScene); + } else if (text.equals("Submit")) { + if (mCurrentScene == mLoginScene) { + applyScene(mPasswordScene); + } else if (mCurrentScene == mPasswordScene) { + applyScene(Math.random() < .5 ? mSuccessScene : mIncorrectPasswordScene); + } else if (mCurrentScene == mNewUserScene) { + applyScene(Math.random() < .5 ? mSuccessScene : mUsernameTakenScene); + } + } else if (text.equals("New User?")) { + applyScene(mNewUserScene); + } else if (text.equals("Okay")) { + if (mCurrentScene == mIncorrectPasswordScene) { + applyScene(mPasswordScene); + } else { // username taken scene + applyScene(mNewUserScene); + } + } else if (text.equals("Reset")) { + applyScene(mLoginScene); + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/OverlayTest.java b/tests/TransitionTests/src/com/android/transitiontests/OverlayTest.java new file mode 100644 index 0000000..ef8cd37 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/OverlayTest.java @@ -0,0 +1,54 @@ +/* + * 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.widget.Button; + + +public class OverlayTest extends Activity { + + ViewGroup mContainer; + ViewGroup mRoot; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.overlay_test); + + mContainer = (ViewGroup) findViewById(R.id.container); + mRoot = (ViewGroup) mContainer.getParent(); + } + + public void onClick(View view) { + final Button fadingButton = (Button) findViewById(R.id.fadingButton); + if (fadingButton != null) { + mContainer.removeView(fadingButton); + mRoot.getOverlay().add(fadingButton); + fadingButton.animate().alpha(0).setDuration(1000).withEndAction(new Runnable() { + @Override + public void run() { + fadingButton.setAlpha(1); + mRoot.getOverlay().remove(fadingButton); + mContainer.addView(fadingButton); + } + }); + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/Reparenting.java b/tests/TransitionTests/src/com/android/transitiontests/Reparenting.java new file mode 100644 index 0000000..1ee8621 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/Reparenting.java @@ -0,0 +1,75 @@ +/* + * 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.transition.ChangeBounds; +import android.view.View; +import android.view.ViewGroup; +import android.transition.Scene; +import android.transition.TransitionManager; +import android.widget.Button; + +public class Reparenting extends Activity { + + ViewGroup mSceneRoot; + ViewGroup mContainer1, mContainer2; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.reparenting); + + ViewGroup container = (ViewGroup) findViewById(R.id.container); + mContainer1 = (ViewGroup) findViewById(R.id.container1); + mContainer2 = (ViewGroup) findViewById(R.id.container2); + System.out.println("container 1 and 2 " + mContainer1 + ", " + mContainer2); + + setupButtons(0, mContainer1); + setupButtons(3, mContainer2); + + mSceneRoot = container; + } + + private void setupButtons(int startIndex, ViewGroup parent) { + for (int i = startIndex; i < (startIndex + 3); ++i) { + Button button = new Button(this); + button.setText(Integer.toString(i)); + button.setOnClickListener(mButtonListener); + parent.addView(button); + } + } + + private View.OnClickListener mButtonListener = new View.OnClickListener() { + @Override + public void onClick(final View v) { + Scene newScene = new Scene(mSceneRoot); + newScene.setEnterAction(new Runnable() { + @Override + public void run() { + ViewGroup oldParent = (ViewGroup) v.getParent(); + ViewGroup newParent = oldParent == mContainer1 ? mContainer2 : mContainer1; + oldParent.removeView(v); + newParent.addView(v); + } + }); + ChangeBounds reparent = new ChangeBounds(); + reparent.setReparent(true); + TransitionManager.go(newScene, reparent); + } + }; +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/ResourceLoadingTest.java b/tests/TransitionTests/src/com/android/transitiontests/ResourceLoadingTest.java new file mode 100644 index 0000000..1aee258 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/ResourceLoadingTest.java @@ -0,0 +1,75 @@ +/* + * 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.transition.Scene; +import android.transition.TransitionInflater; +import android.transition.Transition; +import android.transition.TransitionManager; + + +public class ResourceLoadingTest extends Activity { + + private static final int SEARCH_SCREEN = 0; + private static final int RESULTS_SCREEN = 1; + ViewGroup mSceneRoot; + static int mCurrentScene; + TransitionManager mTransitionManager = null; + TransitionInflater mInflater; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.search_screen); + + View container = (View) findViewById(R.id.container); + mSceneRoot = (ViewGroup) container.getParent(); + + mCurrentScene = SEARCH_SCREEN; + + mInflater = TransitionInflater.from(this); + } + + public void sendMessage(View view) { + if (mTransitionManager == null) { + try { + TransitionInflater inflater = TransitionInflater.from(this); + mTransitionManager = + inflater.inflateTransitionManager(R.transition.my_transition_mgr, + mSceneRoot); + Scene loadedScene = new Scene(mSceneRoot); + System.out.println("loadedScene = " + loadedScene); + Transition loadedTransition = inflater.inflateTransition(R.transition.my_transition); + System.out.println("loadedTransition = " + loadedTransition); + } catch (Exception e) { + System.out.println("Problem loading scene resource: " + e); + } + } + if (mCurrentScene == RESULTS_SCREEN) { + Scene scene = Scene.getSceneForLayout(mSceneRoot, R.layout.search_screen, this); + mTransitionManager.transitionTo(scene); + mCurrentScene = SEARCH_SCREEN; + } else { + Scene scene = Scene.getSceneForLayout(mSceneRoot, R.layout.results_screen, this); + mTransitionManager.transitionTo(scene); + mCurrentScene = RESULTS_SCREEN; + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/ScenesTestAutoTargets.java b/tests/TransitionTests/src/com/android/transitiontests/ScenesTestAutoTargets.java new file mode 100644 index 0000000..7504058 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/ScenesTestAutoTargets.java @@ -0,0 +1,65 @@ +/* + * 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.transition.ChangeBounds; +import android.view.View; +import android.view.ViewGroup; +import android.transition.Fade; +import android.transition.Recolor; +import android.transition.Scene; +import android.transition.TransitionSet; +import android.transition.TransitionManager; + + +public class ScenesTestAutoTargets extends Activity { + ViewGroup mSceneRoot; + static Scene mCurrentScene; + TransitionManager mTransitionManager = null; + Scene mResultsScreen, mSearchScreen; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.search_screen); + + View container = (View) findViewById(R.id.container); + mSceneRoot = (ViewGroup) container.getParent(); + + mSearchScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.search_screen, this); + mResultsScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.results_screen, this); + + TransitionSet transition = new TransitionSet(); + transition.addTransition(new Fade()).addTransition(new ChangeBounds()).addTransition(new Recolor()); + + mTransitionManager = new TransitionManager(); + mTransitionManager.setTransition(mSearchScreen, transition); + mTransitionManager.setTransition(mResultsScreen, transition); + } + + public void sendMessage(View view) { + if (mCurrentScene == mResultsScreen) { + mTransitionManager.transitionTo(mSearchScreen); + mCurrentScene = mSearchScreen; + } else { + mTransitionManager.transitionTo(mResultsScreen); + mCurrentScene = mResultsScreen; + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/ScenesTestAutoTransition.java b/tests/TransitionTests/src/com/android/transitiontests/ScenesTestAutoTransition.java new file mode 100644 index 0000000..23b28ec --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/ScenesTestAutoTransition.java @@ -0,0 +1,56 @@ +/* + * 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.transition.AutoTransition; +import android.transition.Scene; +import android.transition.Transition; +import android.transition.TransitionManager; + + +public class ScenesTestAutoTransition extends Activity { + ViewGroup mSceneRoot; + static Scene mCurrentScene; + Transition mTransition = new AutoTransition(); + Scene mResultsScreen, mSearchScreen; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.search_screen); + + View container = (View) findViewById(R.id.container); + mSceneRoot = (ViewGroup) container.getParent(); + + mSearchScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.search_screen, this); + mResultsScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.results_screen, this); + } + + public void sendMessage(View view) { + if (mCurrentScene == mResultsScreen) { + TransitionManager.go(mSearchScreen, mTransition); + mCurrentScene = mSearchScreen; + } else { + TransitionManager.go(mResultsScreen, mTransition); + mCurrentScene = mResultsScreen; + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/ScenesTestAutoTransition2.java b/tests/TransitionTests/src/com/android/transitiontests/ScenesTestAutoTransition2.java new file mode 100644 index 0000000..5a9fa9d --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/ScenesTestAutoTransition2.java @@ -0,0 +1,54 @@ +/* + * 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.transition.Scene; +import android.transition.TransitionManager; + + +public class ScenesTestAutoTransition2 extends Activity { + ViewGroup mSceneRoot; + static Scene mCurrentScene; + + Scene mResultsScreen, mSearchScreen; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.search_screen); + + View container = (View) findViewById(R.id.container); + mSceneRoot = (ViewGroup) container.getParent(); + + mSearchScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.search_screen, this); + mResultsScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.results_screen, this); + } + + public void sendMessage(View view) { + if (mCurrentScene == mResultsScreen) { + TransitionManager.go(mSearchScreen); + mCurrentScene = mSearchScreen; + } else { + TransitionManager.go(mResultsScreen); + mCurrentScene = mResultsScreen; + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/ScenesTestv21.java b/tests/TransitionTests/src/com/android/transitiontests/ScenesTestv21.java new file mode 100644 index 0000000..ecf5ef3 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/ScenesTestv21.java @@ -0,0 +1,75 @@ +/* + * 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.transition.ChangeBounds; +import android.view.View; +import android.view.ViewGroup; +import android.transition.Fade; +import android.transition.Recolor; +import android.transition.Scene; +import android.transition.TransitionSet; +import android.transition.TransitionManager; + + +public class ScenesTestv21 extends Activity { + ViewGroup mSceneRoot; + static Scene mCurrentScene; + TransitionManager mTransitionManager = null; + Scene mResultsScreen, mSearchScreen; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.search_screen); + + View container = (View) findViewById(R.id.container); + mSceneRoot = (ViewGroup) container.getParent(); + + mSearchScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.search_screen, this); + mResultsScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.results_screen, this); + + TransitionSet transitionToResults = new TransitionSet(); + Fade fade = new Fade(); + fade.addTarget(R.id.resultsText).addTarget(R.id.resultsList); + fade.setStartDelay(300); + transitionToResults.addTransition(fade); + transitionToResults.addTransition(new ChangeBounds().addTarget(R.id.searchContainer)); + transitionToResults.addTransition(new Recolor().addTarget(R.id.container)); + + TransitionSet transitionToSearch = new TransitionSet(); + transitionToSearch.addTransition(new Fade().addTarget(R.id.resultsText). + addTarget(R.id.resultsList)); + transitionToSearch.addTransition(new ChangeBounds().addTarget(R.id.searchContainer)); + transitionToSearch.addTransition(new Recolor().addTarget(R.id.container)); + mTransitionManager = new TransitionManager(); + mTransitionManager.setTransition(mSearchScreen, transitionToSearch); + mTransitionManager.setTransition(mResultsScreen, transitionToResults); + } + + public void sendMessage(View view) { + if (mCurrentScene == mResultsScreen) { + mTransitionManager.transitionTo(mSearchScreen); + mCurrentScene = mSearchScreen; + } else { + mTransitionManager.transitionTo(mResultsScreen); + mCurrentScene = mResultsScreen; + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/SequenceTest.java b/tests/TransitionTests/src/com/android/transitiontests/SequenceTest.java new file mode 100644 index 0000000..c550e92 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/SequenceTest.java @@ -0,0 +1,80 @@ +/* + * 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.transition.Scene; +import android.transition.Transition; +import android.transition.TransitionSet; +import android.widget.Button; +import android.transition.Fade; +import android.transition.ChangeBounds; +import android.transition.TransitionManager; + + +public class SequenceTest extends Activity { + + Button mRemovingButton, mInvisibleButton, mGoneButton; + Scene mScene1, mScene2; + ViewGroup mSceneRoot; + TransitionSet sequencedFade, reverseSequencedFade; + Scene mCurrentScene; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.fading_test); + + View container = (View) findViewById(R.id.container); + mSceneRoot = (ViewGroup) container.getParent(); + + mRemovingButton = (Button) findViewById(R.id.removingButton); + mInvisibleButton = (Button) findViewById(R.id.invisibleButton); + mGoneButton = (Button) findViewById(R.id.goneButton); + + mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.fading_test, this); + mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.fading_test_scene_2, this); + + Transition fade1 = new Fade().addTarget(R.id.removingButton); + Transition fade2 = new Fade().addTarget(R.id.invisibleButton); + Transition fade3 = new Fade().addTarget(R.id.goneButton); + TransitionSet fader = new TransitionSet(). + setOrdering(TransitionSet.ORDERING_SEQUENTIAL); + fader.addTransition(fade1).addTransition(fade2).addTransition(fade3). + addTransition(new ChangeBounds()); + sequencedFade = fader; + + reverseSequencedFade = new TransitionSet(). + setOrdering(TransitionSet.ORDERING_SEQUENTIAL); + reverseSequencedFade.addTransition(new ChangeBounds()).addTransition(fade3).addTransition(fade2). + addTransition(fade1); + + mCurrentScene = mScene1; + } + + public void sendMessage(View view) { + if (mCurrentScene == mScene1) { + TransitionManager.go(mScene2, sequencedFade); + mCurrentScene = mScene2; + } else { + TransitionManager.go(mScene1, reverseSequencedFade); + mCurrentScene = mScene1; + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/SequenceTestSimple.java b/tests/TransitionTests/src/com/android/transitiontests/SequenceTestSimple.java new file mode 100644 index 0000000..92b169e --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/SequenceTestSimple.java @@ -0,0 +1,75 @@ +/* + * 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.transition.ChangeBounds; +import android.view.View; +import android.view.ViewGroup; +import android.transition.Scene; +import android.transition.TransitionSet; +import android.widget.Button; +import android.transition.Fade; +import android.transition.Transition; +import android.transition.TransitionManager; + + +public class SequenceTestSimple extends Activity { + + Button mRemovingButton, mInvisibleButton, mGoneButton; + Scene mScene1, mScene2; + ViewGroup mSceneRoot; + Transition sequencedFade; + TransitionSet sequencedFadeReverse; + Scene mCurrentScene; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.fading_test_simple); + + View container = (View) findViewById(R.id.container); + mSceneRoot = (ViewGroup) container.getParent(); + + mRemovingButton = (Button) findViewById(R.id.removingButton); + + mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.fading_test_simple, this); + mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.fading_test_simple2, this); + + TransitionSet fader = new TransitionSet(). + setOrdering(TransitionSet.ORDERING_SEQUENTIAL); + fader.addTransition(new Fade().addTarget(R.id.removingButton)); + fader.addTransition(new ChangeBounds().addTarget(R.id.sceneSwitchButton)); + sequencedFade = fader; + + sequencedFadeReverse = new TransitionSet(). + setOrdering(TransitionSet.ORDERING_SEQUENTIAL); + sequencedFadeReverse.addTransition(new ChangeBounds().addTarget(R.id.sceneSwitchButton)); + sequencedFadeReverse.addTransition(new Fade().addTarget(R.id.removingButton)); + + mCurrentScene = mScene1; + } + + public void sendMessage(View view) { + if (mCurrentScene == mScene1) { + TransitionManager.go(mScene2, sequencedFade); + mCurrentScene = mScene2; + } else { + TransitionManager.go(mScene1, sequencedFadeReverse); + mCurrentScene = mScene1; + } + }} diff --git a/tests/TransitionTests/src/com/android/transitiontests/SurfaceAndTextureViews.java b/tests/TransitionTests/src/com/android/transitiontests/SurfaceAndTextureViews.java new file mode 100644 index 0000000..9b246ad --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/SurfaceAndTextureViews.java @@ -0,0 +1,195 @@ +/* + * 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.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.SurfaceTexture; +import android.os.Bundle; +import android.util.AttributeSet; +import android.view.SurfaceHolder; +import android.view.SurfaceView; +import android.view.TextureView; +import android.view.View; +import android.view.ViewGroup; +import android.transition.Crossfade; +import android.transition.ChangeBounds; +import android.transition.Scene; +import android.transition.TransitionSet; +import android.transition.TransitionManager; +import android.widget.Button; + +import static android.widget.LinearLayout.LayoutParams; + +public class SurfaceAndTextureViews extends Activity { + + SimpleView mView; + SimpleSurfaceView mSurfaceView; + SimpleTextureView mTextureView; + private static final int SMALL_SIZE = 200; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.surface_texture_views); + + final ViewGroup container = (ViewGroup) findViewById(R.id.container); + Button toggleButton = (Button) findViewById(R.id.toggleButton); + + mView = new SimpleView(this); + mView.setId(0); + mView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE)); + container.addView(mView); + + mSurfaceView = new SimpleSurfaceView(this); + mSurfaceView.setId(1); + mSurfaceView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE)); + container.addView(mSurfaceView); + + mTextureView = new SimpleTextureView(this); + mTextureView.setId(2); + mTextureView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE)); + container.addView(mTextureView); + + final TransitionSet transition = new TransitionSet(); + transition.addTransition(new ChangeBounds()).addTransition(new Crossfade().addTarget(0). + addTarget(1).addTarget(2)); + + toggleButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Scene newScene = new Scene(container); + newScene.setEnterAction(new Runnable() { + @Override + public void run() { + if (mView.getWidth() <= SMALL_SIZE) { + mView.setLayoutParams(new LayoutParams(SMALL_SIZE * 2, SMALL_SIZE)); + mSurfaceView.setLayoutParams(new LayoutParams(SMALL_SIZE * 2, SMALL_SIZE)); + mTextureView.setLayoutParams(new LayoutParams(SMALL_SIZE * 2, SMALL_SIZE)); + mView.mColor = SimpleView.LARGE_COLOR; + mSurfaceView.mColor = SimpleSurfaceView.LARGE_COLOR; + mTextureView.mColor = SimpleTextureView.LARGE_COLOR; + } else { + mView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE)); + mSurfaceView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE)); + mTextureView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE)); + mView.mColor = SimpleView.SMALL_COLOR; + mSurfaceView.mColor = SimpleSurfaceView.SMALL_COLOR; + mTextureView.mColor = SimpleTextureView.SMALL_COLOR; + } + } + }); + TransitionManager.go(newScene, transition); + } + }); + + } + + static private class SimpleView extends View { + static final int SMALL_COLOR = Color.BLUE; + static final int LARGE_COLOR = Color.YELLOW; + int mColor = SMALL_COLOR; + + private SimpleView(Context context) { + super(context); + } + + @Override + protected void onDraw(Canvas canvas) { + canvas.drawColor(mColor); + } + } + + static private class SimpleSurfaceView extends SurfaceView implements SurfaceHolder.Callback { + + static final int SMALL_COLOR = Color.GREEN; + static final int LARGE_COLOR = Color.GRAY; + int mColor = SMALL_COLOR; + SurfaceHolder mHolder = null; + + private SimpleSurfaceView(Context context) { + super(context); + SurfaceHolder holder = getHolder(); + holder.addCallback(this); + } + + + @Override + public void surfaceCreated(SurfaceHolder holder) { + System.out.println("surfaceCreated"); + } + + @Override + public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { + System.out.println("surfaceChanged: w h = " + width + ", " + height); + Canvas canvas = holder.lockCanvas(); + canvas.drawColor(mColor); + holder.unlockCanvasAndPost(canvas); + } + + @Override + public void surfaceDestroyed(SurfaceHolder holder) { + System.out.println("surfaceDestroyed"); + } + } + + static private class SimpleTextureView extends TextureView implements TextureView.SurfaceTextureListener { + + static final int SMALL_COLOR = Color.RED; + static final int LARGE_COLOR = Color.CYAN; + int mColor = SMALL_COLOR; + + private SimpleTextureView(Context context) { + super(context); + setSurfaceTextureListener(this); + } + + private SimpleTextureView(Context context, AttributeSet attrs) { + super(context, attrs); + setSurfaceTextureListener(this); + } + + private SimpleTextureView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + setSurfaceTextureListener(this); + } + + @Override + public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) { + System.out.println("SurfaceTexture available"); + } + + @Override + public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) { + System.out.println("SurfaceTexture size changed to " + width + ", " + height); + Canvas canvas = lockCanvas(); + canvas.drawColor(mColor); + unlockCanvasAndPost(canvas); + } + + @Override + public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) { + return false; + } + + @Override + public void onSurfaceTextureUpdated(SurfaceTexture surface) { + System.out.println("SurfaceTexture updated"); + } + } +} diff --git a/tests/TransitionTests/src/com/android/transitiontests/UniqueIds.java b/tests/TransitionTests/src/com/android/transitiontests/UniqueIds.java new file mode 100644 index 0000000..c824956 --- /dev/null +++ b/tests/TransitionTests/src/com/android/transitiontests/UniqueIds.java @@ -0,0 +1,85 @@ +/* + * 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.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.transition.Scene; +import android.transition.Transition; +import android.widget.Button; +import android.widget.LinearLayout; +import android.transition.TransitionManager; + + +import java.util.HashMap; + +public class UniqueIds extends Activity { + ViewGroup mSceneRoot; + static Scene mCurrentScene; + TransitionManager mTransitionManager = null; + HashMap<Button, ToggleScene> mSceneMap = new HashMap<Button, ToggleScene>(); + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.unique_id_test); + + LinearLayout container = (LinearLayout) findViewById(R.id.container); + LayoutInflater inflater = getLayoutInflater(); + Button button = (Button) inflater.inflate(R.layout.button_template, null); + container.addView(button); + ToggleScene scene = new ToggleScene(container, button); + mSceneMap.put(button, scene); + button = (Button) inflater.inflate(R.layout.button_template, null); + container.addView(button); + scene = new ToggleScene(container, button); + mSceneMap.put(button, scene); + } + + public void sendMessage(View view) { + mSceneMap.get(view).changeToScene(); + } + + class ToggleScene { + Scene mScene; + Transition mTransition; + Button mButton; + + ToggleScene(ViewGroup rootView, Button button) { + mScene = new Scene(rootView); + mButton = button; + mScene.setEnterAction(new Runnable() { + @Override + public void run() { + if (mButton.getLeft() == 0) { + mButton.offsetLeftAndRight(500); + } else { + int width = mButton.getWidth(); + mButton.setLeft(0); + mButton.setRight(width); + } + } + }); + } + + void changeToScene() { + TransitionManager.go(mScene); + } + } +} |