@Override
 protected void onStop() {
   super.onStop();
   if (mAlertDialog != null && mAlertDialog.isShowing()) {
     mAlertDialog.dismiss();
     mAlertDialog = null;
   }
 }
 @Override
 protected void onPostCreate(Bundle savedInstanceState) {
   super.onPostCreate(savedInstanceState);
   // Sync the toggle state after onRestoreInstanceState has occurred.
   mDrawerToggle.syncState();
   // applying my very own Edge-Effect color
   EdgeEffectHacker.brandGlowEffect(this, ContextCompat.getColor(this, R.color.app_accent));
   handleAppShortcuts(getIntent());
 }
  @Override
  protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main_ui);

    mTitle = mDrawerTitle = getTitle();

    mDrawerRootLayout = (DrawerLayout) findViewById(R.id.main_root_layout);
    mDrawerRootLayout.setDrawerShadow(R.drawable.drawer_shadow, Gravity.LEFT);
    mDrawerToggle =
        new ActionBarDrawerToggle(
            this, /* host Activity */
            mDrawerRootLayout, /* DrawerLayout object */
            R.string.drawer_open, /* "open drawer" description */
            R.string.drawer_close /* "close drawer" description */) {

          /** Called when a drawer has settled in a completely closed state. */
          public void onDrawerClosed(View view) {
            getSupportActionBar().setTitle(mTitle);
            ActivityCompat.invalidateOptionsMenu(
                MainSettingsActivity.this); // creates call to onPrepareOptionsMenu()
          }

          /** Called when a drawer has settled in a completely open state. */
          public void onDrawerOpened(View drawerView) {
            getSupportActionBar().setTitle(mDrawerTitle);
            ActivityCompat.invalidateOptionsMenu(
                MainSettingsActivity.this); // creates call to onPrepareOptionsMenu()
          }
        };

    // Set the drawer toggle as the DrawerListener
    mDrawerRootLayout.setDrawerListener(mDrawerToggle);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);

    AnyApplication.getConfig().addChangedListener(menuExtraUpdaterOnConfigChange);
  }
 @Override
 public void onConfigurationChanged(Configuration newConfig) {
   super.onConfigurationChanged(newConfig);
   mDrawerToggle.onConfigurationChanged(newConfig);
 }
 @Override
 protected void onDestroy() {
   super.onDestroy();
   AnyApplication.getConfig().removeChangedListener(menuExtraUpdaterOnConfigChange);
 }
 @Override
 protected void onStart() {
   super.onStart();
   // updating menu's data
   updateMenuExtraData();
 }
 @Override
 protected void onNewIntent(Intent intent) {
   super.onNewIntent(intent);
   handleAppShortcuts(intent);
 }