Closed mueller-ma closed 6 years ago
One issue is that the whole sitemap is refreshed and not just the one item that changed.
Apparently not exactly the whole sitemap but only the updated pages. If you have 2 pages displayed, you can see the "flashing" only in the page that has to be refreshed.
Hey,
Just update UI elements if necessary.
You can't compare ImageURL information, because state sometimes contains random like information (/icon/time?state=3.0 or /icon/time?state=3.6, ...).
So compare the drawables itself (the new one and that from the cache).
Change your OpenHABWidgetAdapter adapter and replace:
widgetImage.setImageUrl(iconUrl, R.drawable.blank_icon, openHABUsername, openHABPassword);
with
Drawable currentWidgetImageDrawable = widgetImage.getDrawable();
WebImageCache webImageCache = MyWebImage.getWebImageCache(getContext());
Bitmap cachedImageBitmap = webImageCache.get(iconUrl);
Drawable cachedDrawable = new BitmapDrawable(getContext().getResources(), cachedImageBitmap);
if (currentWidgetImageDrawable == null || ! currentWidgetImageDrawable.equals(cachedDrawable)) {
widgetImage.setImageUrl(iconUrl, R.drawable.blank_icon,
openHABUsername, openHABPassword);
}
This will fix the flicker/flashing problem :)
Best regards, Mario Adamo
Navigate to any page in your sitemap and wait until some item changes. All icons in the sitemap flash.
Reported here: https://community.openhab.org/t/android-and-ios-2-0-releases/37405/3?u=mueller-ma