public InflateResult Intercept(IInterceptorChain chain) { var request = chain.Request(); if (request.Parent() is InflatedViewWithBinding inflatedViewWithBinding) { // Note that we never clear the applicator... sometimes the parent is seemingly null even though // it's still under the applicator. If we start binding a new host, the first view should assign it correctly. // However the problem is when we have a subview that we inflate that's also an InflatedViewWithBinding... when that // returns, we're going to have the wrong binding applicator... _currentBindingApplicator = inflatedViewWithBinding.BindingApplicator; } // Calling proceed will sometimes recursively continue down, when we return we need to restore the binding applicator var thisCurrentBindingApplicator = _currentBindingApplicator; var result = chain.Proceed(request); _currentBindingApplicator = thisCurrentBindingApplicator; var view = result.View(); if (view != null) { // Localize text strings // This will stop executing on the first matched type bool localized = LocalizeProperty <EditText>(view, (v) => v.Hint, (v, str) => { v.Hint = str; }) || LocalizeProperty <TextView>(view, (v) => v.Text, (v, str) => { v.Text = str; }) || LocalizeProperty <TextInputLayout>(view, (v) => v.Hint, (v, str) => { v.Hint = str; }); var attrSet = result.Attrs(); var bindingStr = attrSet.GetAttributeValue("http://schemas.android.com/apk/res-auto", "Binding"); if (bindingStr != null) { var bindingExpressions = ParseBindingString(view, bindingStr); if (bindingExpressions.Count > 0) { if (_currentBindingApplicator == null) { #if DEBUG if (Debugger.IsAttached) { Debugger.Break(); } #endif } else { _currentBindingApplicator.ApplyBindings(view, bindingExpressions); } } } } return(result); }
public InflateResult Intercept(IInterceptorChain p0) { var result = p0.Proceed(p0.Request()); if (result.View() is TextView textView) { textView.Text = "[Prefix]: " + textView.Text; } return(result); }
public object Handle(IUnitOfWork unitOfWork, IInterceptorChain interceptorChain) { InterceptorChainParameterResolverFactory.Initialize(interceptorChain); var result = _delegate.Handle(unitOfWork.Message, _target); if (_delegate.Unwrap <ICommandHandlerInterceptorHandlingMember>() .Map(x => x.ShouldInvokeInterceptorChain()).OrElse(false)) { result = interceptorChain.Proceed(); } return(result); }
public object Handle(IUnitOfWork <ICommandMessage <TPayload>, TPayload> unitOfWork, IInterceptorChain interceptorChain) { InterceptorChainParameterResolverFactory.Initialize <ICommandMessage <TPayload>, TPayload>(interceptorChain); object result = _delegate.Handle(unitOfWork.GetMessage(), _target); if (_delegate .Unwrap <ICommandHandlerInterceptorHandlingMember <TTarget> >()?.ShouldInvokeInterceptorChain() ?? false) { result = interceptorChain.Proceed(); } return(result); }
public Response Intercept(IInterceptorChain chain) { var response = chain.Proceed(chain.Request()); return(IsCompressed(response) ? Decompress(response) : response); }