use of com.android.settings.SettingsActivity in project packages_apps_Settings by PixelExperience.
the class AppInfoDashboardFragmentTest method startAppInfoFragment_noCrashOnNullArgs.
@Test
public void startAppInfoFragment_noCrashOnNullArgs() {
final SettingsPreferenceFragment caller = mock(SettingsPreferenceFragment.class);
final SettingsActivity sa = mock(SettingsActivity.class);
when(caller.getActivity()).thenReturn(sa);
when(caller.getContext()).thenReturn(sa);
final AppEntry appEntry = mock(AppEntry.class);
appEntry.info = mock(ApplicationInfo.class);
AppInfoDashboardFragment.startAppInfoFragment(AppInfoDashboardFragment.class, 0, null, caller, appEntry);
}
use of com.android.settings.SettingsActivity in project packages_apps_Settings by PixelExperience.
the class ToggleFeaturePreferenceFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final SettingsActivity activity = (SettingsActivity) getActivity();
final SettingsMainSwitchBar switchBar = activity.getSwitchBar();
switchBar.hide();
updatePreferenceOrder();
}
use of com.android.settings.SettingsActivity in project packages_apps_Settings by PixelExperience.
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();
}
activity.setTitle(R.string.android_beam_settings_title);
}
use of com.android.settings.SettingsActivity in project packages_apps_Settings by PixelExperience.
the class ToggleBackupSettingFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
SettingsActivity activity = (SettingsActivity) getActivity();
mSwitchBar = activity.getSwitchBar();
// not mention full data backup
if (Settings.Secure.getInt(getContentResolver(), USER_FULL_DATA_BACKUP_AWARE, 0) != 0) {
mSummaryPreference.setSummary(R.string.fullbackup_data_summary);
} else {
mSummaryPreference.setSummary(R.string.backup_data_summary);
}
try {
boolean backupEnabled = mBackupManager == null ? false : mBackupManager.isBackupEnabled();
mSwitchBar.setCheckedInternal(backupEnabled);
} catch (RemoteException e) {
// The world is aflame, turn it off.
mSwitchBar.setEnabled(false);
}
getActivity().setTitle(R.string.backup_data_title);
}
use of com.android.settings.SettingsActivity in project packages_apps_Settings by PixelExperience.
the class AdvancedPowerUsageDetail method createPreferenceControllers.
@Override
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
final Bundle bundle = getArguments();
final int uid = bundle.getInt(EXTRA_UID, 0);
final String packageName = bundle.getString(EXTRA_PACKAGE_NAME);
mAppButtonsPreferenceController = new AppButtonsPreferenceController((SettingsActivity) getActivity(), this, getSettingsLifecycle(), packageName, mState, REQUEST_UNINSTALL, REQUEST_REMOVE_DEVICE_ADMIN);
controllers.add(mAppButtonsPreferenceController);
if (enableTriState) {
controllers.add(new UnrestrictedPreferenceController(context, uid, packageName));
controllers.add(new OptimizedPreferenceController(context, uid, packageName));
controllers.add(new RestrictedPreferenceController(context, uid, packageName));
} else {
mBackgroundActivityPreferenceController = new BackgroundActivityPreferenceController(context, this, uid, packageName);
controllers.add(mBackgroundActivityPreferenceController);
controllers.add(new BatteryOptimizationPreferenceController((SettingsActivity) getActivity(), this, packageName));
}
return controllers;
}
Aggregations