use of org.androidannotations.api.view.HasViews in project androidannotations by androidannotations.
the class SomeSingletonTest method viewsAreNotInjected.
@Test
public void viewsAreNotInjected() throws Exception {
Context context = mock(Context.class);
OnViewChangedNotifier notifier = new OnViewChangedNotifier();
OnViewChangedNotifier.replaceNotifier(notifier);
SomeSingleton singleton = SomeSingleton_.getInstance_(context);
notifier.notifyViewChanged(new HasViews() {
@Override
public View findViewById(int id) {
return mock(View.class);
}
});
assertThat(singleton.myTextView).isNull();
assertThat(singleton.beanWithView.myTextView).isNull();
}
use of org.androidannotations.api.view.HasViews in project androidannotations by androidannotations.
the class EComponentWithViewSupportHolder method setOnViewChanged.
protected void setOnViewChanged() {
getGeneratedClass()._implements(OnViewChangedListener.class);
onViewChanged = getGeneratedClass().method(PUBLIC, getCodeModel().VOID, "onViewChanged");
onViewChanged.annotate(Override.class);
onViewChangedBody = onViewChanged.body();
onViewChangedBodyBeforeInjectionBlock = onViewChangedBody.blockVirtual();
onViewChangedBodyViewHolderBlock = onViewChangedBody.blockVirtual();
onViewChangedBodyInjectionBlock = onViewChangedBody.blockVirtual();
onViewChangedBodyAfterInjectionBlock = onViewChangedBody.blockVirtual();
onViewChangedHasViewsParam = onViewChanged.param(HasViews.class, "hasViews");
AbstractJClass notifierClass = getJClass(OnViewChangedNotifier.class);
getInitBodyInjectionBlock().staticInvoke(notifierClass, "registerOnViewChangedListener").arg(_this());
}
Aggregations