11package yalantis .com .sidemenu .sample ;
22
3+ import android .animation .Animator ;
34import android .content .res .Configuration ;
45import android .graphics .Color ;
56import android .graphics .drawable .BitmapDrawable ;
1718import java .util .ArrayList ;
1819import java .util .List ;
1920
20- import io .codetail .animation .SupportAnimator ;
2121import io .codetail .animation .ViewAnimationUtils ;
2222import yalantis .com .sidemenu .interfaces .Resourceble ;
2323import yalantis .com .sidemenu .interfaces .ScreenShotable ;
@@ -30,7 +30,6 @@ public class MainActivity extends AppCompatActivity implements ViewAnimator.View
3030 private DrawerLayout drawerLayout ;
3131 private ActionBarDrawerToggle drawerToggle ;
3232 private List <SlideMenuItem > list = new ArrayList <>();
33- private ContentFragment contentFragment ;
3433 private ViewAnimator viewAnimator ;
3534 private int res = R .drawable .content_music ;
3635 private LinearLayout linearLayout ;
@@ -40,13 +39,13 @@ public class MainActivity extends AppCompatActivity implements ViewAnimator.View
4039 protected void onCreate (Bundle savedInstanceState ) {
4140 super .onCreate (savedInstanceState );
4241 setContentView (R .layout .activity_main );
43- contentFragment = ContentFragment .newInstance (R .drawable .content_music );
42+ ContentFragment contentFragment = ContentFragment .newInstance (R .drawable .content_music );
4443 getSupportFragmentManager ().beginTransaction ()
4544 .replace (R .id .content_frame , contentFragment )
4645 .commit ();
47- drawerLayout = ( DrawerLayout ) findViewById (R .id .drawer_layout );
46+ drawerLayout = findViewById (R .id .drawer_layout );
4847 drawerLayout .setScrimColor (Color .TRANSPARENT );
49- linearLayout = ( LinearLayout ) findViewById (R .id .left_drawer );
48+ linearLayout = findViewById (R .id .left_drawer );
5049 linearLayout .setOnClickListener (new View .OnClickListener () {
5150 @ Override
5251 public void onClick (View v ) {
@@ -81,7 +80,7 @@ private void createMenuList() {
8180
8281
8382 private void setActionBar () {
84- Toolbar toolbar = ( Toolbar ) findViewById (R .id .toolbar );
83+ Toolbar toolbar = findViewById (R .id .toolbar );
8584 setSupportActionBar (toolbar );
8685 getSupportActionBar ().setHomeButtonEnabled (true );
8786 getSupportActionBar ().setDisplayHomeAsUpEnabled (true );
@@ -112,7 +111,7 @@ public void onDrawerOpened(View drawerView) {
112111 super .onDrawerOpened (drawerView );
113112 }
114113 };
115- drawerLayout .setDrawerListener (drawerToggle );
114+ drawerLayout .addDrawerListener (drawerToggle );
116115 }
117116
118117 @ Override
@@ -151,11 +150,11 @@ private ScreenShotable replaceFragment(ScreenShotable screenShotable, int topPos
151150 this .res = this .res == R .drawable .content_music ? R .drawable .content_films : R .drawable .content_music ;
152151 View view = findViewById (R .id .content_frame );
153152 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 );
155154 animator .setInterpolator (new AccelerateInterpolator ());
156155 animator .setDuration (ViewAnimator .CIRCULAR_REVEAL_ANIMATION_DURATION );
157156
158- findViewById (R .id .content_overlay ).setBackgroundDrawable (new BitmapDrawable (getResources (), screenShotable .getBitmap ()));
157+ findViewById (R .id .content_overlay ).setBackground (new BitmapDrawable (getResources (), screenShotable .getBitmap ()));
159158 animator .start ();
160159 ContentFragment contentFragment = ContentFragment .newInstance (this .res );
161160 getSupportFragmentManager ().beginTransaction ().replace (R .id .content_frame , contentFragment ).commit ();
0 commit comments