@@ -175,15 +175,15 @@ protected View onCreateView(String name, AttributeSet attrs) throws ClassNotFoun
175
175
* will fall back through to the PhoneLayoutInflater method of inflating custom views where
176
176
* Calligraphy will NOT have a hook into.
177
177
*
178
- * @param parent parent view
179
- * @param view view if it has been inflated by this point, if this is not null this method
180
- * just returns this value.
181
- * @param name name of the thing to inflate.
182
- * @param context Context to inflate by if parent is null
183
- * @param attrs Attr for this view which we can steal fontPath from too.
178
+ * @param parent parent view
179
+ * @param view view if it has been inflated by this point, if this is not null this method
180
+ * just returns this value.
181
+ * @param name name of the thing to inflate.
182
+ * @param viewContext Context to inflate by if parent is null
183
+ * @param attrs Attr for this view which we can steal fontPath from too.
184
184
* @return view or the View we inflate in here.
185
185
*/
186
- private View createCustomViewInternal (View parent , View view , String name , Context context , AttributeSet attrs ) {
186
+ private View createCustomViewInternal (View parent , View view , String name , Context viewContext , AttributeSet attrs ) {
187
187
// I by no means advise anyone to do this normally, but Google have locked down access to
188
188
// the createView() method, so we never get a callback with attributes at the end of the
189
189
// createViewFromTag chain (which would solve all this unnecessary rubbish).
@@ -200,7 +200,10 @@ private View createCustomViewInternal(View parent, View view, String name, Conte
200
200
201
201
final Object [] mConstructorArgsArr = (Object []) ReflectionUtils .getValue (mConstructorArgs , this );
202
202
final Object lastContext = mConstructorArgsArr [0 ];
203
- mConstructorArgsArr [0 ] = parent != null ? parent .getContext () : context ;
203
+ // The LayoutInflater actually finds out the correct context to use. We just need to set
204
+ // it on the mConstructor for the internal method.
205
+ // Set the constructor ars up for the createView, not sure why we can't pass these in.
206
+ mConstructorArgsArr [0 ] = viewContext ;
204
207
ReflectionUtils .setValue (mConstructorArgs , this , mConstructorArgsArr );
205
208
try {
206
209
view = createView (name , null , attrs );
0 commit comments