Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/com/udinic/ActivitySplitAnimation/Activity1.java
Original file line number Diff line number Diff line change
Expand Up @@ -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, );
}
});
}
Expand Down
29 changes: 24 additions & 5 deletions src/com/udinic/ActivitySplitAnimation/Activity2.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,33 @@ 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("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
// 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
Expand Down