More graphical elements in custom widgets
Moderator: Martin
More graphical elements in custom widgets
It would be great if we can have more graphical elements in custom widgets, like polygons, polylines, spline curves, points, grids, etc.
Currently we are limited to rectangles and ellipses.
Currently we are limited to rectangles and ellipses.
Re: More graphical elements in custom widgets
As workaround you can use image element and create picture with any shape you want.
Re: More graphical elements in custom widgets
Yanoosh, thank you for the suggestion, but it won't work in many cases where you have dynamic data that changes unpredictably over time. For example, I would like to implement a weather widget similar to AIX Weather, with a 24h temperature graph. I tried to use rectangles to draw graph's grid, but the scale changes in time and the logic to redraw the grid becomes really ugly.
Re: More graphical elements in custom widgets
Would be nice to have ability to set opacity to images as well...
- TheBrain1984
- Posts: 137
- Joined: 07 Aug 2013 08:17
- Location: Germany
Re: More graphical elements in custom widgets
A good start would be to add a triangle. With a triangle (and the possibiltiy to make just one or two lines visible) it would be possible to create any polygon and grids and lot more
Re: More graphical elements in custom widgets
Using triangle as a 2D primitive to build polygons, grids, etc. does not make it any simpler or cleaner than using rectangles. Your suggestion is fine if you intend to build complicated geometry that is static, but if your resulting shape has to change in size/position/form based on variables, then you will have a very hard time coding the transformations required for each of the triangles that make up your resulting shape.
What I would suggest is something similar to the way AutoCAD draws 2D primitives. I understand that Automagic is not a CAD software, but I think AutoCAD can be used as source of inspiration.
I am not an Android developer by any means, but I can see that Android SDK offers 2D graphics capabilities: https://developer.android.com/guide/top ... #drawables, so I'm assuming that 2D primitives can theoretically be possible in Automagic.
For starters, the basic primitives that could be implemented might be similar to these:
ELLIPSE (https://knowledge.autodesk.com/support/ ... 3-htm.html)
POLYLINE (https://knowledge.autodesk.com/support/ ... 4-htm.html)
GRID could be implemented for example by specifying the number of horizontal/vertical lines along with the distances between them. Drawing a grid with polylines would be possible, but again, you end up with many lines to adjust in the case of a dynamic grid.
An ellipse object can be made to draw ellipses, circles or arcs of ellipses/circles. A polyline object can be used to draw any other polygonal shape. If variables can be passed to the input parameters defining these objects, then you end up with dynamic 2D geometry with very little code.
What I would suggest is something similar to the way AutoCAD draws 2D primitives. I understand that Automagic is not a CAD software, but I think AutoCAD can be used as source of inspiration.
I am not an Android developer by any means, but I can see that Android SDK offers 2D graphics capabilities: https://developer.android.com/guide/top ... #drawables, so I'm assuming that 2D primitives can theoretically be possible in Automagic.
For starters, the basic primitives that could be implemented might be similar to these:
ELLIPSE (https://knowledge.autodesk.com/support/ ... 3-htm.html)
POLYLINE (https://knowledge.autodesk.com/support/ ... 4-htm.html)
GRID could be implemented for example by specifying the number of horizontal/vertical lines along with the distances between them. Drawing a grid with polylines would be possible, but again, you end up with many lines to adjust in the case of a dynamic grid.
An ellipse object can be made to draw ellipses, circles or arcs of ellipses/circles. A polyline object can be used to draw any other polygonal shape. If variables can be passed to the input parameters defining these objects, then you end up with dynamic 2D geometry with very little code.
- digitalstone
- Posts: 342
- Joined: 21 Oct 2017 12:36
- Location: The Netherlands
Re: More graphical elements in custom widgets
What about folder-structured boolean subtraction?
You could have 2 rectangles, add a boolean function on them, they'll end up in a folder... to form an L-shape/corner.
You could have 2 rectangles, add a boolean function on them, they'll end up in a folder... to form an L-shape/corner.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)
Re: More graphical elements in custom widgets
I would be happy enough if 2D primitives in Android SDK are exposed to Automagic scripting. What you suggest might be a nice operator on 2D primitives, but I think it would be very difficult to implement with other primitives like ellipse or arc.digitalstone wrote:What about folder-structured boolean subtraction?
You could have 2 rectangles, add a boolean function on them, they'll end up in a folder... to form an L-shape/corner.
As a user, I don't care much about how it's implemented, as long as I have more options to draw in a widget
Re: More graphical elements in custom widgets
Having more element choices would be nice. I have to struggled to create a graph for my next flow. But It is very nice to know that we can do it already using currently what Automagic has. I created graph from the rectangles.
If we can have "Graph" element, which feed on input with list type, I don't need to loop for those 400 loops anymore, which will make the execution faster. The graph can be adjusted with how many elements it has (in my case it is 100), so the input must be 100 elements too (or autofill blank elements to 100). There will be max and min value and the length of the x y axis to plot the graph.
This is not critical, because I only find one or two usage from this kind of widget.
This is a widget consist of 4 graphs, to show 4 signal properties from my wifi modem. I am going to use it to check the best position for the modem, to get the maximum achievable speed. It consists of 4 x 100 loops to update the whole data and several texts there. The widget itself is about 800 Kb!!! Consists of 400+ elements (while my total flows.xml only just above 1 MB). The graphs shown above still use dummy data I generated from random number, thus still sporadic (not smooth). Single loop execution require about 600-800 ms to finish, and I use a sleep about 200-400 ms to make it update per second.If we can have "Graph" element, which feed on input with list type, I don't need to loop for those 400 loops anymore, which will make the execution faster. The graph can be adjusted with how many elements it has (in my case it is 100), so the input must be 100 elements too (or autofill blank elements to 100). There will be max and min value and the length of the x y axis to plot the graph.
This is not critical, because I only find one or two usage from this kind of widget.
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: More graphical elements in custom widgets
I have similar plans for these kind of graphs, yet i'm not starting on that kind of widget building since i can already see the unbelievable amount of clutter hanging about.Desmanto wrote:Having more element choices would be nice. I have to struggled to create a graph for my next flow. But It is very nice to know that we can do it already using currently what Automagic has. I created graph from the rectangles.This is a widget consist of 4 graphs, to show 4 signal properties from my wifi modem. I am going to use it to check the best position for the modem, to get the maximum achievable speed. It consists of 4 x 100 loops to update the whole data and several texts there. The widget itself is about 800 Kb!!! Consists of 400+ elements (while my total flows.xml only just above 1 MB). The graphs shown above still use dummy data I generated from random number, thus still sporadic (not smooth). Single loop execution require about 600-800 ms to finish, and I use a sleep about 200-400 ms to make it update per second.
If we can have "Graph" element, which feed on input with list type, I don't need to loop for those 400 loops anymore, which will make the execution faster. The graph can be adjusted with how many elements it has (in my case it is 100), so the input must be 100 elements too (or autofill blank elements to 100). There will be max and min value and the length of the x y axis to plot the graph.
This is not critical, because I only find one or two usage from this kind of widget.
Rectangles (shapes in general) can't be dynamically created, and i think there is something "unclean" about that.
About the boolean thing: I think a single boolean function could, for now potentially, exponentially increase the amount of possibilities of shapes you can create.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)