Search in sources :

Example 36 with SettingsActivity

use of com.android.settings.SettingsActivity in project packages_apps_Settings by PixelExperience.

the class AutomaticStorageManagerSettings method initializeSwitchBar.

private void initializeSwitchBar() {
    final SettingsActivity activity = (SettingsActivity) getActivity();
    mSwitchBar = activity.getSwitchBar();
    mSwitchBar.setTitle(getContext().getString(R.string.automatic_storage_manager_primary_switch_title));
    mSwitchBar.show();
    mSwitchController = new AutomaticStorageManagerSwitchBarController(getContext(), mSwitchBar, mMetricsFeatureProvider, mDaysToRetain, getFragmentManager());
}
Also used : SettingsActivity(com.android.settings.SettingsActivity)

Example 37 with SettingsActivity

use of com.android.settings.SettingsActivity in project packages_apps_Settings by PixelExperience.

the class WifiTetherSettings method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (mUnavailable) {
        return;
    }
    // Assume we are in a SettingsActivity. This is only safe because we currently use
    // SettingsActivity as base for all preference fragments.
    final SettingsActivity activity = (SettingsActivity) getActivity();
    final SettingsMainSwitchBar switchBar = activity.getSwitchBar();
    switchBar.setTitle(getContext().getString(R.string.use_wifi_hotsopt_main_switch_title));
    mSwitchBarController = new WifiTetherSwitchBarController(activity, switchBar);
    getSettingsLifecycle().addObserver(mSwitchBarController);
    switchBar.show();
}
Also used : SettingsMainSwitchBar(com.android.settings.widget.SettingsMainSwitchBar) SettingsActivity(com.android.settings.SettingsActivity)

Example 38 with SettingsActivity

use of com.android.settings.SettingsActivity in project packages_apps_Settings by PixelExperience.

the class BluetoothDashboardFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    SettingsActivity activity = (SettingsActivity) getActivity();
    mSwitchBar = activity.getSwitchBar();
    mSwitchBar.setTitle(getContext().getString(R.string.bluetooth_main_switch_title));
    mController = new BluetoothSwitchPreferenceController(activity, new MainSwitchBarController(mSwitchBar), mFooterPreference);
    Lifecycle lifecycle = getSettingsLifecycle();
    if (lifecycle != null) {
        lifecycle.addObserver(mController);
    }
}
Also used : MainSwitchBarController(com.android.settings.widget.MainSwitchBarController) BluetoothSwitchPreferenceController(com.android.settings.bluetooth.BluetoothSwitchPreferenceController) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) SettingsActivity(com.android.settings.SettingsActivity)

Example 39 with SettingsActivity

use of com.android.settings.SettingsActivity in project packages_apps_Settings by PixelExperience.

the class PowerUsageSummary method onAttach.

@Override
public void onAttach(Context context) {
    super.onAttach(context);
    final SettingsActivity activity = (SettingsActivity) getActivity();
    mBatteryHeaderPreferenceController = use(BatteryHeaderPreferenceController.class);
    mBatteryHeaderPreferenceController.setActivity(activity);
    mBatteryHeaderPreferenceController.setFragment(this);
    mBatteryHeaderPreferenceController.setLifecycle(getSettingsLifecycle());
    mBatteryTipPreferenceController = use(BatteryTipPreferenceController.class);
    mBatteryTipPreferenceController.setActivity(activity);
    mBatteryTipPreferenceController.setFragment(this);
    mBatteryTipPreferenceController.setBatteryTipListener(this::onBatteryTipHandled);
}
Also used : BatteryTipPreferenceController(com.android.settings.fuelgauge.batterytip.BatteryTipPreferenceController) SettingsActivity(com.android.settings.SettingsActivity)

Example 40 with SettingsActivity

use of com.android.settings.SettingsActivity in project packages_apps_Settings by PixelExperience.

the class UserSettings method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    // Assume we are in a SettingsActivity. This is only safe because we currently use
    // SettingsActivity as base for all preference fragments.
    final SettingsActivity activity = (SettingsActivity) getActivity();
    final SettingsMainSwitchBar switchBar = activity.getSwitchBar();
    switchBar.setTitle(getContext().getString(R.string.multiple_users_main_switch_title));
    switchBar.show();
    mSwitchBarController = new MultiUserSwitchBarController(activity, new MainSwitchBarController(switchBar), this);
    getSettingsLifecycle().addObserver(mSwitchBarController);
}
Also used : MainSwitchBarController(com.android.settings.widget.MainSwitchBarController) SettingsMainSwitchBar(com.android.settings.widget.SettingsMainSwitchBar) 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