@Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case R.id.menu_refresh_novel_list:
       refreshList();
       return true;
     case R.id.invert_colors:
       UIHelper.ToggleColorPref(this);
       UIHelper.Recreate(this);
       return true;
     case R.id.menu_manual_add:
       manualAdd();
       return true;
     case R.id.menu_download_all_info:
       downloadAllNovelInfo();
       return true;
     case R.id.menu_downloads_list:
       Intent downloadsItent = new Intent(this, DownloadListActivity.class);
       startActivity(downloadsItent);
       return true;
     case android.R.id.home:
       super.onBackPressed();
       return true;
     default:
       return super.onOptionsItemSelected(item);
   }
 }
Пример #2
0
  @Override
  public void onBackPressed() {

    final int drawerState = mMenuDrawer.getDrawerState();
    if (drawerState == MenuDrawer.STATE_OPEN || drawerState == MenuDrawer.STATE_OPENING) {
      mMenuDrawer.closeMenu();
      return;
    } else {
      this.finish();
    }

    super.onBackPressed();
  }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case R.id.menu_refresh_novel_list:
       refreshList();
       return true;
     case R.id.invert_colors:
       UIHelper.ToggleColorPref(this);
       UIHelper.Recreate(this);
       return true;
     case android.R.id.home:
       super.onBackPressed();
       return true;
     default:
       return super.onOptionsItemSelected(item);
   }
 }
 @Override
 public void onBackPressed() {
   saveAndFinish();
   super.onBackPressed();
 }