Jays Assistant Widget Thing demo

Jays Assistant Widget Thing demo

Thought id share a quick video of my work so far on a personal Assistant widget theres still a lot to do and the UI isnt final but im happy with how far ive got with it. Check it out let me know what you think 😊

16 Commentsto Jays Assistant Widget Thing demo

  1. Andrew M says:

    Given how much customisation is possible with lightning launcher I’m not sure from the video what the personal assistant widget is doing. Is it possible to provide a short description of what it does? Thanks

  2. Jay M says:

    The idea is for me to be able to quickly run my Tasker tasks and do basic assistant things all from 1 place (the widget) like id say tell me the weather forecast and it would speak the weather to me id say send a text to whoever and it would send a send a text to someone. The web browser part is so i can say things like show me the Note 8 and instead of taking me into another application like chrome or firefox it can instantly loads up the information on the Note 8 inside the widgets browser which keeps me on my homescreen as you see in the video i go to youtube and i can watch a video without ever leaving my homescreen. Its still a work in progress which is why when i type something in the bar at the top all it does is show a Toast with command: and whatever i typed.

    Over the weekend i will be adding voice support to it so i can give the personal assistant side of it a little personality and instead of typing stuff in the command bar il be able to speak to it. In the video the widget slides into view but as shown i can freely move it around it so it can be placed anywhere within my homescreen like in the pic below but with my phone not having a 49″ screen like my TV its awkward to use the browser resized like this so i figured it was best to have the widget fulllscreen but slide into view when i need it. Dont forget this launcher also has a floating desktop azwell so i can also have this accessible from anywhere at all not just the homescreen. I could bring it up when watching TV playing on my xbox etc so as a quick example i can quickly search an actor in a movie im watching or something without picking up my phone or leaving the movie to open a website or run a Tasker task while playing a game.

    https://lh3.googleusercontent.com/ybvfyGndbd7Qk3atKUbrZCcNNwnKgl8-uvVmfGsSA-lPmYAqkOHCU-E9IEn3l3__er1hD4iA8g

  3. Andrew M says:

    Jay M that’s great thanks. I look forward to trying it!

  4. Nice work, looking great already!

    Can I ask you what keyboard app you’re using?

  5. Jay M says:

    cheers its multiling o

    D๑พทℓ๑α∂ Mบℓтïℓïทg👍OKεγв๑αя∂ play.google.com – Multiling O Keyboard + emoji ⇦ԅ(ˆ。ˆԅ) 🆒🆕‌🐌🐚🇴‌🇰‌🇪‌🇾‌🇧‌🇴‌🇦‌🇷‌🇩🐞🐙🆓🆗 #Multiling #OKeyboard #Android

  6. Jay M really nice, thanks, already love it ^^

  7. Jay M says:

    Documentation for it sux though if your building your own layout check here for new keys you can use http://hanwriting.blogspot.co.uk/search/label/change%20log?m=1

  8. Josh Bennett says:

    Is this mainly just a floating desktop? What’d you do to get the browser “widget”?

  9. Jay M says:

    no its not really a widget its a custom view there a feature of the launcher i use. As for the browser i wrote it.

  10. Jay M says:

    just noticed this is the lightning community lol this is also posted in the Tasker community, if your posting here you probably know what a custom view is.

  11. Josh Bennett says:

    So did you build the browser using the scripts on LL?

  12. Josh Bennett says:

    Any chance you’d share the script for the browser? I am a full on idiot when it comes to that part, but having a floating browser always on top would make my life so much easier.

  13. Jay M says:

    yeah sure wont be until about 12 though (uk time) the scripts on my TV and im not at home.

    im no further on with it its exactly what you see in the video bugs and everything.

  14. Jay M says:

    /*****************************************

    * @name: Taylor Android Assistant

    * @desc: A Lightning built Personal Assistant that can run Tasker tasks and do some other stuff

    * @author: Jay M

    * @since: Saturday 19th August 2017 @ 19:48;

    * @permissions: INTERNET, ???????????

    ***********************************************/

    bindClass(“android.widget.LinearLayout“);

    bindClass(“android.widget.ImageView“);

    bindClass(“android.widget.Button“);

    bindClass(“android.widget.ImageButton“);

    bindClass(“android.graphics.Bitmap“);

    bindClass(“android.widget.TextView“);

    bindClass(“android.widget.EditText“);

    bindClass(“android.webkit.WebView“);

    bindClass(“android.webkit.WebViewClient“);

    bindClass(“android.view.Gravity“);

    bindClass(“android.app.AlertDialog.Builder“);

    bindClass(“android.content.DialogInterface“);

    bindClass(“android.widget.ListView“);

    bindClass(“android.R”);

    bindClass(“android.widget.ArrayAdapter“);

    bindClass(“android.widget.AdapterView“);

    bindClass(“java.io.BufferedReader“);

    bindClass(“java.io.FileReader“);

    bindClass(“android.view.View“);

    var mctx = LL.getContext();

    // Colors

    var white = 0xffffffff;

    var orange = 0xffff5722;

    var green = 0xff00ff00;

    var red = 0xffff0000;

    var grey = 0xff161616;

    // Messages

    var title_messages = [“Hey Jay what can i do for you?”, “Taylor”, “Tasker Assistant”];

    // Homepage

    var home = “https://www.google.co.uk“;

    // main container (ROOT)

    var main = new LinearLayout(mctx);

    with(main){

    setOrientation(LinearLayout.VERTICAL);

    setBackgroundColor(red);

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

    }

    var title = new TextView(mctx);

    with(title){

    setText(title_messages[0]);

    setTextSize(18);

    setPadding(0,0,0,15);

    setBackgroundColor(grey);

    setTextColor(white);

    gravity = Gravity.CENTER_HORIZONTAL;

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

    }

    main.addView(title);

    /*********************************************************/

    // Top Container

    var tc = new LinearLayout(mctx);

    with(tc){

    setOrientation(LinearLayout.HORIZONTAL);

    setBackgroundColor(white);

    setPadding(0,0,0,0);

    setWeightSum(1.0);

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

    }

    main.addView(tc);

    var b1 = new ImageButton(mctx);

    with(b1){

    var image = LL.createImage(“/storage/emulated/0/Download/TaylorSwift.jpg“);

    var get = image.getBitmap();

    var bmp = Bitmap.createBitmap(get);

    b1.setScaleType(ImageView.ScaleType.FIT_XY);

    b1.setImageBitmap(bmp);

    setLayoutParams(new LinearLayout.LayoutParams(0, 200, 0.15));

    }

    tc.addView(b1);

    var sb = new EditText(mctx);

    with(sb){

    setHint(“Command/Task”);

    setBackgroundColor(white);

    setTextSize(18);

    gravity = Gravity.LEFT;

    setSingleLine(true);

    setLayoutParams(new LinearLayout.LayoutParams(0, -2, 0.85));

    }

    tc.addView(sb);

    var webview = new WebView(mctx);

    with(webview){

    setWebViewClient(new WebViewClient());

    setBackgroundColor(white);

    setInitialScale(200);

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

    loadUrl(home);

    }

    var settings = webview.getSettings();

    with(settings){

    setJavaScriptEnabled(true);

    setLoadWithOverviewMode(true);

    setUseWideViewPort(true);

    setSupportZoom(true);

    setLoadsImagesAutomatically(true);

    settings = webview.getSettings();

    setJavaScriptEnabled(true);

    setLoadWithOverviewMode(true);

    setUseWideViewPort(true);

    setLoadsImagesAutomatically(true);

    }

    main.addView(webview);

    // Bottom Container

    var bc = new LinearLayout(mctx);

    with(bc){

    setBackgroundColor(grey);

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

    setWeightSum(1.0);

    setOrientation(LinearLayout.HORIZONTAL);

    }

    main.addView(bc);

    var button1 = new Button(mctx);

    with(button1){

    setLayoutParams(new LinearLayout.LayoutParams(0, -2, 0.25));

    setText(“< ");

    }

    var button2 = new Button(mctx);

    with(button2){

    setLayoutParams(new LinearLayout.LayoutParams(0, -2, 0.25));

    setText(“Home”);

    }

    var button3 = new Button(mctx);

    with(button3){

    setLayoutParams(new LinearLayout.LayoutParams(0, -2, 0.25));

    setText(“Refresh”);

    }

    var button4 = new Button(mctx);

    with(button4){

    setLayoutParams(new LinearLayout.LayoutParams(0, -2, 0.25));

    setText(“>”);

    }

    bc.addView(button1);

    bc.addView(button2);

    bc.addView(button3);

    bc.addView(button4);

    var b = new Button(mctx);

    with(b){

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

    setTextColor(white);

    setBackgroundColor(grey);

    setText(“Pick a task to run”);

    }

    main.addView(b);

    b.setOnClickListener(new View.OnClickListener(){

    onClick:function(view){

    showTasks();

    }

    });

    /*

    var tasks = [];

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

    tasks.push(“Example Task ” + (i+1));

    }

    */

    function showTasks(){

    var reader = new BufferedReader(new FileReader(“/storage/emulated/0/MyTasks.txt“));

    var line = “”;

    var myTasks = “”;

    while((line = reader.readLine()) != null){

    myTasks += line;

    //Android.makeNewToast(myTasks, false).show();

    var array = myTasks.split(“,”);

    //Android.makeNewToast(array.length, false).show();

    var i = new TaskerIntent(“dont delete”);

    LL.sendTaskerIntent(i, false);

    }

    var adb = new AlertDialog.Builder(mctx);

    adb.setTitle(“Select a Task”);

    adb.setCancelable(true);

    var lv = new ListView(mctx);

    adb.setView(lv);

    var adapter = new ArrayAdapter(mctx, R.layout.simple_list_item_1, array);

    lv.setAdapter(adapter);

    var alert = null;

    lv.setOnItemClickListener(new AdapterView.OnItemClickListener(){

    onItemClick:function(parent, view, position, id){

    var selectedTask = parent.getItemAtPosition(position);

    var i = new TaskerIntent(selectedTask);

    LL.sendTaskerIntent(i, false);

    Android.makeNewToast(“Running Task: ” + “\n” + selectedTask, false).show();

    alert.dismiss();

    }

    });

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

    onClick:function(dialog, which){

    dialog.dismiss();

    }

    });

    adb.setNeutralButton(“Open Tasker”, new DialogInterface.OnClickListener(){

    onClick:function(dialog, which){

    dialog.dismiss();

    }

    });

    alert = adb.create();

    alert.show();

    }

    var listener = new View.OnClickListener(){

    onClick:function(view){

    switch(view){

    case b1:

    var text = sb.getText().toString().trim();

    Android.makeNewToast(“Command: ” + text, false).show();

    sb.setText(“”);

    break;

    case button1:

    webControl.back();

    break;

    case button2:

    webControl.home();

    break;

    case button3:

    webControl.refresh();

    break;

    case button4:

    webControl.forward();

    break;

    }

    }

    }

    var talk = {

    // Speech

    }

    var webControl = {

    back:function(){

    if(webview.canGoBack){

    webview.goBack();

    }

    },

    home:function(){

    webview.loadUrl(home);

    },

    refresh:function(){

    webview.loadUrl( “javascript:window.location.reload( true )” );

    },

    forward:function(){

    if(webview.canGoForward){

    webview.goForward();

    }

    }

    }

    b1.setOnClickListener(listener);

    button1.setOnClickListener(listener);

    button2.setOnClickListener(listener);

    button3.setOnClickListener(listener);

    button4.setOnClickListener(listener);

    item.setHorizontalGrab(true);

    item.setVerticalGrab(true);

    return main;

  15. Jay M says:

    You need to give the launcher Internet permission install the apk from here http://www.lightninglauncher.com/permissions//

Leave a Reply

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