Skip to content

Commit

Permalink
Refactored explode transition & removed unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
saulmm committed Oct 16, 2014
1 parent 94da13d commit a74b19e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
14 changes: 3 additions & 11 deletions app/src/main/java/com/saulmm/material/MyActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my);

Explode ex = new Explode();
ex.setPropagation(new CircularPropagation());

getWindow().setExitTransition(ex);
getWindow().setEnterTransition(ex);
Utils.configureWindowEnterExitTransition(getWindow());;

// Fab Button
int fabSize = getResources().getDimensionPixelSize(R.dimen.fab_size);
Expand All @@ -57,13 +53,9 @@ protected void onCreate(Bundle savedInstanceState) {
View.OnClickListener fabClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(MyActivity.this,
Pair.create(holderView, "holder2"),
Pair.create(fabButton, "fab"));


Intent i = new Intent (MyActivity.this, MyActivity2.class);
startActivity(i);
Intent i = new Intent (MyActivity.this, MyActivity2.class);
startActivity(i);
}
};
}
5 changes: 1 addition & 4 deletions app/src/main/java/com/saulmm/material/MyActivity2.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,8 @@ protected void onCreate(Bundle savedInstanceState) {
int fabSize = getResources().getDimensionPixelSize(R.dimen.fab_size);
Outline fabOutLine = new Outline();

Explode ex = new Explode();
ex.setPropagation(new CircularPropagation());
Utils.configureWindowEnterExitTransition(getWindow());

getWindow().setExitTransition(ex);
getWindow().setEnterTransition(ex);
fabOutLine.setOval(0, 0, fabSize, fabSize);
}

Expand Down
24 changes: 24 additions & 0 deletions app/src/main/java/com/saulmm/material/Utils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.saulmm.material;

import android.transition.CircularPropagation;
import android.transition.Explode;
import android.view.Window;

/**
* Created by saulmm on 16/10/14.
*/
public class Utils {

public static void configureWindowEnterExitTransition (Window w) {

Explode ex = new Explode();

CircularPropagation c = new CircularPropagation();
c.setPropagationSpeed(2f);

ex.setPropagation(c);

w.setExitTransition(ex);
w.setEnterTransition(ex);
}
}

0 comments on commit a74b19e

Please sign in to comment.