Search in sources :

Example 56 with SettingsActivity

use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by crdroidandroid.

the class ZenModeRuleSettingsBase method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    final SettingsActivity activity = (SettingsActivity) getActivity();
    mSwitchBar = activity.getSwitchBar();
    mSwitchBar.addOnSwitchChangeListener(this);
    mSwitchBar.show();
}
Also used : SettingsActivity(com.android.settings.SettingsActivity)

Example 57 with SettingsActivity

use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by crdroidandroid.

the class UserDictionarySettings method showAddOrEditDialog.

/**
 * Add or edit a word. If editingWord is null, it's an add; otherwise, it's an edit.
 *
 * @param editingWord     the word to edit, or null if it's an add.
 * @param editingShortcut the shortcut for this entry, or null if none.
 */
private void showAddOrEditDialog(final String editingWord, final String editingShortcut) {
    final Bundle args = new Bundle();
    args.putInt(UserDictionaryAddWordContents.EXTRA_MODE, null == editingWord ? UserDictionaryAddWordContents.MODE_INSERT : UserDictionaryAddWordContents.MODE_EDIT);
    args.putString(UserDictionaryAddWordContents.EXTRA_WORD, editingWord);
    args.putString(UserDictionaryAddWordContents.EXTRA_SHORTCUT, editingShortcut);
    args.putString(UserDictionaryAddWordContents.EXTRA_LOCALE, mLocale);
    SettingsActivity sa = (SettingsActivity) getActivity();
    sa.startPreferencePanel(this, com.android.settings.inputmethod.UserDictionaryAddWordFragment.class.getName(), args, R.string.user_dict_settings_add_dialog_title, null, null, 0);
}
Also used : Bundle(android.os.Bundle) SettingsActivity(com.android.settings.SettingsActivity)

Example 58 with SettingsActivity

use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by crdroidandroid.

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;
}
Also used : PreferenceScreen(android.support.v7.preference.PreferenceScreen) ArrayList(java.util.ArrayList) RecentLocationApps(com.android.settingslib.location.RecentLocationApps) DimmableIconPreference(com.android.settings.DimmableIconPreference) DimmableIconPreference(com.android.settings.DimmableIconPreference) RestrictedSwitchPreference(com.android.settingslib.RestrictedSwitchPreference) Preference(android.support.v7.preference.Preference) SettingsActivity(com.android.settings.SettingsActivity)

Example 59 with SettingsActivity

use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by crdroidandroid.

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

Example 60 with SettingsActivity

use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by SudaMod.

the class WifiTetherSettings 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 SwitchBar switchBar = activity.getSwitchBar();
    mSwitchBarController = new WifiTetherSwitchBarController(activity, new SwitchBarController(switchBar));
    getLifecycle().addObserver(mSwitchBarController);
    switchBar.show();
}
Also used : SwitchBar(com.android.settings.widget.SwitchBar) SettingsActivity(com.android.settings.SettingsActivity) SwitchBarController(com.android.settings.widget.SwitchBarController)

Aggregations

SettingsActivity (com.android.settings.SettingsActivity)246 Bundle (android.os.Bundle)71 Intent (android.content.Intent)37 ArrayList (java.util.ArrayList)27 Preference (android.support.v7.preference.Preference)25 AnomalySummaryPreferenceController (com.android.settings.fuelgauge.anomaly.AnomalySummaryPreferenceController)18 SwitchBarController (com.android.settings.widget.SwitchBarController)16 ContentResolver (android.content.ContentResolver)15 TextView (android.widget.TextView)15 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)15 Test (org.junit.Test)15 Context (android.content.Context)14 View (android.view.View)14 LinkifyUtils (com.android.settings.LinkifyUtils)14 RemoteException (android.os.RemoteException)13 EngineInfo (android.speech.tts.TextToSpeech.EngineInfo)13 PreferenceScreen (android.support.v7.preference.PreferenceScreen)13 RecyclerView (android.support.v7.widget.RecyclerView)12 LayoutPreference (com.android.settings.applications.LayoutPreference)12 AbstractPreferenceController (com.android.settingslib.core.AbstractPreferenceController)11