@@ -26,8 +26,6 @@ public class HomeActivity extends AppCompatActivity implements View.OnClickListe
26
26
ImageView imageView ;
27
27
28
28
FloatingActionButton fab ;
29
- RelativeLayout relativeLayout_fabs ;
30
-
31
29
FloatingActionButton fab_library ;
32
30
FloatingActionButton fab_xerox ;
33
31
@@ -42,21 +40,20 @@ protected void onCreate(Bundle savedInstanceState) {
42
40
43
41
setContentView (R .layout .activity_home );
44
42
45
- fab = ( FloatingActionButton ) findViewById (R .id .fab );
46
- fab_library = ( FloatingActionButton ) findViewById (R .id .fab_library );
47
- fab_xerox = ( FloatingActionButton ) findViewById (R .id .fab_xerox );
43
+ fab = findViewById (R .id .fab );
44
+ fab_library = findViewById (R .id .fab_library );
45
+ fab_xerox = findViewById (R .id .fab_xerox );
48
46
49
47
fab .setOnClickListener (new View .OnClickListener () {
50
48
@ Override
51
49
public void onClick (View view ) {
52
- RotateAnimation rotateAnimation = new RotateAnimation (fromDegrees , fromDegrees = fromDegrees + 135 , fab .getWidth ()/ 2 , fab .getHeight ()/ 2 );
50
+ RotateAnimation rotateAnimation = new RotateAnimation (fromDegrees , fromDegrees = fromDegrees + 135 , fab .getWidth () / 2 , fab .getHeight () / 2 );
53
51
rotateAnimation .setDuration (200 );
54
52
rotateAnimation .setFillEnabled (true );
55
53
rotateAnimation .setFillAfter (true );
56
54
fab .setAnimation (rotateAnimation );
57
55
58
56
if ((fab_library .getVisibility () == View .INVISIBLE ) || (fab_xerox .getVisibility () == View .INVISIBLE )) {
59
-
60
57
// get the center for the clipping circle
61
58
int cx = fab_xerox .getWidth () / 2 ;
62
59
int cy = fab_xerox .getHeight () / 2 ;
@@ -68,11 +65,11 @@ public void onClick(View view) {
68
65
final Animator anim = ViewAnimationUtils .createCircularReveal (fab_xerox , cx , cy , 0 , finalRadius );
69
66
70
67
// make the view visible and start the animation
71
- fab_xerox .setVisibility (View .VISIBLE );
68
+ // fab_xerox.setVisibility(View.VISIBLE);
69
+ fab_xerox .show ();
72
70
73
71
anim .setDuration (200 );
74
72
anim .start ();
75
-
76
73
anim .addListener (new AnimatorListenerAdapter () {
77
74
@ Override
78
75
public void onAnimationEnd (Animator animation ) {
@@ -89,13 +86,13 @@ public void onAnimationEnd(Animator animation) {
89
86
ViewAnimationUtils .createCircularReveal (fab_library , cx , cy , 0 , finalRadius );
90
87
91
88
// make the view visible and start the animation
92
- fab_library .setVisibility (View .VISIBLE );
89
+ // fab_library.setVisibility(View.VISIBLE);
90
+ fab_library .show ();
93
91
anim .setDuration (200 );
94
92
anim .start ();
95
93
}
96
94
});
97
- }
98
- else {
95
+ } else {
99
96
final View myView = fab_library ;
100
97
101
98
int cx = myView .getWidth () / 2 ;
@@ -105,19 +102,16 @@ public void onAnimationEnd(Animator animation) {
105
102
106
103
Animator anim =
107
104
ViewAnimationUtils .createCircularReveal (myView , cx , cy , initialRadius , 0 );
108
-
109
105
anim .addListener (new AnimatorListenerAdapter () {
110
106
@ Override
111
107
public void onAnimationEnd (Animator animation ) {
112
108
super .onAnimationEnd (animation );
113
109
myView .setVisibility (View .INVISIBLE );
114
110
}
115
111
});
116
-
117
112
anim .setDuration (200 );
118
113
// start the animation
119
114
anim .start ();
120
-
121
115
anim .addListener (new AnimatorListenerAdapter () {
122
116
@ Override
123
117
public void onAnimationEnd (Animator animation ) {
@@ -130,15 +124,13 @@ public void onAnimationEnd(Animator animation) {
130
124
float initialRadius = (float ) Math .hypot (cx , cy );
131
125
132
126
Animator anim = ViewAnimationUtils .createCircularReveal (myView , cx , cy , initialRadius , 0 );
133
-
134
127
anim .addListener (new AnimatorListenerAdapter () {
135
128
@ Override
136
129
public void onAnimationEnd (Animator animation ) {
137
130
super .onAnimationEnd (animation );
138
131
myView .setVisibility (View .INVISIBLE );
139
132
}
140
133
});
141
-
142
134
anim .setDuration (200 );
143
135
// start the animation
144
136
anim .start ();
@@ -148,15 +140,15 @@ public void onAnimationEnd(Animator animation) {
148
140
}
149
141
});
150
142
151
- final Button button_home = ( Button ) findViewById (R .id .button_home );
143
+ final Button button_home = findViewById (R .id .button_home );
152
144
button_home .setOnClickListener (this );
153
- Button button_timeline = ( Button ) findViewById (R .id .button_timeline );
145
+ Button button_timeline = findViewById (R .id .button_timeline );
154
146
button_timeline .setOnClickListener (this );
155
- final Button button_reminders = ( Button ) findViewById (R .id .button_reminders );
147
+ final Button button_reminders = findViewById (R .id .button_reminders );
156
148
button_reminders .setOnClickListener (this );
157
149
158
- imageView_user = ( ImageView ) findViewById (R .id .imageView_user );
159
- imageView = ( ImageView ) findViewById (R .id .imageView );
150
+ imageView_user = findViewById (R .id .imageView_user );
151
+ imageView = findViewById (R .id .imageView );
160
152
imageView .setOnClickListener (new View .OnClickListener () {
161
153
@ Override
162
154
public void onClick (View v ) {
@@ -194,39 +186,39 @@ public void onClick(View v) {
194
186
195
187
@ Override
196
188
public void onFragmentInteraction (Uri uri ) {
197
-
198
189
}
199
190
200
191
@ Override
201
192
public void onClick (View v ) {
202
- switch (v .getId ()){
193
+ switch (v .getId ()) {
203
194
case R .id .button_home :
204
195
HomeFragment homeFragment = new HomeFragment ();
205
196
getSupportFragmentManager ().beginTransaction ()
206
197
.replace (R .id .frameLayout_home , homeFragment ).commit ();
207
- Toast .makeText (this , "button home " , Toast .LENGTH_SHORT ).show ();
198
+ Toast .makeText (this , "Button Home " , Toast .LENGTH_SHORT ).show ();
208
199
break ;
209
200
case R .id .button_timeline :
210
201
TimelineFragment timelineFragment = new TimelineFragment ();
211
202
getSupportFragmentManager ().beginTransaction ()
212
203
.replace (R .id .frameLayout_home , timelineFragment ).commit ();
213
- Toast .makeText (this , "button timeline " , Toast .LENGTH_SHORT ).show ();
204
+ Toast .makeText (this , "Button Timeline " , Toast .LENGTH_SHORT ).show ();
214
205
break ;
215
206
case R .id .button_reminders :
216
- Toast .makeText (this , "button reminders " , Toast .LENGTH_SHORT ).show ();
207
+ Toast .makeText (this , "Button Reminders " , Toast .LENGTH_SHORT ).show ();
217
208
break ;
218
209
case R .id .fab_xerox :
219
210
break ;
220
211
case R .id .fab_library :
221
212
break ;
222
- default : break ;
213
+ default :
214
+ break ;
223
215
}
224
216
}
225
217
226
218
@ Override
227
219
public void onBackPressed () {
228
- if ((fab_library .getVisibility () == View .VISIBLE ) || (fab_xerox .getVisibility () == View .VISIBLE )){
229
- RotateAnimation rotateAnimation = new RotateAnimation (fromDegrees , fromDegrees = fromDegrees + 135 , fab .getWidth ()/ 2 , fab .getHeight ()/ 2 );
220
+ if ((fab_library .getVisibility () == View .VISIBLE ) || (fab_xerox .getVisibility () == View .VISIBLE )) {
221
+ RotateAnimation rotateAnimation = new RotateAnimation (fromDegrees , fromDegrees = fromDegrees + 135 , fab .getWidth () / 2 , fab .getHeight () / 2 );
230
222
rotateAnimation .setDuration (200 );
231
223
rotateAnimation .setFillEnabled (true );
232
224
rotateAnimation .setFillAfter (true );
@@ -280,8 +272,7 @@ public void onAnimationEnd(Animator animation) {
280
272
anim .start ();
281
273
}
282
274
});
283
- }
284
- else
275
+ } else
285
276
super .onBackPressed ();
286
277
}
287
278
}
0 commit comments