multy window from Lua

92 views Asked by At
public static ActivityOptions getActivityOptions(Context context) {
    ActivityOptions options = ActivityOptions.makeBasic();
    int freeform_stackId = 5;
    try {
        Method method = ActivityOptions.class.getMethod("setLaunchWindowingMode", int.class);
        method.invoke(options, freeform_stackId);
    } catch (Exception e) { /* Gracefully fail */
        }

    return options;
}

How to implement this code in LuaJava??

This is the code I'm trying to implement::

    pm = activity:getPackageManager()

    Intent = pm:getLaunchIntentForPackage("com.google.android.apps.maps")

    Intent:addFlags(bit32.bor(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT, Intent.FLAG_ACTIVITY_NEW_TASK, Intent.FLAG_ACTIVITY_MULTIPLE_TASK))

    u = "https://www.google.com/maps/dir/?api=1&travelmode=driving&origin=50.291793,30.355700&destination=50.400024,30.623489"
    Uri = luajava.bindClass("android.net.Uri")

    Intent:setAction(Intent.ACTION_VIEW)
    Intent:setData(Uri:parse(u))

    ActivityOptions = luajava.bindClass("android.app.ActivityOptions")
    options = ActivityOptions:makeBasic()
    freeform_stackId = 5
    method = ActivityOptions.class.getMethod("setLaunchWindowingMode", 366712642) --int.class)
    method:invoke(options, freeform_stackId)

    --bundle = {left=50, right=50, top=200, bottom=200}
bundle = luajava.newInstance("android.graphics.Rect",50,50,200,200)
    mOptions = Options:setLaunchBounds(bundle)

    startActivity(Intent, mOptions.toBundle())

This is an example of Lua code that should display the google map in a window with a given size. The problem is in this fragment(I guess):

Method method = ActivityOptions.class.getMethod("setLaunchWindowingMode", int.class);

How to implement it? I generally had a question: Does this tool work without manual intervention...programmatically???

0

There are 0 answers