Search in sources :

Example 6 with DreamInfo

use of com.android.settingslib.dream.DreamBackend.DreamInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class CurrentDreamPickerTest method setDefaultShouldUpdateActiveDream.

@Test
public void setDefaultShouldUpdateActiveDream() {
    DreamInfo mockInfo = mock(DreamInfo.class);
    ComponentName mockName = mock(ComponentName.class);
    mockInfo.componentName = mockName;
    when(mockName.flattenToString()).thenReturn(COMPONENT_KEY);
    when(mBackend.getDreamInfos()).thenReturn(Collections.singletonList(mockInfo));
    mPicker.setDefaultKey(COMPONENT_KEY);
    verify(mBackend).setActiveDream(mockName);
}
Also used : DreamInfo(com.android.settingslib.dream.DreamBackend.DreamInfo) ComponentName(android.content.ComponentName) Test(org.junit.Test)

Example 7 with DreamInfo

use of com.android.settingslib.dream.DreamBackend.DreamInfo in project android_packages_apps_Settings by omnirom.

the class CurrentDreamPreferenceController method setGearClickListenerForPreference.

private void setGearClickListenerForPreference(Preference preference) {
    if (!(preference instanceof GearPreference)) {
        return;
    }
    final GearPreference gearPreference = (GearPreference) preference;
    final Optional<DreamInfo> info = getActiveDreamInfo();
    if (!info.isPresent() || info.get().settingsComponentName == null) {
        gearPreference.setOnGearClickListener(null);
        return;
    }
    gearPreference.setOnGearClickListener(gearPref -> launchScreenSaverSettings());
}
Also used : GearPreference(com.android.settings.widget.GearPreference) DreamInfo(com.android.settingslib.dream.DreamBackend.DreamInfo)

Example 8 with DreamInfo

use of com.android.settingslib.dream.DreamBackend.DreamInfo in project android_packages_apps_Settings by omnirom.

the class CurrentDreamPickerTest method setDefaultShouldUpdateActiveDream.

@Test
public void setDefaultShouldUpdateActiveDream() {
    DreamInfo mockInfo = mock(DreamInfo.class);
    ComponentName mockName = mock(ComponentName.class);
    mockInfo.componentName = mockName;
    when(mockName.flattenToString()).thenReturn(COMPONENT_KEY);
    when(mBackend.getDreamInfos()).thenReturn(Collections.singletonList(mockInfo));
    mPicker.setDefaultKey(COMPONENT_KEY);
    verify(mBackend).setActiveDream(mockName);
}
Also used : DreamInfo(com.android.settingslib.dream.DreamBackend.DreamInfo) ComponentName(android.content.ComponentName) Test(org.junit.Test)

Example 9 with DreamInfo

use of com.android.settingslib.dream.DreamBackend.DreamInfo in project android_packages_apps_Settings by LineageOS.

the class CurrentDreamPreferenceController method setGearClickListenerForPreference.

private void setGearClickListenerForPreference(Preference preference) {
    if (!(preference instanceof GearPreference))
        return;
    GearPreference gearPreference = (GearPreference) preference;
    Optional<DreamInfo> info = getActiveDreamInfo();
    if (!info.isPresent() || info.get().settingsComponentName == null) {
        gearPreference.setOnGearClickListener(null);
        return;
    }
    gearPreference.setOnGearClickListener(gearPref -> launchScreenSaverSettings());
}
Also used : GearPreference(com.android.settings.widget.GearPreference) DreamInfo(com.android.settingslib.dream.DreamBackend.DreamInfo)

Example 10 with DreamInfo

use of com.android.settingslib.dream.DreamBackend.DreamInfo in project android_packages_apps_Settings by LineageOS.

the class CurrentDreamPickerTest method setDefaultShouldUpdateActiveDream.

@Test
public void setDefaultShouldUpdateActiveDream() {
    DreamInfo mockInfo = mock(DreamInfo.class);
    ComponentName mockName = mock(ComponentName.class);
    mockInfo.componentName = mockName;
    when(mockName.flattenToString()).thenReturn(COMPONENT_KEY);
    when(mBackend.getDreamInfos()).thenReturn(new ArrayList<>(Arrays.asList(mockInfo)));
    mPicker.setDefaultKey(COMPONENT_KEY);
    verify(mBackend).setActiveDream(mockName);
}
Also used : DreamInfo(com.android.settingslib.dream.DreamBackend.DreamInfo) ComponentName(android.content.ComponentName) Test(org.junit.Test)

Aggregations

DreamInfo (com.android.settingslib.dream.DreamBackend.DreamInfo)14 ComponentName (android.content.ComponentName)7 GearPreference (com.android.settings.widget.GearPreference)7 Test (org.junit.Test)7