From 0a458494f7bd51a01f90e939ddcf22cbbbd08ecc Mon Sep 17 00:00:00 2001 From: gmathi Date: Wed, 28 Aug 2013 16:26:08 -0500 Subject: [PATCH 1/5] Update Activity1.java Adding a intentExtra to tell the Activity2 to do split animation. --- src/com/udinic/ActivitySplitAnimation/Activity1.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/com/udinic/ActivitySplitAnimation/Activity1.java b/src/com/udinic/ActivitySplitAnimation/Activity1.java index 678fe28..77330a4 100644 --- a/src/com/udinic/ActivitySplitAnimation/Activity1.java +++ b/src/com/udinic/ActivitySplitAnimation/Activity1.java @@ -16,7 +16,9 @@ public void onCreate(Bundle savedInstanceState) { @Override public void onClick(View v) { - ActivitySplitAnimationUtil.startActivity(Activity1.this, new Intent(Activity1.this, Activity2.class)); + Intent i = new Intent(Activity1.this, Activity2.class); + i.putExtra("doSplitAnimation", true); + ActivitySplitAnimationUtil.startActivity(Activity1.this, ); } }); } From 1ce097a680a5b0b0cb664c1c829f9fc0d95aa81d Mon Sep 17 00:00:00 2001 From: gmathi Date: Wed, 28 Aug 2013 16:26:19 -0500 Subject: [PATCH 2/5] Update Activity1.java --- src/com/udinic/ActivitySplitAnimation/Activity1.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/udinic/ActivitySplitAnimation/Activity1.java b/src/com/udinic/ActivitySplitAnimation/Activity1.java index 77330a4..4f3e144 100644 --- a/src/com/udinic/ActivitySplitAnimation/Activity1.java +++ b/src/com/udinic/ActivitySplitAnimation/Activity1.java @@ -17,7 +17,7 @@ public void onCreate(Bundle savedInstanceState) { @Override public void onClick(View v) { Intent i = new Intent(Activity1.this, Activity2.class); - i.putExtra("doSplitAnimation", true); + i.putExtra("doSplitAnimation", true); ActivitySplitAnimationUtil.startActivity(Activity1.this, ); } }); From 5cedd209cb5f07ff102dbc780fb943bcc1e7209d Mon Sep 17 00:00:00 2001 From: gmathi Date: Wed, 28 Aug 2013 16:41:14 -0500 Subject: [PATCH 3/5] Update Activity2.java --- .../ActivitySplitAnimation/Activity2.java | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/com/udinic/ActivitySplitAnimation/Activity2.java b/src/com/udinic/ActivitySplitAnimation/Activity2.java index d9245f8..7ec0116 100644 --- a/src/com/udinic/ActivitySplitAnimation/Activity2.java +++ b/src/com/udinic/ActivitySplitAnimation/Activity2.java @@ -9,14 +9,32 @@ public class Activity2 extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - - // Preparing the 2 images to be split - ActivitySplitAnimationUtil.prepareAnimation(this); + + // Get intent information for the split animation + Intent i = getIntent(); + boolean animate = i.getBooleanExtra("fromLoginActivity", false); + // Once the doSplitAnimation extra has been read, we remoe it from intent so + // that the animation doesn't occur or other instances of onCreate() being + // called such as rotation. + if (i.hasExtra("doSplitAnimation")) + i.removeExtra("doSplitAnimation"); + + // Use split animation on if onCreate() is called from other activity. This + // is to counter the case of this onCreate being called when there is a + // rotation. + if (animate) + // Preparing the 2 images to be split + ActivitySplitAnimationUtil.prepareAnimation(this); setContentView(R.layout.act_two); - // Animating the items to be open, revealing the new activity - ActivitySplitAnimationUtil.animate(this, 1000); + // Use split animation on if onCreate() is called from other activity. This + // is to counter the case of this onCreate being called when there is a + // rotation. + if (animate) + // Animating the items to be open, revealing the new activity, with + // the animation duration as 1 sec. + ActivitySplitAnimationUtil.animate(this, 1000); } @Override From 172be1b741c61bd3727052d2d2bb051291533d0c Mon Sep 17 00:00:00 2001 From: gmathi Date: Wed, 28 Aug 2013 16:43:41 -0500 Subject: [PATCH 4/5] Update Activity2.java Formatted and Updated code to prevent app crash from rotation. --- .../ActivitySplitAnimation/Activity2.java | 47 ++++++++++--------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/src/com/udinic/ActivitySplitAnimation/Activity2.java b/src/com/udinic/ActivitySplitAnimation/Activity2.java index 7ec0116..96c6ffd 100644 --- a/src/com/udinic/ActivitySplitAnimation/Activity2.java +++ b/src/com/udinic/ActivitySplitAnimation/Activity2.java @@ -9,32 +9,33 @@ public class Activity2 extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - - // Get intent information for the split animation - Intent i = getIntent(); - boolean animate = i.getBooleanExtra("fromLoginActivity", false); - // Once the doSplitAnimation extra has been read, we remoe it from intent so - // that the animation doesn't occur or other instances of onCreate() being - // called such as rotation. - if (i.hasExtra("doSplitAnimation")) - i.removeExtra("doSplitAnimation"); - - // Use split animation on if onCreate() is called from other activity. This - // is to counter the case of this onCreate being called when there is a - // rotation. - if (animate) - // Preparing the 2 images to be split - ActivitySplitAnimationUtil.prepareAnimation(this); + + // Get intent information for the split animation + Intent i = getIntent(); + boolean animate = i.getBooleanExtra("fromLoginActivity", false); + + // Once the doSplitAnimation extra has been read, we remoe it from intent so + // that the animation doesn't occur or other instances of onCreate() being + // called such as rotation. + if (i.hasExtra("doSplitAnimation")) + i.removeExtra("doSplitAnimation"); + + // Use split animation on if onCreate() is called from other activity. This + // is to counter the case of this onCreate being called when there is a + // rotation. + if (animate) + // Preparing the 2 images to be split + ActivitySplitAnimationUtil.prepareAnimation(this); setContentView(R.layout.act_two); - // Use split animation on if onCreate() is called from other activity. This - // is to counter the case of this onCreate being called when there is a - // rotation. - if (animate) - // Animating the items to be open, revealing the new activity, with - // the animation duration as 1 sec. - ActivitySplitAnimationUtil.animate(this, 1000); + // Use split animation on if onCreate() is called from other activity. This + // is to counter the case of this onCreate being called when there is a + // rotation. + if (animate) + // Animating the items to be open, revealing the new activity, with + // the animation duration as 1 sec. + ActivitySplitAnimationUtil.animate(this, 1000); } @Override From 26fd56b966e7333b71004a124dcc37b8a7d22d67 Mon Sep 17 00:00:00 2001 From: gmathi Date: Wed, 28 Aug 2013 16:45:04 -0500 Subject: [PATCH 5/5] Update Activity2.java --- src/com/udinic/ActivitySplitAnimation/Activity2.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/udinic/ActivitySplitAnimation/Activity2.java b/src/com/udinic/ActivitySplitAnimation/Activity2.java index 96c6ffd..d141b2a 100644 --- a/src/com/udinic/ActivitySplitAnimation/Activity2.java +++ b/src/com/udinic/ActivitySplitAnimation/Activity2.java @@ -12,7 +12,7 @@ protected void onCreate(Bundle savedInstanceState) { // Get intent information for the split animation Intent i = getIntent(); - boolean animate = i.getBooleanExtra("fromLoginActivity", false); + boolean animate = i.getBooleanExtra("doSplitAnimation", false); // Once the doSplitAnimation extra has been read, we remoe it from intent so // that the animation doesn't occur or other instances of onCreate() being