No delay to close nav drawer after switching pages, feels much faster. Also fixed a small glitch.
This commit is contained in:
parent
f503d0ea1e
commit
ad627943fb
2 changed files with 4 additions and 13 deletions
|
|
@ -73,11 +73,9 @@ public class NavigationDrawerItemAdapter extends RecyclerView.Adapter<Navigation
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChecked(int position) {
|
public void setChecked(int position) {
|
||||||
int oldPosition = currentChecked;
|
// int oldPosition = currentChecked;
|
||||||
currentChecked = position;
|
currentChecked = position;
|
||||||
if (oldPosition != -1)
|
notifyDataSetChanged();
|
||||||
notifyItemChanged(oldPosition);
|
|
||||||
notifyItemChanged(position);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package com.kabouzeid.gramophone.ui.fragments;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.view.GravityCompat;
|
import android.support.v4.view.GravityCompat;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
|
|
@ -154,15 +153,9 @@ public class NavigationDrawerFragment extends Fragment {
|
||||||
if (position != NAVIGATION_DRAWER_HEADER &&
|
if (position != NAVIGATION_DRAWER_HEADER &&
|
||||||
position != ABOUT_INDEX && position != SETTINGS_INDEX) {
|
position != ABOUT_INDEX && position != SETTINGS_INDEX) {
|
||||||
setItemChecked(position);
|
setItemChecked(position);
|
||||||
if (drawerLayout != null) {
|
if (drawerLayout != null)
|
||||||
new Handler().postDelayed(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
drawerLayout.closeDrawers();
|
drawerLayout.closeDrawers();
|
||||||
}
|
}
|
||||||
}, 200);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (callbacks != null)
|
if (callbacks != null)
|
||||||
callbacks.onNavigationDrawerItemSelected(position);
|
callbacks.onNavigationDrawerItemSelected(position);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue