use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by SudaMod.
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 android_packages_apps_Settings by SudaMod.
the class AndroidBeam method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
SettingsActivity activity = (SettingsActivity) getActivity();
mOldActivityTitle = activity.getActionBar().getTitle();
mSwitchBar = activity.getSwitchBar();
if (mBeamDisallowedByOnlyAdmin) {
mSwitchBar.hide();
} else {
mSwitchBar.setChecked(!mBeamDisallowedByBase && mNfcAdapter.isNdefPushEnabled());
mSwitchBar.addOnSwitchChangeListener(this);
mSwitchBar.setEnabled(!mBeamDisallowedByBase);
mSwitchBar.show();
}
}
use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by SudaMod.
the class AutomaticStorageManagerSettings method initializeSwitchBar.
private void initializeSwitchBar() {
final SettingsActivity activity = (SettingsActivity) getActivity();
mSwitchBar = activity.getSwitchBar();
mSwitchBar.show();
mSwitchController = new AutomaticStorageManagerSwitchBarController(getContext(), mSwitchBar, mMetricsFeatureProvider, mDaysToRetain, getFragmentManager());
}
use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by SudaMod.
the class ToggleFeaturePreferenceFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
SettingsActivity activity = (SettingsActivity) getActivity();
mSwitchBar = activity.getSwitchBar();
mToggleSwitch = mSwitchBar.getSwitch();
onProcessArguments(getArguments());
// Show the "Settings" menu as if it were a preference screen
if (mSettingsTitle != null && mSettingsIntent != null) {
PreferenceScreen preferenceScreen = getPreferenceScreen();
Preference settingsPref = new Preference(preferenceScreen.getContext());
settingsPref.setTitle(mSettingsTitle);
settingsPref.setIconSpaceReserved(true);
settingsPref.setIntent(mSettingsIntent);
preferenceScreen.addPreference(settingsPref);
}
}
use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by SudaMod.
the class PowerUsageSummary method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setAnimationAllowed(true);
initFeatureProvider();
mBatteryLayoutPref = (LayoutPreference) findPreference(KEY_BATTERY_HEADER);
mAppListGroup = (PreferenceGroup) findPreference(KEY_APP_LIST);
mScreenUsagePref = (PowerGaugePreference) findPreference(KEY_SCREEN_USAGE);
mLastFullChargePref = (PowerGaugePreference) findPreference(KEY_TIME_SINCE_LAST_FULL_CHARGE);
mFooterPreferenceMixin.createFooterPreference().setTitle(R.string.battery_footer_summary);
mAnomalySummaryPreferenceController = new AnomalySummaryPreferenceController((SettingsActivity) getActivity(), this, MetricsEvent.FUELGAUGE_POWER_USAGE_SUMMARY);
mBatteryUtils = BatteryUtils.getInstance(getContext());
mAnomalySparseArray = new SparseArray<>();
restartBatteryInfoLoader();
restoreSavedInstance(icicle);
}
Aggregations