@Test public void actionAppliedToEveryView() { View view1 = new View(Robolectric.application); View view2 = new View(Robolectric.application); View view3 = new View(Robolectric.application); assertThat(view1).isEnabled(); assertThat(view2).isEnabled(); assertThat(view3).isEnabled(); List<View> views = Arrays.asList(view1, view2, view3); ButterKnife.apply(views, ACTION_DISABLE); assertThat(view1).isDisabled(); assertThat(view2).isDisabled(); assertThat(view3).isDisabled(); }
@Test public void propertyAppliedToEveryView() { View view1 = new View(Robolectric.application); View view2 = new View(Robolectric.application); View view3 = new View(Robolectric.application); assertThat(view1).isEnabled(); assertThat(view2).isEnabled(); assertThat(view3).isEnabled(); List<View> views = Arrays.asList(view1, view2, view3); ButterKnife.apply(views, PROPERTY_ENABLED, false); assertThat(view1).isDisabled(); assertThat(view2).isDisabled(); assertThat(view3).isDisabled(); }
@OnClick(R.id.hello) void sayHello() { Toast.makeText(this, "Hello, views!", LENGTH_SHORT).show(); ButterKnife.apply(headerViews, ALPHA_FADE); }