alexzhirkevich/custom-qr-generator

Logo from url

lJanusl opened this issue · 2 comments

Can you add the option to load a logo from the url and not just from resources? please

Thank you for your work, is very nice this library.

Hi, @lJanusl.

Thanks.

You can load logo drawable by yourself, for example using Glide and create custom DrawableSource. Is it public interface.

val logo : Drawable = loadDrawableFromWeb()

val options = createQrVectorOptions {
    logo {
        drawable = DrawableSource { logo } // it is 'fun interface'
    }
}

But don't load logo inside DrawableSource.get method.
It is suspend now, but runs blocking in QrCodeDrawable and it will no longer be suspend in next version

// Don't do this (it will freeze your app)

DrawableSource { loadDrawableFromWeb() } 

thanks a lot!