public static final class ViewPump.Builder
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
ViewPump.Builder |
addInterceptor(Interceptor interceptor) |
ViewPump |
build() |
ViewPump.Builder |
setCustomViewInflationEnabled(boolean enabled)
Due to the poor inflation order where custom views are created and never returned inside an
onCreateView(...) method. |
ViewPump.Builder |
setPrivateFactoryInjectionEnabled(boolean enabled)
Turn of the use of Reflection to inject the private factory.
|
public ViewPump.Builder addInterceptor(Interceptor interceptor)
public ViewPump.Builder setPrivateFactoryInjectionEnabled(boolean enabled)
Turn of the use of Reflection to inject the private factory. This has operational consequences! Please read and understand before disabling.
If you disable this you will need to override your Activity.onCreateView(View, String, android.content.Context, android.util.AttributeSet)
as this is set as the LayoutInflater private factory.
@Override
public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
return ViewPumpContextWrapper.onActivityCreateView(this, parent, super.onCreateView(parent, name, context, attrs), name, context, attrs);
}
enabled - True if private factory inject is allowed; otherwise, false.public ViewPump.Builder setCustomViewInflationEnabled(boolean enabled)
onCreateView(...) method. We have to create CustomView's at the latest point in the
overrideable injection flow.
On HoneyComb+ this is inside the Activity.onCreateView(View, String, android.content.Context, android.util.AttributeSet)
We wrap base implementations, so if you LayoutInflater/Factory/Activity creates the
custom view before we get to this point, your view is used. (Such is the case with the
TintEditText etc)
The problem is, the native methods pass there parents context to the constructor in a really
specific place. We have to mimic this in ViewPumpLayoutInflater.createCustomViewInternal(View, View, String, android.content.Context, android.util.AttributeSet)
To mimic this we have to use reflection as the Class constructor args are hidden to us.
We have discussed other means of doing this but this is the only semi-clean way of doing it.
(Without having to do proxy classes etc).
Calling this will of course speed up inflation by turning off reflection, but not by much,
But if you want ViewPump to inject the correct typeface then you will need to make sure your CustomView's
are created before reaching the LayoutInflater onViewCreated.enabled - True if custom view inflated is allowed; otherwise, false.public ViewPump build()