No delay to close nav drawer after switching pages, feels much faster. Also fixed a small glitch.

This commit is contained in:
Aidan Follestad 2015-04-18 02:25:41 -05:00
commit ad627943fb
2 changed files with 4 additions and 13 deletions

View file

@ -73,11 +73,9 @@ public class NavigationDrawerItemAdapter extends RecyclerView.Adapter<Navigation
}
public void setChecked(int position) {
int oldPosition = currentChecked;
// int oldPosition = currentChecked;
currentChecked = position;
if (oldPosition != -1)
notifyItemChanged(oldPosition);
notifyItemChanged(position);
notifyDataSetChanged();
}
@Override

View file

@ -3,7 +3,6 @@ package com.kabouzeid.gramophone.ui.fragments;
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
@ -154,14 +153,8 @@ public class NavigationDrawerFragment extends Fragment {
if (position != NAVIGATION_DRAWER_HEADER &&
position != ABOUT_INDEX && position != SETTINGS_INDEX) {
setItemChecked(position);
if (drawerLayout != null) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
drawerLayout.closeDrawers();
}
}, 200);
}
if (drawerLayout != null)
drawerLayout.closeDrawers();
}
if (callbacks != null)
callbacks.onNavigationDrawerItemSelected(position);