widget
I have created a widget that shows me the date and time In addition, when I click Date, the calendar appears and when I click notes, Google Notes appears.
everything okay until here
I would like to extend or add something new
1. I want to see the status of the ringer volume in the ... Widget example (level 1-20).
2. I want to show the status of WiFi and Bluetooth. Example (ON or OFF)
Is there a solution (variable)?
Is there a kind of variable list or command list?
under text (...) I find only the following variable (date)
widget (status)
Moderator: Martin
widget (status)
country: Germany
language: German
Writing & Read via Google Translate
Samsung S10+ (SM-G975F)
Android 9.0.0
One UI-Version 1.1
* NO ROOT *
*Status Offiziell *
language: German
Writing & Read via Google Translate
Samsung S10+ (SM-G975F)
Android 9.0.0
One UI-Version 1.1
* NO ROOT *
*Status Offiziell *
Re: widget (status)
To trigger based on volume change, use trigger audio volume, on changes. For wifi and bluetooth, use the trigger wifi state and bluetooth state, tick enabled and disabled. You then check the variable provided, and save it to glovar. This glovar can be used in widget and will be updated immediately.
But it is even better, that after the trigger, you simply use setWidget element property to change the visibility of the prepared icon. Example you put icon wifi off and wifi on in the same spot. When trigger wifi state enabled, show wifi on icon and hide the wifi off icon. Vice versa for wifi disabled. Do the same for bluetooth. For audio volume, using the text value is enough.
But it is even better, that after the trigger, you simply use setWidget element property to change the visibility of the prepared icon. Example you put icon wifi off and wifi on in the same spot. When trigger wifi state enabled, show wifi on icon and hide the wifi off icon. Vice versa for wifi disabled. Do the same for bluetooth. For audio volume, using the text value is enough.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Re: widget (status)
can you show me an example? , I do not know exactly where to start.
is the variable (bluetooth_state) as text correct?
is the variable (bluetooth_state) as text correct?
country: Germany
language: German
Writing & Read via Google Translate
Samsung S10+ (SM-G975F)
Android 9.0.0
One UI-Version 1.1
* NO ROOT *
*Status Offiziell *
language: German
Writing & Read via Google Translate
Samsung S10+ (SM-G975F)
Android 9.0.0
One UI-Version 1.1
* NO ROOT *
*Status Offiziell *
Re: widget (status)
Yes, use {bluetooth_state}.
Create a flow
Trigger : Bluetooth State On, Off (tick On and Off)
Action : Script
In your widget, create at text, and put {global_bluetooth_state}. Everytime the bluetooth is switch on/off, the text element's text will change to on/off accordingly. But this require 1 glovar space per state. So for wifi state and audio volume, you need another 2 glovar, which is inefficient.
Better idea is to use setWidget directly.
Trigger : Bluetooth State On, Off (tick On and Off)
Action : Script
Of course, replace "Widget1" with your widget name. "Text_1" with the text element, bluetooth_state with the wifi_state and volume. For wifi state, you might need to map the code 1 to "off" and code 3 to "on". You can also use setWidget to change image (icon) to indicate the on/off. But you need to use if() or map value for easier management.
After all finished, you can also combine all triggers into single flow and use multiple if() to separate the triggers. (you don't have to do this)
Create a flow
Trigger : Bluetooth State On, Off (tick On and Off)
Action : Script
Code: Select all
global_bluetooth_state = bluetooth_state;
Better idea is to use setWidget directly.
Trigger : Bluetooth State On, Off (tick On and Off)
Action : Script
Code: Select all
setWidgetElementProperty("Widget1", "Text_1", "text", bluetooth_state);
After all finished, you can also combine all triggers into single flow and use multiple if() to separate the triggers. (you don't have to do this)
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.