Search in sources :

Example 1 with UiThread

use of android.annotation.UiThread in project android_packages_apps_Settings by DirtyUnicorns.

the class VpnSettings method setShownPreferences.

@VisibleForTesting
@UiThread
public void setShownPreferences(final Collection<Preference> updates) {
    mLegacyVpnPreferences.values().retainAll(updates);
    mAppPreferences.values().retainAll(updates);
    // Change {@param updates} in-place to only contain new preferences that were not already
    // added to the preference screen.
    final PreferenceGroup vpnGroup = getPreferenceScreen();
    for (int i = vpnGroup.getPreferenceCount() - 1; i >= 0; i--) {
        Preference p = vpnGroup.getPreference(i);
        if (updates.contains(p)) {
            updates.remove(p);
        } else {
            vpnGroup.removePreference(p);
        }
    }
    // Show any new preferences on the screen
    for (Preference pref : updates) {
        vpnGroup.addPreference(pref);
    }
}
Also used : GearPreference(com.android.settings.widget.GearPreference) Preference(android.support.v7.preference.Preference) PreferenceGroup(android.support.v7.preference.PreferenceGroup) VisibleForTesting(com.android.internal.annotations.VisibleForTesting) UiThread(android.annotation.UiThread)

Example 2 with UiThread

use of android.annotation.UiThread in project platform_packages_apps_Settings by BlissRoms.

the class VpnSettings method setShownPreferences.

@VisibleForTesting
@UiThread
public void setShownPreferences(final Collection<Preference> updates) {
    mLegacyVpnPreferences.values().retainAll(updates);
    mAppPreferences.values().retainAll(updates);
    // Change {@param updates} in-place to only contain new preferences that were not already
    // added to the preference screen.
    final PreferenceGroup vpnGroup = getPreferenceScreen();
    for (int i = vpnGroup.getPreferenceCount() - 1; i >= 0; i--) {
        Preference p = vpnGroup.getPreference(i);
        if (updates.contains(p)) {
            updates.remove(p);
        } else {
            vpnGroup.removePreference(p);
        }
    }
    // Show any new preferences on the screen
    for (Preference pref : updates) {
        vpnGroup.addPreference(pref);
    }
}
Also used : GearPreference(com.android.settings.widget.GearPreference) Preference(android.support.v7.preference.Preference) PreferenceGroup(android.support.v7.preference.PreferenceGroup) VisibleForTesting(com.android.internal.annotations.VisibleForTesting) UiThread(android.annotation.UiThread)

Example 3 with UiThread

use of android.annotation.UiThread in project android_packages_apps_Settings by LineageOS.

the class VpnSettings method setShownPreferences.

@VisibleForTesting
@UiThread
public void setShownPreferences(final Collection<Preference> updates) {
    mLegacyVpnPreferences.values().retainAll(updates);
    mAppPreferences.values().retainAll(updates);
    // Change {@param updates} in-place to only contain new preferences that were not already
    // added to the preference screen.
    final PreferenceGroup vpnGroup = getPreferenceScreen();
    for (int i = vpnGroup.getPreferenceCount() - 1; i >= 0; i--) {
        Preference p = vpnGroup.getPreference(i);
        if (updates.contains(p)) {
            updates.remove(p);
        } else {
            vpnGroup.removePreference(p);
        }
    }
    // Show any new preferences on the screen
    for (Preference pref : updates) {
        vpnGroup.addPreference(pref);
    }
}
Also used : GearPreference(com.android.settings.widget.GearPreference) Preference(android.support.v7.preference.Preference) PreferenceGroup(android.support.v7.preference.PreferenceGroup) VisibleForTesting(com.android.internal.annotations.VisibleForTesting) UiThread(android.annotation.UiThread)

Example 4 with UiThread

use of android.annotation.UiThread in project android_packages_apps_Settings by crdroidandroid.

the class VpnSettings method setShownPreferences.

@VisibleForTesting
@UiThread
public void setShownPreferences(final Collection<Preference> updates) {
    mLegacyVpnPreferences.values().retainAll(updates);
    mAppPreferences.values().retainAll(updates);
    // Change {@param updates} in-place to only contain new preferences that were not already
    // added to the preference screen.
    final PreferenceGroup vpnGroup = getPreferenceScreen();
    for (int i = vpnGroup.getPreferenceCount() - 1; i >= 0; i--) {
        Preference p = vpnGroup.getPreference(i);
        if (updates.contains(p)) {
            updates.remove(p);
        } else {
            vpnGroup.removePreference(p);
        }
    }
    // Show any new preferences on the screen
    for (Preference pref : updates) {
        vpnGroup.addPreference(pref);
    }
}
Also used : GearPreference(com.android.settings.widget.GearPreference) Preference(android.support.v7.preference.Preference) PreferenceGroup(android.support.v7.preference.PreferenceGroup) VisibleForTesting(com.android.internal.annotations.VisibleForTesting) UiThread(android.annotation.UiThread)

Example 5 with UiThread

use of android.annotation.UiThread in project android_packages_apps_Settings by SudaMod.

the class VpnSettings method setShownPreferences.

@VisibleForTesting
@UiThread
public void setShownPreferences(final Collection<Preference> updates) {
    mLegacyVpnPreferences.values().retainAll(updates);
    mAppPreferences.values().retainAll(updates);
    // Change {@param updates} in-place to only contain new preferences that were not already
    // added to the preference screen.
    final PreferenceGroup vpnGroup = getPreferenceScreen();
    for (int i = vpnGroup.getPreferenceCount() - 1; i >= 0; i--) {
        Preference p = vpnGroup.getPreference(i);
        if (updates.contains(p)) {
            updates.remove(p);
        } else {
            vpnGroup.removePreference(p);
        }
    }
    // Show any new preferences on the screen
    for (Preference pref : updates) {
        vpnGroup.addPreference(pref);
    }
}
Also used : GearPreference(com.android.settings.widget.GearPreference) Preference(android.support.v7.preference.Preference) PreferenceGroup(android.support.v7.preference.PreferenceGroup) VisibleForTesting(com.android.internal.annotations.VisibleForTesting) UiThread(android.annotation.UiThread)

Aggregations

UiThread (android.annotation.UiThread)7 GearPreference (com.android.settings.widget.GearPreference)7 Preference (android.support.v7.preference.Preference)5 PreferenceGroup (android.support.v7.preference.PreferenceGroup)5 VisibleForTesting (com.android.internal.annotations.VisibleForTesting)5 VisibleForTesting (androidx.annotation.VisibleForTesting)2 Preference (androidx.preference.Preference)2 PreferenceGroup (androidx.preference.PreferenceGroup)2