BlinkID / blinkid-ui-android

Customizable UI library that includes camera management, scanning screen, and document selection module.
35 stars 10 forks source link

AndroidX compatibility issue #53

Closed laoluani closed 5 years ago

laoluani commented 5 years ago

Hey, I am currently using androidX in my project however this library currently does not support it. My workaround has been to fork the project and make the minor changes myself.

Would be great if this was built in, also happy to make a PR.

matvidako commented 5 years ago

Hi,

we're planning to switch to androidX soon. Until then, it should work fine if you enable jetifier in your project. Did you have issues even after enabling it?

laoluani commented 5 years ago

So I tried this and the mappings to the androidX artifacts cause compilation errors.

  1. The androidx.appcompat.app.AppCompatActivity library changed the method signature of onConfigurationChanged(Configuration config) to onConfigurationChanged(@ NonNull Configuration config). Which interops in Kotlin to a non null Configuration type causing compilation errors in the override of your BaseDocumentScanActivity class, which wants a nullable Configuration object. breaking this line

  2. The androidX counterpart of android.support.design.widget.TabLayout.OnTabSelectedListener no longer inherits from android.support.design.widget.TabLayout.BaseOnTabSelectedListener like it does in the support library. As seen here, breaking this line.

The simple fix for 1. was to change the method signature of your BaseDocumentScanActivity override from onConfigurationChanged(Configuration? config) to onConfigurationChanged(Configuration config). The fix for 2. was to create a lambda using the BaseOnTabSelectedListener rather than OnTabSelectedListener.

matvidako commented 5 years ago

Thanks, we'll include those 2 fixes in the next release to make sure everything works for both androidX and support lib users.

laoluani commented 5 years ago

Awesome looking forward to it and thanks for the speedy replies!

matvidako commented 5 years ago

Hi,

we've just released a new version that includes AndroidX fixes.