Auto glob variable rename

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

Moderator: Martin

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

Auto glob variable rename

Post by digitalstone » 28 Dec 2017 09:55

More often than i like to admit, i must rename the global variable to something else to maintain a certain naming system.

Is there a possibility to build a feature that automatically replaces all global variable references when renaming the reffered global variable?
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

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

Re: Auto glob variable rename

Post by Desmanto » 28 Dec 2017 15:47

+1 for this, even though not so critical for me. As I mostly use glovar map/list to deal with the stored variables.

This renaming should works like widget auto renaming. And it must can travel thru the glovar map/list too.
So if I use global_list[1] in certain script; then I rename to "global_listed"; the new script should be global_listed[1].
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: Auto glob variable rename

Post by digitalstone » 28 Dec 2017 23:15

Desmanto wrote:+1 for this, even though not so critical for me. As I mostly use glovar map/list to deal with the stored variables.

This renaming should works like widget auto renaming. And it must can travel thru the glovar map/list too.
So if I use global_list[1] in certain script; then I rename to "global_listed"; the new script should be global_listed[1].
Yes maybe i should make use of maps and lists more than for just the obvious reasons.
Although maps and lists can get cluttered as well since you can't rearrange the order (that i know of).

Btw what do you mean with auto widget renaming?
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

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

Re: Auto glob variable rename

Post by Desmanto » 29 Dec 2017 02:28

List can be rearranged, simply tap and hold, then drag it up or down. But it can be difficult if the list contains a massive data, the row height cover the whole dialog, make it impossible to drag. For map, it can't be dragged as list do. I also want to request for the feature. But somehow when answering anuraag's question, I have made the flow to sort the glovar by querying the key as list, sort the list in debug dialog. So I put it aside first.

Widget auto renaming is what happen when you rename one of your widget. All show/hide widget action will be updated to correspond to the new name. You can try it out, just rename to something and rename back to original. I just realize something is off with the auto renaming. Although all show/hide widget got renamed, but if there are script which contain reference to modify the widget property, the name stays.

Example "Widget1". There are action show widget Widget1; and script

Code: Select all

setWidgetElementProperty("Widget1", "Rectangle_1", "visible", true);
When we rename "Widget1" to "Battery Widget", action Show/hide will be updated to new name. But the script still stays as "Widget1". So, we should change it manually by using the search and replace them all manually. Seems the same thing will happen with glovar, thus auto renaming not yet implemented till now.
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: Auto glob variable rename

Post by digitalstone » 31 Dec 2017 19:37

Desmanto wrote:List can be rearranged, simply tap and hold, then drag it up or down. But it can be difficult if the list contains a massive data, the row height cover the whole dialog, make it impossible to drag. For map, it can't be dragged as list do. I also want to request for the feature. But somehow when answering anuraag's question, I have made the flow to sort the glovar by querying the key as list, sort the list in debug dialog. So I put it aside first.

Widget auto renaming is what happen when you rename one of your widget. All show/hide widget action will be updated to correspond to the new name. You can try it out, just rename to something and rename back to original. I just realize something is off with the auto renaming. Although all show/hide widget got renamed, but if there are script which contain reference to modify the widget property, the name stays.

Example "Widget1". There are action show widget Widget1; and script

Code: Select all

setWidgetElementProperty("Widget1", "Rectangle_1", "visible", true);
When we rename "Widget1" to "Battery Widget", action Show/hide will be updated to new name. But the script still stays as "Widget1". So, we should change it manually by using the search and replace them all manually. Seems the same thing will happen with glovar, thus auto renaming not yet implemented till now.
Rearranging confirmed!
Auto widget renaming as well :D
Thanks again!
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

User avatar
TheBrain1984
Posts: 137
Joined: 07 Aug 2013 08:17
Location: Germany

Re: Auto glob variable rename

Post by TheBrain1984 » 12 Jan 2018 22:50

+1

xdauser
Posts: 35
Joined: 05 Aug 2015 17:55

Re: Auto glob variable rename

Post by xdauser » 14 Jan 2018 15:02

+1 definitely "must-have" feature. It is really pain in the ass to rename one by one global variables specially if you have them a lot.

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

Re: Auto glob variable rename

Post by digitalstone » 04 Mar 2018 04:11

That's 1 way of putting it :lol:
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

Locked