openhab-core icon indicating copy to clipboard operation
openhab-core copied to clipboard

[FR] Dynamic icons not only for 0-100

Open DerOetzi opened this issue 4 years ago • 9 comments

Dynamic icons are at the moment only available for number values between 0 and 100. For several QuantityTypes there are higher values possible, for example: pressure, CO2 (ppm), distance in meter and many more.

It should be possible to have dynamic icons for those as well.

When I have looked correctly it should be very easy to do so by removing this if-statement: https://github.com/openhab/openhab-core/blob/3811cb95604f69f6a3d77da2caf391d81b05458e/bundles/org.openhab.core.ui.icon/src/main/java/org/openhab/core/ui/icon/AbstractResourceIconProvider.java#L111

But I don't know why this restriction was introduced before, maybe some performance issues.

DerOetzi avatar Apr 19 '20 13:04 DerOetzi

@kaikreuzer I have seen you have initial contributed this code. Maybe you can explain me why this restriction is needed?

Thanks in advance

DerOetzi avatar Mar 28 '21 19:03 DerOetzi

The restriction is there because we only provide those for percentage values out of the box. All other cases very often highly depend on your individual use case (and also the unit that is used). Also, as you can see in line 112, we are iterating over every single integer in the range, so this mechanism simply won't work for any natural number.

kaikreuzer avatar Mar 29 '21 06:03 kaikreuzer

Thanks for explanation. Yes I have seen this iteration. So you mean to use it with natural number the algorithm should be changed. To scan for all files in directory per wildcard matching for example battery-*.svg and then iterate only over this results. I can try to make a draft for this.

Are there any other known IconProviders beside the CustomIconProvider in this Project and the ClassicIconProvider in webui?

DerOetzi avatar Mar 29 '21 08:03 DerOetzi

Are there any other known IconProviders beside the CustomIconProvider in this Project and the ClassicIconProvider in webui?

No, at least not in the official codebase.

kaikreuzer avatar Mar 29 '21 20:03 kaikreuzer

@DerOetzi Are you still interested and working on this?

J-N-K avatar May 10 '22 16:05 J-N-K

@J-N-K Yes I'm still interested in this feature but have no time at the moment to have a look on this. I have a workaround on this by scaling down and up for the gui items

DerOetzi avatar May 28 '22 11:05 DerOetzi

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 27 '22 13:07 stale[bot]

Let's keep this feature request opened.

lolodomo avatar Jul 28 '22 17:07 lolodomo

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 26 '22 18:09 stale[bot]