InflationX / Calligraphy

Custom fonts in Android the easy way...
Apache License 2.0
1.09k stars 82 forks source link

NPE in ViewPumpContextWrapper for Android Q #33

Closed MajaTrzebiatowska closed 5 years ago

MajaTrzebiatowska commented 5 years ago

For apps targeting Android Q: ViewPumpContextWrapper.java uses mConstructorArgsproperty in createCustomViewInternal method via reflection. Currently, this causes a NPE in this method: final Object[] mConstructorArgsArr = (Object[]) ReflectionUtils.getValue(mConstructorArgs, this);

From https://developer.android.com/preview/non-sdk-q:

Landroid/view/LayoutInflater;->mConstructorArgs:[Ljava/lang/Object; # LayoutInflater's mConstructorArgs was being accessed for two reasons: reading and writing the context. When onCreateView() was called, the inflation context was not being passed, so if the developer wanted to get it, they had to read it from mConstructorArgs. When the developer wanted to create a view, with createView(), the developer could not adjust the view's constructor context. New APIs for createView() and onCreateView() were added that take the View Context as an argument.

minSdkVersion: 21 targetSdkVersion: android-Q io.github.inflationx:calligraphy: 3:3.1 io.github.inflationx:viewpump: 1.0.0

MajaTrzebiatowska commented 5 years ago

Sorry, just noticed you've already these in ViewPump.