Skip to content

Commit

Permalink
Added a cusomt transition demo. In this demo I simply turn off the tr…
Browse files Browse the repository at this point in the history
…ansition but this demo can now be used to try ou tany other transition quickly in future.
  • Loading branch information
Kevin McDonagh committed Oct 14, 2011
1 parent 6997f74 commit 87af9a8
Show file tree
Hide file tree
Showing 18 changed files with 326 additions and 0 deletions.
20 changes: 20 additions & 0 deletions CustomActivityTransition/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0" package="novoda.demo">
<uses-sdk android:minSdkVersion="4" />

<application android:icon="@drawable/icon" android:theme="@style/Theme.Demo" android:label="@string/app_name">
<activity android:name=".TransitionFromThis"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ToThis"
android:label="@string/app_name">
</activity>

</application>
</manifest>
40 changes: 40 additions & 0 deletions CustomActivityTransition/proguard.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
native <methods>;
}

-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}

-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
25 changes: 25 additions & 0 deletions CustomActivityTransition/res/anim/activity_close_enter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2009, 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.
*/
-->

<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/decelerate_interpolator"
android:zAdjustment="top">
<translate android:fromXDelta="-100%" android:toXDelta="0"
android:duration="@android:integer/config_shortAnimTime"/>
</set>
24 changes: 24 additions & 0 deletions CustomActivityTransition/res/anim/activity_close_exit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2009, 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.
*/
-->

<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/decelerate_interpolator">
<translate android:fromXDelta="0%" android:toXDelta="33%"
android:duration="@android:integer/config_shortAnimTime"/>
</set>
24 changes: 24 additions & 0 deletions CustomActivityTransition/res/anim/activity_open_enter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2009, 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.
*/
-->

<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/decelerate_interpolator">
<translate android:fromXDelta="33%" android:toXDelta="0"
android:duration="@android:integer/config_shortAnimTime"/>
</set>
25 changes: 25 additions & 0 deletions CustomActivityTransition/res/anim/activity_open_exit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2009, 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.
*/
-->

<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/decelerate_interpolator"
android:zAdjustment="top">
<translate android:fromXDelta="0%" android:toXDelta="-100%"
android:duration="@android:integer/config_shortAnimTime"/>
</set>
21 changes: 21 additions & 0 deletions CustomActivityTransition/res/anim/decelerate_interpolator.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/res/anim/ease_in_out_interpolator.xml
**
** Copyright 2007, 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.
*/
-->

<accelerateDecelerateInterpolator />
6 changes: 6 additions & 0 deletions CustomActivityTransition/res/anim/fadein.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<alpha android:fromAlpha="1.0"
android:toAlpha="0.0"
android:duration="500"/> //Time in milliseconds
</set>
6 changes: 6 additions & 0 deletions CustomActivityTransition/res/anim/fadeout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<alpha android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="500"/>
</set>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions CustomActivityTransition/res/layout/act_transition_from_this.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?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">

<Button
android:id="@+id/btn"
android:text="transition animation"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />

</LinearLayout>
36 changes: 36 additions & 0 deletions CustomActivityTransition/res/layout/act_transition_to_this.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?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"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>

</LinearLayout>
5 changes: 5 additions & 0 deletions CustomActivityTransition/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, ActivityTransitionActivity!</string>
<string name="app_name">ActivityTransition</string>
</resources>
47 changes: 47 additions & 0 deletions CustomActivityTransition/res/values/styles_master.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
STLYING KEY
_THEME
_WIDTH_HEIGHT
-->
<!-- _THEME -->
<style name="Theme" parent="android:Theme" />
<style name="Theme.Demo" parent="android:style/Theme.Light">
<item name="android:windowNoTitle">true</item>
<!-- <item name="android:windowContentOverlay">@null</item> -->
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:windowAnimationStyle">@style/Animation.ActivityTransition</item>
</style>


<!-- Base style for animations. This style specifies no animations. -->
<style name="Animation" />

<!-- Standard animations for a full-screen window or activity. -->
<style name="Animation.ActivityTransition" parent="@android:style/Animation.Activity">
<item name="android:activityOpenEnterAnimation">@null</item>
<item name="android:activityOpenExitAnimation">@null</item>
<item name="android:activityCloseEnterAnimation">@anim/activity_close_enter</item>
<item name="android:activityCloseExitAnimation">@anim/activity_close_exit</item>
<!-- <item name="android:taskOpenEnterAnimation">@android:anim/task_open_enter</item> -->
<!-- <item name="android:taskOpenExitAnimation">@android:anim/task_open_exit</item> -->
<!-- <item name="android:taskCloseEnterAnimation">@android:anim/task_close_enter</item> -->
<!-- <item name="android:taskCloseExitAnimation">@android:anim/task_close_exit</item> -->
<!-- <item name="android:taskToFrontEnterAnimation">@android:anim/task_open_enter</item> -->
<!-- <item name="android:taskToFrontExitAnimation">@android:anim/task_open_exit</item> -->
<!-- <item name="android:taskToBackEnterAnimation">@android:anim/task_close_enter</item> -->
<!-- <item name="android:taskToBackExitAnimation">@android:anim/task_close_exit</item> -->
<!-- <item name="android:wallpaperOpenEnterAnimation">@android:anim/wallpaper_open_enter</item> -->
<!-- <item name="android:wallpaperOpenExitAnimation">@android:anim/wallpaper_open_exit</item> -->
<!-- <item name="android:wallpaperCloseEnterAnimation">@android:anim/wallpaper_close_enter</item> -->
<!-- <item name="android:wallpaperCloseExitAnimation">@android:anim/wallpaper_close_exit</item> -->
<!-- <item name="android:wallpaperIntraOpenEnterAnimation">@android:anim/wallpaper_intra_open_enter</item> -->
<!-- <item name="android:wallpaperIntraOpenExitAnimation">@android:anim/wallpaper_intra_open_exit</item> -->
<!-- <item name="android:wallpaperIntraCloseEnterAnimation">@android:anim/wallpaper_intra_close_enter</item> -->
<!-- <item name="android:wallpaperIntraCloseExitAnimation">@android:anim/wallpaper_intra_close_exit</item> -->
</style>

</resources>
12 changes: 12 additions & 0 deletions CustomActivityTransition/src/novoda/demo/ToThis.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package novoda.demo;

import android.app.Activity;
import android.os.Bundle;

public class ToThis extends Activity{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.act_transition_to_this);
}
}
22 changes: 22 additions & 0 deletions CustomActivityTransition/src/novoda/demo/TransitionFromThis.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package novoda.demo;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

public class TransitionFromThis extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.act_transition_from_this);

findViewById(R.id.btn).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(TransitionFromThis.this, ToThis.class));
}
});
}
}

0 comments on commit 87af9a8

Please sign in to comment.