@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Intent upIntent = NavUtils.getParentActivityIntent(this); if (upIntent != null) if (NavUtils.shouldUpRecreateTask(this, upIntent)) TaskStackBuilder.create(this).addNextIntentWithParentStack(upIntent).startActivities(); else NavUtils.navigateUpTo(this, upIntent); return true; case R.id.menu_all: List<String> listRestriction = PrivacyManager.getRestrictions(); // Get toggle boolean restricted = false; for (String restrictionName : listRestriction) if (PrivacyManager.getRestricted( null, this, mAppInfo.getUid(), restrictionName, null, false, false)) { restricted = true; break; } // Do toggle restricted = !restricted; for (String restrictionName : listRestriction) PrivacyManager.setRestricted( null, this, mAppInfo.getUid(), restrictionName, null, restricted); // Refresh display if (mPrivacyListAdapter != null) mPrivacyListAdapter.notifyDataSetChanged(); return true; case R.id.menu_app_launch: Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage(mAppInfo.getPackageName()); startActivity(LaunchIntent); return true; case R.id.menu_app_settings: startActivity( new Intent( android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:" + mAppInfo.getPackageName()))); return true; case R.id.menu_app_store: startActivity( new Intent( Intent.ACTION_VIEW, Uri.parse("market://details?id=" + mAppInfo.getPackageName()))); return true; default: return super.onOptionsItemSelected(item); } }
@Override protected void onResume() { super.onResume(); if (mPrivacyListAdapter != null) mPrivacyListAdapter.notifyDataSetChanged(); }