@Override
 public boolean onOptionsItemSelected(MenuItem item) {
   int menuId = item.getItemId();
   switch (item.getItemId()) {
     case R.id.sort_order_alpha:
     case R.id.sort_order_size:
       mSortOrder = menuId;
       if (mApplications != null) {
         mApplications.rebuild(mSortOrder);
       }
       break;
     case R.id.show_system:
     case R.id.hide_system:
       mShowSystem = !mShowSystem;
       mApplications.rebuild(false);
       break;
     case R.id.reset_app_preferences:
       mResetAppsHelper.buildResetDialog();
       return true;
     case R.id.advanced:
       ((SettingsActivity) getActivity())
           .startPreferencePanel(
               AdvancedAppSettings.class.getName(),
               null,
               R.string.configure_apps,
               null,
               this,
               ADVANCED_SETTINGS);
       return true;
     default:
       // Handle the home button
       return false;
   }
   updateOptionsMenu();
   return true;
 }
Пример #2
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   int menuId = item.getItemId();
   if ((menuId == SORT_ORDER_ALPHA) || (menuId == SORT_ORDER_SIZE)) {
     mSortOrder = menuId;
     if (mCurView != VIEW_RUNNING) {
       mApplicationsAdapter.rebuild(mFilterApps, mSortOrder);
     }
   } else if (menuId == SHOW_RUNNING_SERVICES) {
     mShowBackground = false;
     mRunningProcessesView.mAdapter.setShowBackground(false);
   } else if (menuId == SHOW_BACKGROUND_PROCESSES) {
     mShowBackground = true;
     mRunningProcessesView.mAdapter.setShowBackground(true);
   }
   updateOptionsMenu();
   return true;
 }