I am working on an android app that I currently have and I am trying modifying my app to target Android 5 Lollipop and the new material design.
In the app it has a navigation drawer slide out which is still working fine, however, when the drawer is opened and closed.
I believe, like the Play Store app does, when the navigation drawer is open the hamburger icon is animated into a back arrow, and when closed there is animation from the back arrow back to the hamburger icon.
This part isn't working for my app though and I've been unable to find anything on Google about how to implement this change.
Below is how my ActionBarDrawerToggle is implemented
ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(
activity,
drawerLayout,
R.drawable.ic_drawer,
drawerOpen,
drawerClosed)
{
public void onDrawerClosed(View view)
{
super.onDrawerClosed(view);
activity.invalidateOptionsMenu();
syncState();
}
public void onDrawerOpened(View drawerView)
{
super.onDrawerOpened(drawerView);
activity.invalidateOptionsMenu();
syncState();
}
};
return actionBarDrawerToggle;
Below is how the code above is called and how the toggle is set the navigation drawer
NavigationManager navManager = new NavigationManager(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_closed);
navManager.prepareActionBar();
mDrawerToggle = navManager.setDrawerToggle();
mDrawerLayout.setDrawerListener(mDrawerToggle);
Below is the code for my prepareActionBar function
public void prepareActionBar()
{
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB)
{
activity.getActionBar().setDisplayHomeAsUpEnabled(true);
activity.getActionBar().setHomeButtonEnabled(true);
}
}