Search in sources :

Example 41 with SettingsActivity

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);
}
Also used : AppEntry(com.android.settingslib.applications.ApplicationsState.AppEntry) SettingsPreferenceFragment(com.android.settings.SettingsPreferenceFragment) ApplicationInfo(android.content.pm.ApplicationInfo) SettingsActivity(com.android.settings.SettingsActivity) Test(org.junit.Test)

Example 42 with SettingsActivity

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();
}
Also used : SettingsMainSwitchBar(com.android.settings.widget.SettingsMainSwitchBar) SettingsActivity(com.android.settings.SettingsActivity)

Example 43 with SettingsActivity

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);
}
Also used : SettingsActivity(com.android.settings.SettingsActivity)

Example 44 with SettingsActivity

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);
}
Also used : RemoteException(android.os.RemoteException) SettingsActivity(com.android.settings.SettingsActivity)

Example 45 with SettingsActivity

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;
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) Bundle(android.os.Bundle) ArrayList(java.util.ArrayList) AppButtonsPreferenceController(com.android.settings.applications.appinfo.AppButtonsPreferenceController) SettingsActivity(com.android.settings.SettingsActivity)

Aggregations

SettingsActivity (com.android.settings.SettingsActivity)539 Bundle (android.os.Bundle)99 Intent (android.content.Intent)82 SettingsMainSwitchBar (com.android.settings.widget.SettingsMainSwitchBar)82 Preference (androidx.preference.Preference)56 AbstractPreferenceController (com.android.settingslib.core.AbstractPreferenceController)54 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)50 Test (org.junit.Test)50 ArrayList (java.util.ArrayList)48 MainSwitchBarController (com.android.settings.widget.MainSwitchBarController)45 ApplicationInfo (android.content.pm.ApplicationInfo)44 SettingsPreferenceFragment (com.android.settings.SettingsPreferenceFragment)28 AppEntry (com.android.settingslib.applications.ApplicationsState.AppEntry)28 ContentResolver (android.content.ContentResolver)25 FooterPreference (com.android.settingslib.widget.FooterPreference)23 Context (android.content.Context)22 RemoteException (android.os.RemoteException)22 View (android.view.View)22 EngineInfo (android.speech.tts.TextToSpeech.EngineInfo)21 Activity (android.app.Activity)17