Watchmaker Wiki

The ultimate watch maker for Android Wear!

User Tools

Site Tools


battery

This is an old revision of the document!


Battery Widget

Battery Widgets are image widgets so please refer to them for their general use.

To display the current battery level, the battery widget uses a special image that contains multiple icons (also called a sprite). Depending on the image set chosen, the widget can display the level in different degrees of accuracy.

When adding the widget you can switch between the watch's and the phone's battery level to be displayed.

Using your own image

You can provide your own image. To do so select it in the “Custom Image” property and make sure to adjust the “image grid” property to match the layout of your sprite.

Which icon is displayed is displayed is determined by the “Image Selection” property. It should contain a lua expression returning the number of the image to show (on a 3×3 grid, 1 is the top left corner, 3 is top right and 7 is bottom left).

The default expression for the 7-icon set “Battery Set 3” is this:

'{bc}' == 'Charging' and 7 or {bl} >= 90 and 1 or {bl} >= 70 and 2 or {bl} >= 50 and 3 or {bl} >= 30 and 4 or {bl} >= 10 and 5 or 6

{bl} refers to the battery tag containing the current level in percent. The expression maps the many states this tag can have to the 7 available icons.

battery.1421781964.txt.gz · Last modified: 2015/01/20 19:26 by splitbrain