DS is limited to writing apps on Android to run on Android.
Enjine.io will be very similar and will support Android, iOS, Windows, etc.
(AFAIK I know there is no target date).
A few
enjine.io objects (for controls) with a few methods have been added to the latest versions of DS (Hybrid).
I have previously suggested a tool for converting DS code to
enjine.iowhich would aid in converting DS apps so they could run on Android/iOS etc
Please respond if you think this is worthwhile (or not) , or can foresee other problems.
Here's a list in DS
var data = "Folder:folder,Audio:audio,Photo:photo,Video:video";
lst = app.AddList( layout,data, 0.8, 0.4 );
And a list in Hybrid
var myList = [
[ "favorite", "Javascript", "Some text here" ],
[ "delete", "Python", "Some text here" ],
[ "star", "Java", "Some text here" ]
]
lst = ui.addList(lstLay, myList, "link,icon,dense", 0.45)
Approach 1 -
It would be pretty simple to substitute app.AddList with ui.addList
A little more difficult to re-order the parameter sequence, possibly converting the options (not sure if new Dense is equivalent to old Horiz)
Difficult to modify the list and it could come from a file, website etc.
Approach 2 -
Replace app.AddList with AddList, and use app.Script to bring in functions
which will (at run time) get the parameters in the new order, map the options, and reformat the list. Even the special built in icons could be transformed.
See code below.
It handles the list in string or array form; Simple, Title+Icon, and Title+Body.
(Probably needs validation of incoming list format, or at least a try/catch.)
(Not really happy with using global variable str)
There are loads of DS objects (some may require very simple functions).
Hoping that the methods on the objects are compatible without change.
It could also be extended to MUI objects.
DS uses FontAweSome icons, but (thus far) Hybrid uses MUI icons.
We could either hard-code replacements for the common icons, or use a large JSON file
(pretty massive undertaking, unless someone has already done it).
Regards, ah
Here's some examples
lstMenu0 = AddList(drawerLay, "One,Two")
lstMenu1 = AddList(drawerLay, "Audio:audio,Photo:photo,Video:video,Folder:folder,AudioFolder:audiofolder,PhotoFolder:photofolder,VideoFolder:videofolder,PlayList:playlist",0.4, 0.8)
var data = "The Hobbit:Author - J.R.R. Tolkien:null";
data += ",Watership Down:Author - Richard Adams:null";
lstMenu2 = AddList(drawerLay,data,0.8,0.4,"horiz")
var array = ["Three","Four"]
lstMenu3 = AddList(mainLay,array,0.8,0.4,"horiz")
array = ["5:Five:audio","6:Six:video"]
lstMenu4 = AddList(mainLay,array,0.8,0.4,"horiz")
And the function(s)
function AddList(parent,list,width,height,options,delim) {
if (options != null) options = options.replace(/horiz/i,"dense")
if (delim == "" || delim == null) delim = ","
if (typeof list == "string") {var arr = list.split(delim);} else {var arr = list;}
str = ""
arr.forEach(ds0)
var q = ui.addList(parent,str,options+",icon",width)
return q
}
// convert app list to hybrid list
function ds0(val) {
if (val.endsWith(":audio")) val=val.replace(":audio",":music_note")
if (val.endsWith(":photo")) val=val.replace(":photo",":image")
if (val.endsWith(":video")) val=val.replace(":video",":movie")
if (val.endsWith(":folder")) val=val.replace(":folder",":folder")
if (val.endsWith(":audiofolder")) val=val.replace(":audiofolder",":library_music")
if (val.endsWith(":photofolder")) val=val.replace(":photofolder",":photo_library")
if (val.endsWith(":videofolder")) val=val.replace(":videofolder",":video_library")
if (val.endsWith(":playlist")) val=val.replace(":playlist",":queue_music")
var arr2 = val.split(":")
if (arr2.length == 2) val = val.replace(":","::")
if (str != "") str+= ","
str = str + val
}