-
-
Notifications
You must be signed in to change notification settings - Fork 461
Add documentation for progress bar customization on Android #1297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 6 commits
eaa7290
e5c9ca7
bf17360
3ffdb95
c76af10
68f2805
3bad1c5
9c92b9e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -617,6 +617,77 @@ automation: | |
| progress_max: 32 | ||
| ``` | ||
|
|
||
| #### Styling the progress bar <span class='beta'>BETA</span> {#styling-the-progress-bar} | ||
|
|
||
| On Android 16.0+, you can customize the progress bar with segments, points, and icons. | ||
|
|
||
| :::note | ||
| When using any of these options together with a video attachment, the video attachment will not be shown. The `progress_indeterminate` parameter will also be ignored. | ||
| ::: | ||
|
|
||
| The following parameters can be mixed and matched together to style the progress bar: | ||
|
|
||
| ##### Progress segments | ||
|
|
||
| - `progress_segments`. A list of segments that make up the progress bar, each with its own length and optional color. | ||
| - **Required properties**: `length`. The length/size of the segment, any number larger than 0. | ||
| - **Optional properties**: `color`. Hex color code for the segment (for example, `"#ff0000"` or `"#00ff00"`). | ||
|
inukiwi marked this conversation as resolved.
Outdated
inukiwi marked this conversation as resolved.
Outdated
|
||
| - **Note**: When using segments, `progress_max` is automatically calculated as the sum of all segment lengths and should not be specified separately. | ||
|
inukiwi marked this conversation as resolved.
Outdated
|
||
|
|
||
| ##### Progress points | ||
|
|
||
| - `progress_points`: Markers displayed as points along the progress bar to highlight specific milestones or thresholds. | ||
| - **Required properties**: `position`. The position on the progress bar where the point should appear (must be between 0 and `progress_max`). | ||
| - **Optional properties**: `color`. Hex color code for the point (for example, `"#ffde03"`). | ||
|
inukiwi marked this conversation as resolved.
Outdated
|
||
|
|
||
| ##### Progress icons | ||
|
|
||
| - `progress_start_icon`: Icon displayed at the start of the progress bar. For example: `"mdi:battery-10"`. | ||
| - **Format**: Material Design Icons only, use format `mdi:icon-name` (for example, `mdi:home` or `mdi:download`). | ||
| - `progress_end_icon`: Icon displayed at the end of the progress bar. For example: `"mdi:battery"` | ||
|
Comment on lines
+645
to
+647
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to define start and end? Can't we make it generic so the user defines a bunch of points and we just render based on that definition?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Think of the "Point" as an object containing:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be nice to have a "accessibility_name" as well for people using
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could probably make it more generic, but if the goal is to make it easier for the end user I think it would make things more complicated by explaining all the restrictions. A point can only have a position and color, it will always be rendered as a small dot on the progress bar and can't have any icon. There can be unlimited points on a progress bar. In the image below you can see the difference: the arrow and the car are trackers, the pink square is a point.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Understood, but iOS has more flexibility in this situation (for the first time 🙌🏻), when this gets implemented in iOS we could allow users to customize their points, for example: In a "waiting for package delivery" scenario:
I think this way we keep it more future proof, what do you think? We can have default values as well so the user does not need to fill everything
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Depends how you write it, I'd say we explain in a simple manner + examples + one image pointing to the part of the UI the YAML refers to (have a UI in HA instead of yaml would be lovely but... out of scope). "To define your notification progress indicators you just need to provide an
"The points located at position 0 or at progress_max can define icons to be visible at the beginning and end of the progress bar, the other points do not support icons and will be displayed along the way." "Check how it looks like in a package delivery scenario following the image below"
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My example above has the assumption we add a key "is_tracker" or something like that
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to see the two proposal face to face to decide. I agree that point seems more generic but at the same the logic to display before and after the progress bar is not friendly
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps thats where we draw the line and we start differentiating, android specific use cases and iOS specific. If the original proposal is implemented I can make it happen in iOS as well and then for more customization a third type can be introduced just for iOS.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've created a draft of what the documentation would look like in my opinion if we go for a points-only approach: inukiwi@0f88d27 |
||
| - **Format**: Material Design Icons only, use format `mdi:icon-name` (for example, `mdi:flag-checkered` or `mdi:check-circle`). | ||
| - `progress_tracker_icon`. Icon displayed in a circular badge that tracks the current progress position. For example: `"mdi:lightning-bolt"`. | ||
| - **Format**: Material Design Icons only, use format `mdi:icon-name` (for example, `mdi:car` or `mdi:walk`). | ||
| - **Note**: The tracker icon has a colored circular background for emphasis. | ||
|
inukiwi marked this conversation as resolved.
Outdated
|
||
|
|
||
| **Icon colors** | ||
|
|
||
| - `progress_start_color`. Color for the start icon. For example: `"#ff0000"`. | ||
| - **Default**: System accent color. | ||
| - `progress_end_color`: Color for the end icon. For example: `"#00ff00"`. | ||
| - **Default**: System accent color. | ||
| - `progress_tracker_color`. Color for the tracker icon. For example: `"#ffde03"`. | ||
| - **Default**: System primary color. | ||
| - `tracker` will be shown in a circle at the current progress | ||
|
|
||
| ```yaml | ||
| automation: | ||
| - alias: Notify of car charging progress | ||
| trigger: | ||
| ... | ||
| action: | ||
| - action: notify.mobile_app_<your_device_id_here> | ||
| data: | ||
| title: "Live update" | ||
| message: "This will show on the always-on display" | ||
|
inukiwi marked this conversation as resolved.
Outdated
|
||
| data: | ||
| progress: 50 | ||
| progress_segments: | ||
| - length: 80 | ||
| - length: 20 | ||
| color: "#ff0000" | ||
| progress_points: | ||
| - position: 80 | ||
|
inukiwi marked this conversation as resolved.
|
||
| progress_start_icon: mdi:battery-10 | ||
| progress_end_icon: mdi:battery | ||
| progress_tracker_icon: mdi:lightning-bolt | ||
| progress_tracker_color: "#ffde03" | ||
| tag: progress_style_notification | ||
| ``` | ||
|
|
||
| This example will create a notification like the one shown here: | ||
|  | ||
|
|
||
| ### Live Updates | ||
|
|
||
| On Android 16.0+ you can create "Live updates" notifications. These notifications are pinned to the top of the notification shade and appear on the lockscreen and always-on display. They will also display as a chip in the status bar with an optional short text. This might vary by manufacturer. | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.