Loading core/java/android/view/LayoutInflater.java +44 −17 Original line number Original line Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.view; package android.view; import android.annotation.LayoutRes; import android.annotation.LayoutRes; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Nullable; import android.annotation.SystemService; import android.annotation.SystemService; import android.annotation.UnsupportedAppUsage; import android.annotation.UnsupportedAppUsage; Loading Loading @@ -774,24 +775,8 @@ public abstract class LayoutInflater { ta.recycle(); ta.recycle(); } } if (name.equals(TAG_1995)) { // Let's party like it's 1995! return new BlinkLayout(context, attrs); } try { try { View view; View view = tryCreateView(parent, name, context, attrs); if (mFactory2 != null) { view = mFactory2.onCreateView(parent, name, context, attrs); } else if (mFactory != null) { view = mFactory.onCreateView(name, context, attrs); } else { view = null; } if (view == null && mPrivateFactory != null) { view = mPrivateFactory.onCreateView(parent, name, context, attrs); } if (view == null) { if (view == null) { final Object lastContext = mConstructorArgs[0]; final Object lastContext = mConstructorArgs[0]; Loading Loading @@ -825,6 +810,48 @@ public abstract class LayoutInflater { } } } } /** * Tries to create a view from a tag name using the supplied attribute set. * * This method gives the factory provided by {@link LayoutInflater#setFactory} and * {@link LayoutInflater#setFactory2} a chance to create a view. However, it does not apply all * of the general view creation logic, and thus may return {@code null} for some tags. This * method is used by {@link LayoutInflater#inflate} in creating {@code View} objects. * * @hide for use by precompiled layouts. * * @param parent the parent view, used to inflate layout params * @param name the name of the XML tag used to define the view * @param context the inflation context for the view, typically the * {@code parent} or base layout inflater context * @param attrs the attribute set for the XML tag used to define the view */ @UnsupportedAppUsage(trackingBug = 122360734) @Nullable public final View tryCreateView(@Nullable View parent, @NonNull String name, @NonNull Context context, @NonNull AttributeSet attrs) { if (name.equals(TAG_1995)) { // Let's party like it's 1995! return new BlinkLayout(context, attrs); } View view; if (mFactory2 != null) { view = mFactory2.onCreateView(parent, name, context, attrs); } else if (mFactory != null) { view = mFactory.onCreateView(name, context, attrs); } else { view = null; } if (view == null && mPrivateFactory != null) { view = mPrivateFactory.onCreateView(parent, name, context, attrs); } return view; } /** /** * Recursive method used to inflate internal (non-root) children. This * Recursive method used to inflate internal (non-root) children. This * method calls through to {@link #rInflate} using the parent context as * method calls through to {@link #rInflate} using the parent context as Loading Loading
core/java/android/view/LayoutInflater.java +44 −17 Original line number Original line Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.view; package android.view; import android.annotation.LayoutRes; import android.annotation.LayoutRes; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Nullable; import android.annotation.SystemService; import android.annotation.SystemService; import android.annotation.UnsupportedAppUsage; import android.annotation.UnsupportedAppUsage; Loading Loading @@ -774,24 +775,8 @@ public abstract class LayoutInflater { ta.recycle(); ta.recycle(); } } if (name.equals(TAG_1995)) { // Let's party like it's 1995! return new BlinkLayout(context, attrs); } try { try { View view; View view = tryCreateView(parent, name, context, attrs); if (mFactory2 != null) { view = mFactory2.onCreateView(parent, name, context, attrs); } else if (mFactory != null) { view = mFactory.onCreateView(name, context, attrs); } else { view = null; } if (view == null && mPrivateFactory != null) { view = mPrivateFactory.onCreateView(parent, name, context, attrs); } if (view == null) { if (view == null) { final Object lastContext = mConstructorArgs[0]; final Object lastContext = mConstructorArgs[0]; Loading Loading @@ -825,6 +810,48 @@ public abstract class LayoutInflater { } } } } /** * Tries to create a view from a tag name using the supplied attribute set. * * This method gives the factory provided by {@link LayoutInflater#setFactory} and * {@link LayoutInflater#setFactory2} a chance to create a view. However, it does not apply all * of the general view creation logic, and thus may return {@code null} for some tags. This * method is used by {@link LayoutInflater#inflate} in creating {@code View} objects. * * @hide for use by precompiled layouts. * * @param parent the parent view, used to inflate layout params * @param name the name of the XML tag used to define the view * @param context the inflation context for the view, typically the * {@code parent} or base layout inflater context * @param attrs the attribute set for the XML tag used to define the view */ @UnsupportedAppUsage(trackingBug = 122360734) @Nullable public final View tryCreateView(@Nullable View parent, @NonNull String name, @NonNull Context context, @NonNull AttributeSet attrs) { if (name.equals(TAG_1995)) { // Let's party like it's 1995! return new BlinkLayout(context, attrs); } View view; if (mFactory2 != null) { view = mFactory2.onCreateView(parent, name, context, attrs); } else if (mFactory != null) { view = mFactory.onCreateView(name, context, attrs); } else { view = null; } if (view == null && mPrivateFactory != null) { view = mPrivateFactory.onCreateView(parent, name, context, attrs); } return view; } /** /** * Recursive method used to inflate internal (non-root) children. This * Recursive method used to inflate internal (non-root) children. This * method calls through to {@link #rInflate} using the parent context as * method calls through to {@link #rInflate} using the parent context as Loading