Web Shortcuts for all devices without installing other apps 😊

Web Shortcuts for all devices without installing other apps 😊

Script is in the first post after copying it open the script editor application and paste the script slide out the script editor drawer and tick the lightning menu checkbox so it appears under the scripts menu as shown in the video.

]]>

9 Commentsto Web Shortcuts for all devices without installing other apps 😊

  1. Anonymous says:

    < ![CDATA[

    /*


    * Web Shortcuts


    * Create shortcuts to your favourite websites


    */



    LL.bindClass(“android.widget.LinearLayout”);


    LL.bindClass(“android.widget.EditText”);


    LL.bindClass(“android.app.AlertDialog”);


    LL.bindClass(“android.content.DialogInterface”);


    LL.bindClass(“android.content.Intent”);



    var mctx = LL.getContext();



    var ll = new LinearLayout(mctx);


    with(ll){


    setOrientation(LinearLayout.VERTICAL);


    setBackgroundColor(0xffff);


    setLayoutParams(new LinearLayout.LayoutParams(200, 100));


    }



    var title = new EditText(mctx);


    with(title){


    setHint(“Title”);


    setLayoutParams(new LinearLayout.LayoutParams(-1, -1));


    }



    ll.addView(title);



    var url = new EditText(mctx);


    with(url){


    setHint(“Url”);


    setText(getClip());


    setLayoutParams(new LinearLayout.LayoutParams(-1, -2));


    }



    ll.addView(url);



    adb = new AlertDialog.Builder(mctx);


    adb.setTitle(“Configure Web Shortcut”);


    adb.setCancelable(false);


    adb.setView(ll);


    adb.setPositiveButton(“Create”, new DialogInterface.OnClickListener(){



    onClick:function(dialog, id){


    if(title.length() >= 3 && url.length() >= 3){


    try{


    var i = new Intent(Intent.ACTION_VIEW);


    i.setData(Uri.parse(url.getText().toString().trim()));


    var d = LL.getCurrentDesktop();


    d.addShortcut(title.getText().toString().trim(), i, 500, 800);


    var item = d.getItemByName(title.getText().toString().trim());


    item.setDefaultIcon(Image.createTextIcon(“n”, 250, 0xff000000, 0xffffffff, null));


    Android.makeNewToast(“Shortcut was created”, false).show();


    //LL.startActivity(i);


    }catch(anfe){


    Android.makeNewToast(“” + anfe, true).show();


    }



    }



    }



    });



    adb.setNegativeButton(“Cancel”, new DialogInterface.OnClickListener(){



    onClick:function(dialog, id){


    dialog.dismiss();


    }



    });



    var alert = adb.create();


    alert.show();



    function getClip(){


    var manager = mctx.getSystemService(Context.CLIPBOARD_SERVICE);


    var clip = manager.getPrimaryClip();


    if(clip != null){


    var text = clip.getItemAt(0).getText();


    return text;


    }



    return;


    }

    ]]>

  2. Anonymous says:

    < ![CDATA[

    SWEET!



    Even my-non-scripting-self can figure out how to work this!



    No idea HOW it works, mind you, but I can operate it, like the average soccer mom operates a minivan. πŸ˜‚



    Is it possible to use a similar (dialog box) interface to set a web shortcut for long touch or for a swipe action, on an existing desktop item?



    This is great!

    ]]>

  3. Anonymous says:

    < ![CDATA[

    Haha 😁 yeah i made it as user friendly as i could i think thats possible but you would probably need to give the existing item an id or label something i can reference it by in the script. Will check the API later and have a go at writing something.

    ]]>

  4. Anonymous says:

    < ![CDATA[

    Multiling o

    ]]>

  5. Anonymous says:

    < ![CDATA[

    Well this^ aint coming soon i was experimenting with a video player widget again and managed to break the launcher. My setups super lazy/crappy so i just uninstalled/installed for a quick fix and as usual forgot to back up my scripts 😭

    ]]>

  6. Anonymous says:

    < ![CDATA[

    That’s rough.

    ]]>

  7. Anonymous says:

    < ![CDATA[

    yup but i suppose it teaches me not to have a crappy setup lol but this is about the 4th time ive did this now so im not learning my lesson. Its not all bad though i still have my assistant script on my TV.

    ]]>

  8. Anonymous says:

    < ![CDATA[

    Looks like a few people have found this script useful so i’ve updated it to be a little nicer. Now you can just copy the website url to clipboard and the url field will be filled in automatically. The default icon was kinda wank so i’ve replaced it with something sexy πŸ˜‰ enjoy

    ]]>

Leave a Reply

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