@Test public void shouldSwitchToMinimalBrightnessWhenCurrentValueIsMoreThanMinimalOne() { val backlightSwitch = givenDefaultBacklightSwitch(); val settings = givenSettingsWithBrightnessValue(50); val controller = new BacklightSwitch.BacklightController(settings, backlightSwitch); controller.onClick(mock(View.class)); then(settings).should().enableManualBrightnessControl(); then(settings).should().setScreenBrightnessTo(BRIGHTNESS_MIN); then(backlightSwitch).should().setImageBasedOn(BRIGHTNESS_MIN); }
void setImageBasedOn(final int brightnessValue) { setImageResource(brightnessValue == BRIGHTNESS_MIN ? R.drawable.ic_backlight_off_toolbar : R.drawable.ic_backlight_on_toolbar); }
BacklightSwitch extends AppCompatImageButton { void setImageBasedOn(final int brightnessValue) { setImageResource(brightnessValue == BRIGHTNESS_MIN ? R.drawable.ic_backlight_off_toolbar : R.drawable.ic_backlight_on_toolbar); } }
BacklightSwitch extends AppCompatImageButton { void setImageBasedOn(final int brightnessValue) { setImageResource(brightnessValue == BRIGHTNESS_MIN ? R.drawable.ic_backlight_off_toolbar : R.drawable.ic_backlight_on_toolbar); } BacklightSwitch(final Context context, final AttributeSet attrs); }
BacklightSwitch extends AppCompatImageButton { void setImageBasedOn(final int brightnessValue) { setImageResource(brightnessValue == BRIGHTNESS_MIN ? R.drawable.ic_backlight_off_toolbar : R.drawable.ic_backlight_on_toolbar); } BacklightSwitch(final Context context, final AttributeSet attrs);  }
BacklightSwitch extends AppCompatImageButton { void setImageBasedOn(final int brightnessValue) { setImageResource(brightnessValue == BRIGHTNESS_MIN ? R.drawable.ic_backlight_off_toolbar : R.drawable.ic_backlight_on_toolbar); } BacklightSwitch(final Context context, final AttributeSet attrs);   }