More graphical elements in custom widgets

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

User avatar
juvete
Posts: 13
Joined: 29 Mar 2013 22:01

Re: More graphical elements in custom widgets

Post by juvete » 16 Mar 2018 13:53

digitalstone wrote:
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.
graph.png
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.
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.
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.
Wow! Those charts are impressive, Desmanto! My weather widget would have had way less shapes, yet I wasn't so brave to build it :)
Digitalstone, you have a point here, we should also wish for the ability to add shapes to the widget dynamically. I'm still not sure how a boolean method would help. I believe the engine would have to apply that boolean logic every time the widget is rendered/refreshed in order to display the resulting shape. It would be more difficult for the underlying code to determine when the final shape has to change. If the primitives are controlled solely by sets of 2D points and math, it would be much easier to implement and much faster to execute.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: More graphical elements in custom widgets

Post by Desmanto » 16 Mar 2018 15:57

@digitalstone : I thought it will slow down as well, but not so much. I don't build the widget elements all manually, only the first four rectangles only. I use another flowception, use regex to replace and duplicate them for 100 times each

I don't actually understand about the polygon, lines and several cad related. But if we have those rectangles already, we can use the boolean visibility to set it true or false. But yeah, we still have to created them first. I am still thinking to improve my flowception, so It can detect available elements and pick up which one to duplicate. But for now, it is good. I only need it for this signal flow only.


@juvete : I just thought of this 3 days ago and I even stray away from my other flow just to finish it. Learning regex in the beginning of using Automagic, really helps me to do something like 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.

User avatar
digitalstone
Posts: 342
Joined: 21 Oct 2017 12:36
Location: The Netherlands

Re: More graphical elements in custom widgets

Post by digitalstone » 17 Mar 2018 15:23

I'm not saying the boolean (or whatever other function) drawing should be re-calculated at every loop/iteration. I think it would be wise to just use such a function to draw in design-time only, and once ready, tell automagic the shape is finished. Then Automagic knows what to draw, based on the multi-shape function, and just draws it's points/lines and polys as a single shape.

Maybe after that there could be a reason to *not* check that "finished box" so you can alter one of the sub-shapes to animate/morph it into another version of that shape.


Just to be sure to show what just 2 shapes can create (that are already inside automagic):
https://goo.gl/images/wsyX1j
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

Locked