diff --git a/src/main/java/com/todoroo/astrid/activity/TaskListActivity.java b/src/main/java/com/todoroo/astrid/activity/TaskListActivity.java index 4a798ba6f..991ffdfa4 100644 --- a/src/main/java/com/todoroo/astrid/activity/TaskListActivity.java +++ b/src/main/java/com/todoroo/astrid/activity/TaskListActivity.java @@ -371,7 +371,7 @@ public class TaskListActivity extends InjectingAppCompatActivity implements @Override public void onBackPressed() { if (navigationDrawer.isDrawerOpen()) { - navigationDrawer.closeMenu(); + navigationDrawer.closeDrawer(); return; } diff --git a/src/main/java/org/tasks/ui/NavigationDrawerFragment.java b/src/main/java/org/tasks/ui/NavigationDrawerFragment.java index ea936755c..6bacb212f 100644 --- a/src/main/java/org/tasks/ui/NavigationDrawerFragment.java +++ b/src/main/java/org/tasks/ui/NavigationDrawerFragment.java @@ -121,8 +121,15 @@ public class NavigationDrawerFragment extends InjectingFragment { mDrawerListView = (ListView) layout.findViewById(android.R.id.list); mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - selectItem(position); + public void onItemClick(AdapterView parent, View view, final int position, long id) { + mDrawerLayout.setDrawerListener(new DrawerLayout.SimpleDrawerListener() { + @Override + public void onDrawerClosed(View drawerView) { + mDrawerLayout.setDrawerListener(null); + selectItem(position); + } + }); + close(); } }); mDrawerListView.setItemChecked(mCurrentSelectedPosition, true); @@ -167,7 +174,6 @@ public class NavigationDrawerFragment extends InjectingFragment { } private void selectItem(int position) { - closeMenu(); FilterListItem item = adapter.getItem(position); if (item instanceof Filter) { mCurrentSelectedPosition = position; @@ -205,12 +211,17 @@ public class NavigationDrawerFragment extends InjectingFragment { outState.putInt(TOKEN_LAST_SELECTED, mCurrentSelectedPosition); } - public void closeMenu() { + public void closeDrawer() { if (mDrawerLayout != null) { - mDrawerLayout.closeDrawer(mFragmentContainerView); + mDrawerLayout.setDrawerListener(null); + close(); } } + private void close() { + mDrawerLayout.closeDrawer(mFragmentContainerView); + } + public void openDrawer() { if (mDrawerLayout != null) { mDrawerLayout.openDrawer(mFragmentContainerView);