use of com.android.settings.SettingsActivity in project platform_packages_apps_Settings by BlissRoms.
the class AppInfoBase method setIntentAndFinish.
protected void setIntentAndFinish(boolean finish, boolean appChanged) {
if (localLOGV)
Log.i(TAG, "appChanged=" + appChanged);
Intent intent = new Intent();
intent.putExtra(ManageApplications.APP_CHG, appChanged);
SettingsActivity sa = (SettingsActivity) getActivity();
sa.finishPreferencePanel(this, Activity.RESULT_OK, intent);
mFinishing = true;
}
use of com.android.settings.SettingsActivity in project platform_packages_apps_Settings by BlissRoms.
the class LocationSettings method createPreferenceHierarchy.
private PreferenceScreen createPreferenceHierarchy() {
final SettingsActivity activity = (SettingsActivity) getActivity();
PreferenceScreen root = getPreferenceScreen();
if (root != null) {
root.removeAll();
}
addPreferencesFromResource(R.xml.location_settings);
root = getPreferenceScreen();
setupManagedProfileCategory(root);
mLocationMode = root.findPreference(KEY_LOCATION_MODE);
mLocationMode.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
activity.startPreferencePanel(LocationSettings.this, LocationMode.class.getName(), null, R.string.location_mode_screen_title, null, LocationSettings.this, 0);
return true;
}
});
RecentLocationApps recentApps = new RecentLocationApps(activity);
List<RecentLocationApps.Request> recentLocationRequests = recentApps.getAppList();
final AppLocationPermissionPreferenceController preferenceController = new AppLocationPermissionPreferenceController(activity);
preferenceController.displayPreference(root);
mCategoryRecentLocationRequests = (PreferenceCategory) root.findPreference(KEY_RECENT_LOCATION_REQUESTS);
List<Preference> recentLocationPrefs = new ArrayList<>(recentLocationRequests.size());
for (final RecentLocationApps.Request request : recentLocationRequests) {
DimmableIconPreference pref = new DimmableIconPreference(getPrefContext(), request.contentDescription);
pref.setIcon(request.icon);
pref.setTitle(request.label);
pref.setOnPreferenceClickListener(new PackageEntryClickedListener(request.packageName, request.userHandle));
recentLocationPrefs.add(pref);
}
if (recentLocationRequests.size() > 0) {
addPreferencesSorted(recentLocationPrefs, mCategoryRecentLocationRequests);
} else {
// If there's no item to display, add a "No recent apps" item.
Preference banner = new Preference(getPrefContext());
banner.setLayoutResource(R.layout.location_list_no_item);
banner.setTitle(R.string.location_no_recent_apps);
banner.setSelectable(false);
mCategoryRecentLocationRequests.addPreference(banner);
}
boolean lockdownOnLocationAccess = false;
// injected location services must not be shown.
if (mManagedProfile != null && mUm.hasUserRestriction(UserManager.DISALLOW_SHARE_LOCATION, mManagedProfile)) {
lockdownOnLocationAccess = true;
}
addLocationServices(activity, root, lockdownOnLocationAccess);
refreshLocationMode();
return root;
}
use of com.android.settings.SettingsActivity in project platform_packages_apps_Settings by BlissRoms.
the class LocationSettings method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final SettingsActivity activity = (SettingsActivity) getActivity();
mUm = (UserManager) activity.getSystemService(Context.USER_SERVICE);
setHasOptionsMenu(true);
mSwitchBar = activity.getSwitchBar();
mSwitch = mSwitchBar.getSwitch();
mSwitchBar.show();
setHasOptionsMenu(true);
}
use of com.android.settings.SettingsActivity in project platform_packages_apps_Settings by BlissRoms.
the class PowerUsageSummary method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
final SettingsActivity sa = (SettingsActivity) getActivity();
final Context context = getContext();
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
switch(item.getItemId()) {
case MENU_STATS_TYPE:
if (mStatsType == BatteryStats.STATS_SINCE_CHARGED) {
mStatsType = BatteryStats.STATS_SINCE_UNPLUGGED;
} else {
mStatsType = BatteryStats.STATS_SINCE_CHARGED;
}
refreshUi();
return true;
case MENU_HIGH_POWER_APPS:
Bundle args = new Bundle();
args.putString(ManageApplications.EXTRA_CLASSNAME, HighPowerApplicationsActivity.class.getName());
sa.startPreferencePanel(this, ManageApplications.class.getName(), args, R.string.high_power_apps, null, null, 0);
metricsFeatureProvider.action(context, MetricsEvent.ACTION_SETTINGS_MENU_BATTERY_OPTIMIZATION);
return true;
case MENU_ADDITIONAL_BATTERY_INFO:
startActivity(mPowerFeatureProvider.getAdditionalBatteryInfoIntent());
metricsFeatureProvider.action(context, MetricsEvent.ACTION_SETTINGS_MENU_BATTERY_USAGE_ALERTS);
return true;
case MENU_TOGGLE_APPS:
mShowAllApps = !mShowAllApps;
item.setTitle(mShowAllApps ? R.string.hide_extra_apps : R.string.show_all_apps);
metricsFeatureProvider.action(context, MetricsEvent.ACTION_SETTINGS_MENU_BATTERY_APPS_TOGGLE, mShowAllApps);
restartBatteryStatsLoader(false);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
use of com.android.settings.SettingsActivity in project platform_packages_apps_Settings by BlissRoms.
the class BluetoothSettings method setOffMessage.
private void setOffMessage() {
final TextView emptyView = getEmptyTextView();
if (emptyView == null) {
return;
}
final CharSequence briefText = getText(R.string.bluetooth_empty_list_bluetooth_off);
emptyView.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL);
final ContentResolver resolver = getActivity().getContentResolver();
final boolean bleScanningMode = Settings.Global.getInt(resolver, Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE, 0) == 1;
if (!bleScanningMode) {
// Show only the brief text if the scanning mode has been turned off.
emptyView.setText(briefText, TextView.BufferType.SPANNABLE);
} else {
final StringBuilder contentBuilder = new StringBuilder();
contentBuilder.append(briefText);
contentBuilder.append("\n\n");
contentBuilder.append(getText(R.string.ble_scan_notify_text));
LinkifyUtils.linkify(emptyView, contentBuilder, new LinkifyUtils.OnClickListener() {
@Override
public void onClick() {
final SettingsActivity activity = (SettingsActivity) BluetoothSettings.this.getActivity();
activity.startPreferencePanel(BluetoothSettings.this, ScanningSettings.class.getName(), null, R.string.location_scanning_screen_title, null, null, 0);
}
});
}
setTextSpan(emptyView.getText(), briefText);
}
Aggregations