Search in sources :

Example 6 with LifecycleObserver

use of com.android.settingslib.core.lifecycle.LifecycleObserver in project android_packages_apps_Settings by DirtyUnicorns.

the class LanguageAndInputSettingsTest method testGetPreferenceControllers_shouldRegisterLifecycleObservers.

@Test
public void testGetPreferenceControllers_shouldRegisterLifecycleObservers() {
    final List<AbstractPreferenceController> controllers = mFragment.getPreferenceControllers(mActivity);
    int lifecycleObserverCount = 0;
    for (AbstractPreferenceController controller : controllers) {
        if (controller instanceof LifecycleObserver) {
            lifecycleObserverCount++;
        }
    }
    verify(mFragment.getLifecycle(), times(lifecycleObserverCount)).addObserver(any(LifecycleObserver.class));
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) LifecycleObserver(com.android.settingslib.core.lifecycle.LifecycleObserver) Test(org.junit.Test)

Example 7 with LifecycleObserver

use of com.android.settingslib.core.lifecycle.LifecycleObserver in project android_packages_apps_Settings by SudaMod.

the class LanguageAndInputSettingsTest method testGetPreferenceControllers_shouldRegisterLifecycleObservers.

@Test
public void testGetPreferenceControllers_shouldRegisterLifecycleObservers() {
    final List<AbstractPreferenceController> controllers = mFragment.getPreferenceControllers(mActivity);
    int lifecycleObserverCount = 0;
    for (AbstractPreferenceController controller : controllers) {
        if (controller instanceof LifecycleObserver) {
            lifecycleObserverCount++;
        }
    }
    verify(mFragment.getLifecycle(), times(lifecycleObserverCount)).addObserver(any(LifecycleObserver.class));
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) LifecycleObserver(com.android.settingslib.core.lifecycle.LifecycleObserver) Test(org.junit.Test)

Aggregations

AbstractPreferenceController (com.android.settingslib.core.AbstractPreferenceController)7 LifecycleObserver (com.android.settingslib.core.lifecycle.LifecycleObserver)7 Test (org.junit.Test)5 BasePreferenceController (com.android.settings.core.BasePreferenceController)2 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)2 Activity (android.app.Activity)1 SettingsEnums (android.app.settings.SettingsEnums)1 Context (android.content.Context)1 Bundle (android.os.Bundle)1 TextUtils (android.text.TextUtils)1 ArrayMap (android.util.ArrayMap)1 ArraySet (android.util.ArraySet)1 Log (android.util.Log)1 CallSuper (androidx.annotation.CallSuper)1 VisibleForTesting (androidx.annotation.VisibleForTesting)1 Preference (androidx.preference.Preference)1 PreferenceGroup (androidx.preference.PreferenceGroup)1 PreferenceManager (androidx.preference.PreferenceManager)1 PreferenceScreen (androidx.preference.PreferenceScreen)1 R (com.android.settings.R)1