use of org.robobinding.PendingAttributesForView in project RoboBinding by RoboBinding.
the class BindingViewInflater method onViewCreated.
@Override
public void onViewCreated(View childView, AttributeSet attrs) {
Map<String, String> pendingAttributeMappings = bindingAttributeParser.parse(attrs);
if (!pendingAttributeMappings.isEmpty()) {
PendingAttributesForView pendingAttributesForView = new PendingAttributesForViewImpl(childView, pendingAttributeMappings);
resolveAndAddViewBindingAttributes(pendingAttributesForView);
}
}
use of org.robobinding.PendingAttributesForView in project RoboBinding by RoboBinding.
the class BindingViewInflater method addPredefinedPendingAttributesForViewGroup.
private void addPredefinedPendingAttributesForViewGroup(Collection<PredefinedPendingAttributesForView> predefinedPendingAttributesForViewGroup, View rootView) {
for (PredefinedPendingAttributesForView predefinedPendingAttributesForView : predefinedPendingAttributesForViewGroup) {
PendingAttributesForView pendingAttributesForView = predefinedPendingAttributesForView.createPendingAttributesForView(rootView);
resolveAndAddViewBindingAttributes(pendingAttributesForView);
}
}
use of org.robobinding.PendingAttributesForView in project RoboBinding by RoboBinding.
the class BindingAttributeResolverTest method givenTwoCandidateResolvers_whenResolve_thenBothResolversShouldInvolveResolving.
@Test
public void givenTwoCandidateResolvers_whenResolve_thenBothResolversShouldInvolveResolving() {
ByBindingAttributeMappingsResolver candidateResolver1 = mock(ByBindingAttributeMappingsResolver.class);
ByBindingAttributeMappingsResolver candidateResolver2 = mock(ByBindingAttributeMappingsResolver.class);
when(byBindingAttributeMappingsResolverFinder.findCandidates(any(View.class))).thenReturn(newArrayList(candidateResolver1, candidateResolver2));
BindingAttributeResolver bindingAttributeResolver = new BindingAttributeResolver(byBindingAttributeMappingsResolverFinder);
PendingAttributesForView pendingAttributesForView = mock(PendingAttributesForView.class);
when(pendingAttributesForView.isEmpty()).thenReturn(false);
bindingAttributeResolver.resolve(pendingAttributesForView);
verify(candidateResolver1).resolve(pendingAttributesForView);
verify(candidateResolver2).resolve(pendingAttributesForView);
}
use of org.robobinding.PendingAttributesForView in project RoboBinding by RoboBinding.
the class BindingViewInflaterTest method createAPredefinedPendingAttributesForView.
private Collection<PredefinedPendingAttributesForView> createAPredefinedPendingAttributesForView() {
PredefinedPendingAttributesForView predefinedPendingAttributesForView = mock(PredefinedPendingAttributesForView.class);
PendingAttributesForView pendingAttributesForView = mock(PendingAttributesForView.class);
when(predefinedPendingAttributesForView.createPendingAttributesForView(any(View.class))).thenReturn(pendingAttributesForView);
return Lists.newArrayList(predefinedPendingAttributesForView);
}
use of org.robobinding.PendingAttributesForView in project RoboBinding by RoboBinding.
the class ResolutionTest method givenASingleView_whenResolvingMissingGroupBindingAttributes_thenThrowExceptionReferencingView.
@Test
public void givenASingleView_whenResolvingMissingGroupBindingAttributes_thenThrowExceptionReferencingView() {
PendingAttributesForView pendingAttributesForAdapterView = aPendingAttributesForAdapterView().withAttribute("source", "{names}").build();
try {
resolveBindingAttributes(pendingAttributesForAdapterView);
fail("Expected exception to be thrown");
} catch (ViewResolutionErrorsException e) {
assertThat(e.getView(), equalTo(pendingAttributesForAdapterView.getView()));
assertThat(e.getMissingRequiredAttributeErrors().size(), is(1));
}
}
Aggregations