1
1
package yalantis .com .sidemenu .sample ;
2
2
3
+ import android .animation .Animator ;
3
4
import android .content .res .Configuration ;
4
5
import android .graphics .Color ;
5
6
import android .graphics .drawable .BitmapDrawable ;
17
18
import java .util .ArrayList ;
18
19
import java .util .List ;
19
20
20
- import io .codetail .animation .SupportAnimator ;
21
21
import io .codetail .animation .ViewAnimationUtils ;
22
22
import yalantis .com .sidemenu .interfaces .Resourceble ;
23
23
import yalantis .com .sidemenu .interfaces .ScreenShotable ;
@@ -30,7 +30,6 @@ public class MainActivity extends AppCompatActivity implements ViewAnimator.View
30
30
private DrawerLayout drawerLayout ;
31
31
private ActionBarDrawerToggle drawerToggle ;
32
32
private List <SlideMenuItem > list = new ArrayList <>();
33
- private ContentFragment contentFragment ;
34
33
private ViewAnimator viewAnimator ;
35
34
private int res = R .drawable .content_music ;
36
35
private LinearLayout linearLayout ;
@@ -40,13 +39,13 @@ public class MainActivity extends AppCompatActivity implements ViewAnimator.View
40
39
protected void onCreate (Bundle savedInstanceState ) {
41
40
super .onCreate (savedInstanceState );
42
41
setContentView (R .layout .activity_main );
43
- contentFragment = ContentFragment .newInstance (R .drawable .content_music );
42
+ ContentFragment contentFragment = ContentFragment .newInstance (R .drawable .content_music );
44
43
getSupportFragmentManager ().beginTransaction ()
45
44
.replace (R .id .content_frame , contentFragment )
46
45
.commit ();
47
- drawerLayout = ( DrawerLayout ) findViewById (R .id .drawer_layout );
46
+ drawerLayout = findViewById (R .id .drawer_layout );
48
47
drawerLayout .setScrimColor (Color .TRANSPARENT );
49
- linearLayout = ( LinearLayout ) findViewById (R .id .left_drawer );
48
+ linearLayout = findViewById (R .id .left_drawer );
50
49
linearLayout .setOnClickListener (new View .OnClickListener () {
51
50
@ Override
52
51
public void onClick (View v ) {
@@ -81,7 +80,7 @@ private void createMenuList() {
81
80
82
81
83
82
private void setActionBar () {
84
- Toolbar toolbar = ( Toolbar ) findViewById (R .id .toolbar );
83
+ Toolbar toolbar = findViewById (R .id .toolbar );
85
84
setSupportActionBar (toolbar );
86
85
getSupportActionBar ().setHomeButtonEnabled (true );
87
86
getSupportActionBar ().setDisplayHomeAsUpEnabled (true );
@@ -112,7 +111,7 @@ public void onDrawerOpened(View drawerView) {
112
111
super .onDrawerOpened (drawerView );
113
112
}
114
113
};
115
- drawerLayout .setDrawerListener (drawerToggle );
114
+ drawerLayout .addDrawerListener (drawerToggle );
116
115
}
117
116
118
117
@ Override
@@ -151,11 +150,11 @@ private ScreenShotable replaceFragment(ScreenShotable screenShotable, int topPos
151
150
this .res = this .res == R .drawable .content_music ? R .drawable .content_films : R .drawable .content_music ;
152
151
View view = findViewById (R .id .content_frame );
153
152
int finalRadius = Math .max (view .getWidth (), view .getHeight ());
154
- SupportAnimator animator = ViewAnimationUtils .createCircularReveal (view , 0 , topPosition , 0 , finalRadius );
153
+ Animator animator = ViewAnimationUtils .createCircularReveal (view , 0 , topPosition , 0 , finalRadius );
155
154
animator .setInterpolator (new AccelerateInterpolator ());
156
155
animator .setDuration (ViewAnimator .CIRCULAR_REVEAL_ANIMATION_DURATION );
157
156
158
- findViewById (R .id .content_overlay ).setBackgroundDrawable (new BitmapDrawable (getResources (), screenShotable .getBitmap ()));
157
+ findViewById (R .id .content_overlay ).setBackground (new BitmapDrawable (getResources (), screenShotable .getBitmap ()));
159
158
animator .start ();
160
159
ContentFragment contentFragment = ContentFragment .newInstance (this .res );
161
160
getSupportFragmentManager ().beginTransaction ().replace (R .id .content_frame , contentFragment ).commit ();
0 commit comments