prevent action bar flickering when drawers are quickly closed and reopened

This commit is contained in:
fkloft
2013-09-24 14:57:45 +02:00
parent 6f5ca2aa4b
commit 40a242ea18

View File

@ -7,6 +7,7 @@ import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface.OnDismissListener;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.widget.DrawerLayout;
@ -264,8 +265,15 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
@Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
mIitc.invalidateOptionsMenu();
updateActionBar();
// delay invalidating to prevent flickering in case another drawer is opened
(new Handler()).postDelayed(new Runnable() {
@Override
public void run() {
mIitc.invalidateOptionsMenu();
updateActionBar();
}
}, 200);
}
@Override