예제 #1
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case android.R.id.home:
       if (returnToProjectsList) {
         Intent intent = new Intent(this, MyProjectsActivity.class);
         intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
         BackPackListManager.setBackPackFlag(true);
         startActivity(intent);
       } else {
         Intent intent = new Intent(this, MainMenuActivity.class);
         intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
         BackPackListManager.setBackPackFlag(true);
         startActivity(intent);
       }
       break;
     case R.id.settings:
       Intent settingsIntent = new Intent(this, SettingsActivity.class);
       startActivity(settingsIntent);
       break;
     case R.id.menu_rate_app:
       launchMarket();
       return true;
     case R.id.menu_terms_of_use:
       TermsOfUseDialogFragment termsOfUseDialog = new TermsOfUseDialogFragment();
       termsOfUseDialog.show(
           getSupportFragmentManager(), TermsOfUseDialogFragment.DIALOG_FRAGMENT_TAG);
       return true;
     case R.id.menu_about:
       AboutDialogFragment aboutDialog = new AboutDialogFragment();
       aboutDialog.show(getSupportFragmentManager(), AboutDialogFragment.DIALOG_FRAGMENT_TAG);
       return true;
     default:
       break;
   }
   return super.onOptionsItemSelected(item);
 }