Search in sources :

Example 71 with PreferenceGroup

use of android.support.v7.preference.PreferenceGroup in project markor by gsantner.

the class GsPreferenceFragmentCompat method removePreference.

protected void removePreference(@Nullable Preference preference) {
    if (preference == null) {
        return;
    }
    PreferenceGroup parent = getPreferenceParent(getPreferenceScreen(), preference);
    if (parent == null) {
        return;
    }
    parent.removePreference(preference);
}
Also used : PreferenceGroup(android.support.v7.preference.PreferenceGroup)

Example 72 with PreferenceGroup

use of android.support.v7.preference.PreferenceGroup in project memetastic by gsantner.

the class GsPreferenceFragmentCompat method getPreferenceParent.

protected PreferenceGroup getPreferenceParent(PreferenceGroup prefGroup, Preference pref) {
    for (int i = 0; i < prefGroup.getPreferenceCount(); ++i) {
        Preference prefChild = prefGroup.getPreference(i);
        if (prefChild == pref) {
            return prefGroup;
        }
        if (prefChild instanceof PreferenceGroup) {
            PreferenceGroup childGroup = (PreferenceGroup) prefChild;
            PreferenceGroup result = getPreferenceParent(childGroup, pref);
            if (result != null) {
                return result;
            }
        }
    }
    return null;
}
Also used : DialogPreference(android.support.v7.preference.DialogPreference) Preference(android.support.v7.preference.Preference) PreferenceGroup(android.support.v7.preference.PreferenceGroup) Paint(android.graphics.Paint)

Example 73 with PreferenceGroup

use of android.support.v7.preference.PreferenceGroup in project memetastic by gsantner.

the class GsPreferenceFragmentCompat method removePreference.

protected void removePreference(@Nullable Preference preference) {
    if (preference == null) {
        return;
    }
    PreferenceGroup parent = getPreferenceParent(getPreferenceScreen(), preference);
    if (parent == null) {
        return;
    }
    parent.removePreference(preference);
}
Also used : PreferenceGroup(android.support.v7.preference.PreferenceGroup)

Example 74 with PreferenceGroup

use of android.support.v7.preference.PreferenceGroup in project platform_packages_apps_Galaxy by Cosmic-OS.

the class GamingMode method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Get launch-able applications
    addPreferencesFromResource(R.xml.gaming_mode_settings);
    final PreferenceScreen prefScreen = getPreferenceScreen();
    mHardwareKeysDisable = (SwitchPreference) findPreference(GAMING_MODE_HW_KEYS);
    mGamingModeEnabled = (SwitchPreference) findPreference(GAMING_MODE_ENABLED);
    if (!haveHWkeys()) {
        prefScreen.removePreference(mHardwareKeysDisable);
    }
    mPackageManager = getPackageManager();
    mPackageAdapter = new PackageListAdapter(getActivity());
    mGamingPrefList = (PreferenceGroup) findPreference("gamingmode_applications");
    mGamingPrefList.setOrderingAsAdded(false);
    mGamingPackages = new HashMap<String, Package>();
    mAddGamingPref = findPreference("add_gamingmode_packages");
    mAddGamingPref.setOnPreferenceClickListener(this);
    mContext = getActivity().getApplicationContext();
    SettingsObserver observer = new SettingsObserver(new Handler(Looper.getMainLooper()));
    observer.observe();
}
Also used : PackageListAdapter(com.cosmic.settings.preferences.PackageListAdapter) PreferenceScreen(android.support.v7.preference.PreferenceScreen) Handler(android.os.Handler)

Example 75 with PreferenceGroup

use of android.support.v7.preference.PreferenceGroup in project wire-android by wireapp.

the class DevicesPreferences method addDeviceWarning.

private void addDeviceWarning(PreferenceGroup preferenceGroup) {
    Preference preference = new Preference(getActivity());
    preference.setSummary(getString(R.string.pref_devices_warning_summary));
    preferenceGroup.addPreference(preference);
}
Also used : Preference(android.support.v7.preference.Preference)

Aggregations

PreferenceGroup (android.support.v7.preference.PreferenceGroup)104 Preference (android.support.v7.preference.Preference)70 Context (android.content.Context)28 PreferenceScreen (android.support.v7.preference.PreferenceScreen)28 Test (org.junit.Test)26 PreferenceManager (android.support.v7.preference.PreferenceManager)22 SwitchPreference (android.support.v14.preference.SwitchPreference)19 ArrayList (java.util.ArrayList)19 PreferenceCategory (android.support.v7.preference.PreferenceCategory)17 UserInfo (android.content.pm.UserInfo)16 Intent (android.content.Intent)14 AccessiblePreferenceCategory (com.android.settings.AccessiblePreferenceCategory)14 RestrictedSwitchPreference (com.android.settingslib.RestrictedSwitchPreference)14 Account (android.accounts.Account)12 AuthenticatorDescription (android.accounts.AuthenticatorDescription)12 UserHandle (android.os.UserHandle)12 TelephonyManager (android.telephony.TelephonyManager)12 Activity (android.app.Activity)11 RestrictedPreference (com.android.settingslib.RestrictedPreference)11 RemoteException (android.os.RemoteException)8