But why don't they support variables? I suspect there is a good reason for that, but still i'm curious
Widget Variables?
Moderator: Martin
- digitalstone
- Posts: 342
- Joined: 21 Oct 2017 12:36
- Location: The Netherlands
Widget Variables?
Say, i'm busy with setting up some widgets.
But why don't they support variables? I suspect there is a good reason for that, but still i'm curious
But why don't they support variables? I suspect there is a good reason for that, but still i'm curious
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)
Re: Widget Variables?
Which part that doesn't support variable? You can use curly braces to put the variable to some fields. Example for text, you can put {global_text}, and it will dynamically replaced by the content of variable global_text.
Check my index, flow sharing - windows recognizer for example.
To modify other fields which maybe don't support variable, you can modify them in script, using setWidgetElementProperty(). There are a lot of things you can modify, and you can pass variable to it too. After finish modifying, you can force refresh the widget to get the result immediately.
Check my index, flow sharing - windows recognizer for example.
To modify other fields which maybe don't support variable, you can modify them in script, using setWidgetElementProperty(). There are a lot of things you can modify, and you can pass variable to it too. After finish modifying, you can force refresh the widget to get the result immediately.
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.
- digitalstone
- Posts: 342
- Joined: 21 Oct 2017 12:36
- Location: The Netherlands
Re: Widget Variables?
in this screenshot it shows that i can't, for example, set the textsize through a variable since it only accepts numeric values.
Width and height of the widget itself as well.
That was what i meant with my original post.
But to answer your post... you're absolutely right.
I just didn't know.
Automagic is just awesome.
Width and height of the widget itself as well.
That was what i meant with my original post.
But to answer your post... you're absolutely right.
I just didn't know.
Automagic is just awesome.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)
Re: Widget Variables?
That's what I'm missing at the moment. I have an overlay widget that should fill the whole screen width. Yet, I can only set it to a fixed size, e.g. 1080px. When I now show it on another of my devices where the screen width is 1280, it only displays with 1080px width. And I can't make it stretch because all calculations are based on the actual pixel width.digitalstone wrote:Width and height of the widget itself as well.
BlackBerry KEY2, Android 8.1.0
- digitalstone
- Posts: 342
- Joined: 21 Oct 2017 12:36
- Location: The Netherlands
Re: Widget Variables?
The only solution i can think of (with only hardcoding height and width) is to make the widget something like 5000px squared.... BUT...mbirth wrote:That's what I'm missing at the moment. I have an overlay widget that should fill the whole screen width. Yet, I can only set it to a fixed size, e.g. 1080px. When I now show it on another of my devices where the screen width is 1280, it only displays with 1080px width. And I can't make it stretch because all calculations are based on the actual pixel width.digitalstone wrote:Width and height of the widget itself as well.
Interesting problem:
I can't get the widget to accept a number larger than 1920, on the height OR width setting.
Meaning Automagic knows my screen dimensions and limiting the widget size potential based off of that.
Either Automagic has a build-in mechanism to prevent system override from the Android-side of things.
Either way, i don't know, but this widget width/height solution doesn't feel 'clean-coded'.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)
Re: Widget Variables?
I just realize the maximum widget size is limited to the longest resolution of our phone. I can't set beyond 1920x1920 for Full HD phone. This should be considedered as bug/limitation. As it is possible to design our widget on 800x480 phone, but want to use it in 2560x1440 phone. The action show widget even can be set to higher resolution than our phone, try 20000x20000. So the widget itself should be able to be created higher than that too. If there is size limitation because of hardware limitation, just increase the limit to 4K. (to cover all possible common resolution nowadays).
Using script also cannot change the widget real size, as it deals only with the elements inside.
The other things is the display resolution probably should be automagically retrieved by automagic itself. Maybe we can have new function as getDisplayResolutionWidth() and getDisplayResolutionHeight(). Later, we can put it at the show widget resolution after scaling it to certain number.
Using script also cannot change the widget real size, as it deals only with the elements inside.
The other things is the display resolution probably should be automagically retrieved by automagic itself. Maybe we can have new function as getDisplayResolutionWidth() and getDisplayResolutionHeight(). Later, we can put it at the show widget resolution after scaling it to certain number.
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 Variables?
Another problem is: if you're creating a huuuuuge widget and then scaling it down to the display size: the contents get scaled as well. I'd need a way to programmatically change the "canvas" size to the real screen width and show the widget 1:1. And update width and element width after the orientation changes.
BlackBerry KEY2, Android 8.1.0
- digitalstone
- Posts: 342
- Joined: 21 Oct 2017 12:36
- Location: The Netherlands
Re: Widget Variables?
I think Desmanto described a solution to this:mbirth wrote: I'd need a way to programmatically change the "canvas" size to the real screen width and show the widget 1:1. And update width and element width after the orientation changes.
As i'm looking in setting up the widget itself, i understand the initial resolution of the widget itself is needed to determine the original resolution to pass to Android.Desmanto wrote: The other things is the display resolution probably should be automagically retrieved by automagic itself. Maybe we can have new function as getDisplayResolutionWidth() and getDisplayResolutionHeight(). Later, we can put it at the show widget resolution after scaling it to certain number.
Perhaps, i'm not sure, to be handled as a bitmap underneath it all.
Because i'm seeing this also happening in another application (Battery Widget).
It uses "widget size and location", equivalent to post-setting the widget resolution in Automagic with the "Show Custom Widget Overlay" element.
But it also uses an "Widget resolution" option, which can be set to 'Auto'... which is the equivalent of the 'hardcoded' resolution in Automagic, of which the 'Auto' feature implies that the native display resolution can be read no problem since i'm using that app for about 5 years i believe.
I think that Desmanto's idea of "getDisplayResolutionWidth() and getDisplayResolutionHeight()" is very possible.
And also very useful.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)
Re: Widget Variables?
It's already possible - I use the Java code from this comment: viewtopic.php?p=19193#p19193digitalstone wrote:I think that Desmanto's idea of "getDisplayResolutionWidth() and getDisplayResolutionHeight()" is very possible.
And also very useful.
I just can't set the widget's canvas size programmatically. I have to manually edit the widget and change the number (as it's a numeric field, no variables allowed).
And when setting the widget to a fixed size, e.g. 800x4, showing it full-width on a screen with more pixels (e.g. 1600px), scales it - including the height of the bar. My initially 4px thick bar is suddenly 8px thick. I don't want that.
BlackBerry KEY2, Android 8.1.0
- digitalstone
- Posts: 342
- Joined: 21 Oct 2017 12:36
- Location: The Netherlands
Re: Widget Variables?
Well, you're right.mbirth wrote:It's already possible - I use the Java code from this comment: viewtopic.php?p=19193#p19193digitalstone wrote:I think that Desmanto's idea of "getDisplayResolutionWidth() and getDisplayResolutionHeight()" is very possible.
And also very useful.
I just can't set the widget's canvas size programmatically. I have to manually edit the widget and change the number (as it's a numeric field, no variables allowed).
And when setting the widget to a fixed size, e.g. 800x4, showing it full-width on a screen with more pixels (e.g. 1600px), scales it - including the height of the bar. My initially 4px thick bar is suddenly 8px thick. I don't want that.
Enlarging the widget in a post-manner will only scale it with x-amount of procent instead of initializing a new base resolution (or canvas), which will make the internal widget settings, like outline thickness etc, kind of clumsy
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)