As I said earlier I am extra cautious of my mobile resources (power, ram and processing, etc…).

As I said earlier I am extra cautious of my mobile resources (power, ram and processing, etc…).

My question: Is “Resumed” event friendly for me. Is it directly effected with the number of items i.e. if I use the event “Resumed” in 5 – 10 items in the home screen.

]]>

3 Commentsto As I said earlier I am extra cautious of my mobile resources (power, ram and processing, etc…).

  1. Anonymous says:

    < ![CDATA[

    I would say that it merely depends on what is done in the resume event script… But calling 5 times or 20 times the same short script should not make a big difference. The script engine is interpreted but runs reasonably fast. Also scripts are preprocessed once: running the same script many times doesn’t bring a big penalty when compared to running the same script once.

    ]]>

  2. Anonymous says:

    < ![CDATA[

    Pierre Hébert So, in conclusion we can say it is safe even if am running different 10 short scripts at the same time.



    How can you measure a script if it is big or small. What about below:



    var e=LL.getEvent();



    var c=LL.getCurrentDesktop();


    var pnl = c.getItemByName(‘pnlPersonal’).getContainer();



    //remove existing


    var items = pnl.getItems().length + 1;


    for (i = 1; i < items; i++) {


    var remitem = pnl.getItemByName(“Item”+i);


    pnl.removeItem(remitem); }



    var items = e.getData();


    var itemsarr = items.split(“~”);


    var totitems = itemsarr.length;




    //Shortcut class assignment


    var i = new Intent(Intent.ACTION_VIEW);


    if (itemsarr[0] == “LLTasks”) {


        i.setClassName(“com.ninefolders.hd3”, “com.ninefolders.hd3.activity.TodoActivity”);


    } else if (itemsarr[0] == “LLEmails”) {


        i.setClassName(“com.ninefolders.hd3”, “com.ninefolders.hd3.activity.MailActivityEmail”);


    } else {    i.setClassName(“com.google.android.calendar”, “com.android.calendar.LaunchActivity”);


    }




    //Items creation and format


    if ((itemsarr[0] == “LLCalendar” && itemsarr[1]!= “No Upcoming Events”)) {



    for (m = 1; m < totitems; m++) {



    var event = itemsarr[m];


    var eventarr = event.split(“|”);



    if (eventarr[4] == 0) { var apptime = eventarr[2]+”-“+eventarr[3] } else {apptime =”Full Day”}



    var vpos = pnl.getItems().length;


    var newitem = pnl.addShortcut(eventarr[1]+” “+eventarr[6]+”\t\t\t\t\t\t\t\t”+eventarr[0]+”\n”+apptime+”\t\t\t\t\t\t”+eventarr[5],i,0,0);


    newitem.setName(“Item” + m);


    newitem.setPosition(0, vpos);



    newitem.getProperties().edit()


    .setBoolean(“s.iconVisibility”, false)


    .setBoolean(“s.labelShadow”, false)


    .setInteger(“s.labelFontColor”, 0xff000000)



    .setInteger(“s.labelMaxLines”, 2)


    .setString(“s.labelFontStyle”, “BOLD”)


    .commit();


    var editor = newitem.getProperties().edit();


    var box = editor.getBox(“i.box”);


    box.setAlignment(“LEFT”,”MIDDLE”);


    box.setSize(“bb”, 1)


    editor.commit();



    }



    } else if ((itemsarr[0] == “LLTasks” && itemsarr[1]!= “No Pending Tasks”)) {



    for (m = 1; m < totitems; m++) {



    var task = itemsarr[m];


    var taskarr = task.split(“|”);


    var vpos = pnl.getItems().length;



    var newitem = pnl.addShortcut(taskarr[1]+” \t”+taskarr[0],i,0,0);



    newitem.setName(“Item” + m);


    newitem.setPosition(0, vpos);



    if (taskarr[2] == 1) { var fc = 0xff8d0505 } else { fc = 0xff000000}



    newitem.getProperties().edit()


    .setBoolean(“s.iconVisibility”, false)


    .setBoolean(“s.labelShadow”, false)


    .setInteger(“s.labelFontColor”, fc)


    .setString(“s.labelFontStyle”, “BOLD”)


    .commit();


    var editor = newitem.getProperties().edit();


    var box = editor.getBox(“i.box”);


    box.setAlignment(“LEFT”,”MIDDLE”);


    editor.commit();



    }



    } else {


    for (m = 1; m < totitems; m++) {


    var vpos = pnl.getItems().length;


    var newitem = pnl.addShortcut(itemsarr[m],i,0,0);


    newitem.setName(“Item” + m);


    newitem.setPosition(0, vpos);



    newitem.getProperties().edit()


    .setBoolean(“s.iconVisibility”, false)


    .setBoolean(“s.labelShadow”, false)


    .setInteger(“s.labelFontColor”, 0xff000000)


    .setString(“s.labelFontStyle”, “BOLD”)


    .commit();


    var editor = newitem.getProperties().edit();


    var box = editor.getBox(“i.box”);


    box.setAlignment(“LEFT”,”MIDDLE”); 


    editor.commit();


    }}



    pnl.setPosition(0, 0, 1, false);



    if (itemsarr[0] == “LLTasks”) {



    if (itemsarr[1] == “No Pending Tasks”) {


    var m = 1;}



        var variable = “varTasksTitle”;


    var varValue = “Tasks (“+(m-1)+”)”;



    } else if (itemsarr[0] == “LLEmails”) {



    if (itemsarr[1] == “No Messages”) {


    var m = 1;}



        var variable = “varEmailTitle”;


    var varValue = “Emails (“+(m-1)+”)”;



    } else {



    if (itemsarr[1] == “No Upcoming Events”) {


    var m = 1;}



    var variable = “varCalendarTitle”;


    var varValue = “Calendar (“+(m-1)+”)”;


    }



    LL.setVariableString(variable, varValue);

    ]]>

  3. Anonymous says:

    < ![CDATA[

    I wouldn’t call this a short script considering that there are loops iterating over an unknown number of items.


    The best is probably to mesure time using for instance new Date().getTime() at the beginning and end of the script.


    If this script is run in the resume event of the desktop, then I assume this shouldn’t be called too frequently. Something under 200ms or 300ms won’t probably be noticeable.

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *