started a roll-clock with clone&move.

started a roll-clock with clone&move.

script in next post

]]>

17 Commentsto started a roll-clock with clone&move.

  1. Anonymous says:

    < ![CDATA[

    /* About the script


    * Purpose : Rolling Clock Widget (swipe for date)


    * Author : Jappie Toutenhoofd (https://plus.google.com/+JappieToutenhoofd)


    * Link : https://plus.google.com/+JappieToutenhoofd/posts/


    */



    var RC_script = LL.getScriptByName(“Roll-Clock”);


    if (RC_script === null) {


    alert(“Also install ‘Roll-Clock’ not just ‘Roll-Clock-create’.”);


    return;


    }


    var Touch = LL.getEvent();


    if (Touch.getItem() !== null) {


    alert(“Run from empty spot. \n Do NOT set ‘item menu’. \n Only set ‘Lightning menu’ in script-editor.”);


    return;


    }


    var Tcont = Touch.getContainer();


    if (Tcont.getId() == 99) {


    alert(“Cool, but messy! Let’s not do this.”);


    return;


    }


    // Create temporary item, just for the settings.


    var tItem = Tcont.addShortcut(“X”, new Intent(), 0, 0);


    var ed = tItem.getProperties().edit();


    var labelsize = 30 // * ed.getFloat(“s.labelFontSize”);


    ed.setFloat(“s.labelFontSize”, labelsize);


    ed.setBoolean(“s.iconVisibility”, false);


    ed.setBoolean(“s.labelVisibility”, true);


    ed.setBoolean(“i.enabled”, false);


    ed.commit();




    var clockbase = Tcont.addPanel(Touch.getTouchX(), Touch.getTouchY(), (3 * Tcont.getCellWidth()), Tcont.getCellHeight());


    var cc = clockbase.getContainer();


    var ce = cc.getProperties().edit();


    ce.setBoolean(“newOnGrid”, true);


    ce.setBoolean(“allowDualPosition”, true);


    ce.setBoolean(“useDesktopSize”, false);


    ce.setString(“scrollingDirection”, “NONE”);


    ce.setString(“gridPColumnMode”, “NUM”); ce.setString(“gridLColumnMode”, “NUM”);


    ce.setString(“gridPRowMode”, “NUM”);ce.setString(“gridLRowMode”, “NUM”);


    ce.setInteger(“gridPColumnNum”, 5); ce.setInteger(“gridLColumnNum”, 5);


    ce.setInteger(“gridPRowNum”, 1); ce.setInteger(“gridLRowNum”, 1);


    ce.commit();


    for (var i = 0; i < = 4; ++i) {


    var dgt = cc.addPanel(0, 0, cc.getCellWidth(), cc.getCellHeight());


    dgt.setCell(i, 0, (i + 1), 1, true);


    dgt.setName(“dgt” + i);


    var de = dgt.getProperties().edit();


    de.getBox(“i.box”).setSize(“bl,br,bt,bb”, 0);


    de.commit();


    var dc = dgt.getContainer();


    var de = dc.getProperties().edit();


    de.setBoolean(“newOnGrid”, true);


    de.setBoolean(“allowDualPosition”, true);


    de.setBoolean(“useDesktopSize”, false);


    de.setString(“scrollingDirection”, “Y”);


    de.setString(“gridPColumnMode”, “NUM”); de.setString(“gridLColumnMode”, “NUM”);


    de.setString(“gridPRowMode”, “NUM”); de.setString(“gridLRowMode”, “NUM”);


    de.setInteger(“gridPColumnNum”, 1); de.setInteger(“gridLColumnNum”, 1);


    de.setInteger(“gridPRowNum”, 1); de.setInteger(“gridLRowNum”, 1);


    de.setBoolean(“i.enabled”, false);


    de.commit();



    if (i == 2) {


    var tItemC = Tcont.cloneItem(tItem);


    var newItem = Tcont.moveItem(tItemC, dc);


    newItem.setCell(0, 0, 1, 1, true);


    newItem.setLabel(“:”);



    var tItemC = Tcont.cloneItem(tItem);


    var newItem = Tcont.moveItem(tItemC, dc);


    newItem.setCell(0, 1, 1, 2, true);


    newItem.setLabel(“/”);



    } else


    for (var j = 0; j < = 9; ++j) {


    var tItemC = Tcont.cloneItem(tItem);


    var newItem = Tcont.moveItem(tItemC, dc);


    newItem.setCell(0, j, 1, (j + 1), true);


    newItem.setLabel(j);


    }


    }


    var click = cc.addShortcut(“click”, new Intent(), 0, 0);


    click.setCell(0, 0, 5, 1, true);


    var pe = click.getProperties().edit();


    pe.setBoolean(“s.iconVisibility” , false);


    pe.setBoolean(“s.labelVisibility”, false);


    pe.setEventHandler(“i.resumed” , EventHandler.RUN_SCRIPT, RC_script.getId());


    pe.setEventHandler(“i.paused” , EventHandler.RUN_SCRIPT, RC_script.getId());


    pe.setEventHandler(“i.tap” , EventHandler.RUN_SCRIPT, RC_script.getId());


    pe.setEventHandler(“i.swipeUp” , EventHandler.RUN_SCRIPT, RC_script.getId());


    pe.setEventHandler(“i.swipeDown”, EventHandler.RUN_SCRIPT, RC_script.getId());


    pe.commit();



    Tcont.removeItem(tItem);


    LL.save();


    // hack: the resumed event is triggered as soon as the item is created, hence before the “i.resumed” event handler is set


    // the following lines will effectively pause and resume the launcher, and start the clock


    var intent = new Intent();


    intent.setClassName(“net.pierrox.lightning_launcher_extreme”, “net.pierrox.lightning_launcher.activities.Dashboard”);


    intent[‘putExtra(java.lang.String,int)’](“p”, LL.getCurrentDesktop().getId());


    LL.startActivity(intent);

    ]]>

  2. Anonymous says:

    < ![CDATA[

    this hack is copied from pierre’s scripted-clock apk.

    ]]>

  3. Anonymous says:

    < ![CDATA[

    Oh.


    But at that time the function in the link wasn’t available if I remember correctly.

    ]]>

  4. Anonymous says:

    < ![CDATA[

    I tried 10 different actions but none trigger the same effect as the ‘hack’. With the ‘hack’ it show the time immediately. with



    LL.runAction(xx);



    it shows 00:00 and only after pause/resume it will tell time.


    I tried


    xx = 0, 1, 13, 25, 26, 36, 40, 41 and even 42

    ]]>

  5. Anonymous says:

    < ![CDATA[

    LL.runAction(EventHandler.RUN_SCRIPT,click,RC_script.getId());

    ]]>

  6. Anonymous says:

    < ![CDATA[

    thanks, i will try. but i think the rc script will fail on event. getItem

    ]]>

  7. Anonymous says:

    < ![CDATA[

    I didn’t tried, but technically that runAction passes the item so that event.getItem() returns it.

    ]]>

  8. Anonymous says:

    < ![CDATA[

    Does not fail. But also does not trigger the immediate showing of the time.

    ]]>

  9. Anonymous says:

    < ![CDATA[

    Maybe because event.getAction() returns “RUN_SCRIPT” and you need to check it with the “I_RESUMED”

    ]]>

  10. Anonymous says:

    < ![CDATA[

    lol, it works with the ‘hack’ 😉


    But why the script is here, is about the property inheritance.


    Any verdict on that?

    ]]>

  11. Anonymous says:

    < ![CDATA[

    Not sure what you mean.


    Does the LL.runAction works and you don’t know why?

    ]]>

  12. Anonymous says:

    < ![CDATA[

    As you said, the ‘hack’ was off topic.


    the picture and script are here, because i expected the bottom rolclock to look like the top row of icons.

    ]]>

  13. Anonymous says:

    < ![CDATA[

    (I forgot ^_^U )


    Better call Pierre Hébert​

    ]]>

  14. Anonymous says:

    < ![CDATA[

    OK, Pierre Hébert in a nut-shell


    I still struggel with the absence of inheritenceof properties in panels. I´ll try to post a video shortly, to express the inconsistency. And I hoped clone followed by move would preserve properties.

    ]]>

  15. Anonymous says:

    < ![CDATA[

    Jappie Toutenhoofd or even a desktop exported in a template, this may be easier for you and me to identify the issue

    ]]>

  16. Anonymous says:

    < ![CDATA[

    Please forget about the template, I just saw you post 😉

    ]]>

Leave a Reply

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