Skip to content

Commit 94da13d

Browse files
committed
Added circular propagation example
1 parent 5523fcb commit 94da13d

File tree

3 files changed

+65
-3
lines changed

3 files changed

+65
-3
lines changed

app/src/main/java/com/saulmm/material/MyActivity.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.content.Intent;
66
import android.graphics.Outline;
77
import android.os.Bundle;
8+
import android.transition.CircularPropagation;
89
import android.transition.Explode;
910
import android.transition.Scene;
1011
import android.transition.Slide;
@@ -30,13 +31,19 @@ protected void onCreate(Bundle savedInstanceState) {
3031
super.onCreate(savedInstanceState);
3132
setContentView(R.layout.activity_my);
3233

34+
Explode ex = new Explode();
35+
ex.setPropagation(new CircularPropagation());
36+
37+
getWindow().setExitTransition(ex);
38+
getWindow().setEnterTransition(ex);
39+
3340
// Fab Button
3441
int fabSize = getResources().getDimensionPixelSize(R.dimen.fab_size);
3542
Outline fabOutLine = new Outline();
3643
fabOutLine.setOval(0, 0, fabSize, fabSize);
3744

3845
// Fragment container
39-
frameContainer = (FrameLayout) findViewById(R.id.container);
46+
frameContainer = (FrameLayout) findViewById(R.id.container);
4047

4148
holderView = findViewById(R.id.holder_view);
4249

@@ -54,8 +61,9 @@ public void onClick(View view) {
5461
Pair.create(holderView, "holder2"),
5562
Pair.create(fabButton, "fab"));
5663

64+
5765
Intent i = new Intent (MyActivity.this, MyActivity2.class);
58-
startActivity(i, options.toBundle());
66+
startActivity(i);
5967
}
6068
};
6169
}

app/src/main/java/com/saulmm/material/MyActivity2.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.graphics.Outline;
66
import android.os.Bundle;
77
import android.transition.ChangeBounds;
8+
import android.transition.CircularPropagation;
89
import android.transition.Explode;
910
import android.transition.Scene;
1011
import android.transition.Slide;
@@ -27,6 +28,12 @@ protected void onCreate(Bundle savedInstanceState) {
2728
// Fab Button
2829
int fabSize = getResources().getDimensionPixelSize(R.dimen.fab_size);
2930
Outline fabOutLine = new Outline();
31+
32+
Explode ex = new Explode();
33+
ex.setPropagation(new CircularPropagation());
34+
35+
getWindow().setExitTransition(ex);
36+
getWindow().setEnterTransition(ex);
3037
fabOutLine.setOval(0, 0, fabSize, fabSize);
3138
}
3239

app/src/main/res/layout/activity_my.xml

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
android:layout_width="match_parent"
44
android:layout_height="match_parent"
55
android:paddingBottom="@dimen/activity_vertical_margin"
6-
76
tools:context=".MyActivity"
87
>
98

@@ -30,4 +29,52 @@
3029
android:layout_alignParentEnd="true"
3130
/>
3231

32+
<RelativeLayout
33+
android:layout_width="match_parent"
34+
android:layout_height="match_parent"
35+
android:paddingRight="@dimen/activity_horizontal_margin"
36+
android:paddingLeft="@dimen/activity_horizontal_margin"
37+
android:paddingTop="@dimen/activity_horizontal_margin"
38+
android:layout_below="@id/holder_view">
39+
40+
<Button
41+
android:layout_width="150dp"
42+
android:layout_height="60dp"
43+
android:text=""
44+
android:id="@+id/button"
45+
android:layout_below="@+id/button4"
46+
android:layout_toStartOf="@+id/button5"
47+
android:layout_marginTop="44dp" />
48+
49+
<Button
50+
android:layout_width="150dp"
51+
android:layout_height="60dp"
52+
android:text=""
53+
android:id="@+id/button2"
54+
android:layout_below="@+id/button"
55+
android:layout_centerHorizontal="true"
56+
android:layout_marginTop="54dp" />
57+
58+
<Button
59+
android:layout_width="150dp"
60+
android:layout_height="60dp"
61+
android:id="@+id/button3"
62+
android:layout_alignParentBottom="true"
63+
android:layout_toStartOf="@+id/button2" />
64+
65+
<Button
66+
android:layout_width="150dp"
67+
android:layout_height="60dp"
68+
android:id="@+id/button4"
69+
android:layout_alignParentStart="true" />
70+
71+
<Button
72+
android:layout_width="150dp"
73+
android:layout_height="60dp"
74+
android:id="@+id/button5"
75+
android:layout_alignParentBottom="true"
76+
android:layout_toEndOf="@+id/button2" />
77+
78+
</RelativeLayout>
79+
3380
</RelativeLayout>

0 commit comments

Comments
 (0)