AdaptiveCards icon indicating copy to clipboard operation
AdaptiveCards copied to clipboard

[Android] Support relative URLs for images in UWP renderer

Open tuanh118 opened this issue 8 years ago • 2 comments

tuanh118 avatar May 14 '18 16:05 tuanh118

@khouzam @matthidinger There are a few things I want to know what you guys think:

  • For Android, we only support online images (http/https) and haven't supported local image URI before. So if an app devs want to access bitmap (image) files in res/drawable, they can't simply specify something like "url": "res/drawable/profile_pic.jpg" in the card payload. For this issue, I have added the code to support that.
  • About the relative image URL support, the only place Android devs are recommended to put their bitmap files is res/drawable. So the only possible reason we need to support imageBaseUrl is when they want to put bitmap files in sub-folders in res/drawable. However, sub-folders inside that folder is not recommended. There's a way to workaround that, which allows devs to put bitmap files in different sub-folders. I have tried that in our visualizer, and even with that new structure, Android is able to find the image location given only the file name. Therefore, the imageBaseUrl is not necessary here either.

So I think we might just want to commit the support for local image files, without consideration for the imageBaseUrl. imageBaseUrl, if specified, would only be ignored without any error or warning

tuanh118 avatar May 18 '18 22:05 tuanh118

Based on the discussion with @khouzam, we decided to proceed with the "opt-in" way to give users more control over local resource access. That means when imageBaseUrl is not specified/null/empty, the URL resolver will not look locally at all, even if online lookup fails. Only when imageBaseUrl is explicitly given a value (e.g., res/drawable), the resolver will attempt local resource

tuanh118 avatar May 23 '18 17:05 tuanh118