@Override public boolean onOptionsItemSelected(MenuItem item) { short time = Schedule.today(this).nextTimeIndex(); switch (item.getItemId()) { case R.id.menu_location_calculation: new CalculationSettingsDialog(this).show(); break; case R.id.menu_previous: time--; if (time < CONSTANT.FAJR) { time = CONSTANT.ISHAA; } if (CONSTANT.SUNRISE == time && mPreferences.dontNotifySunrise()) { time = CONSTANT.FAJR; } NotificationService.notify( this, time, Schedule.today(this).getTimes()[time].getTimeInMillis()); break; case R.id.menu_next: if (CONSTANT.SUNRISE == time && mPreferences.dontNotifySunrise()) { time = CONSTANT.DHUHR; } NotificationService.notify( this, time, Schedule.today(this).getTimes()[time].getTimeInMillis()); break; case R.id.menu_stop: NotificationService.cancelAll(this); break; case R.id.menu_settings: startActivity(new Intent(this, SettingsActivity.class)); break; } return super.onOptionsItemSelected(item); }