注册时间
最后登录
新帖
发布在 技术交流 阅读更多

把ui写在网页里。然后用一个webView显示你的网页ui。然后随时注入js代码修改网页界面

发布在 技术交流 阅读更多

importClass(android.os.Build);
window = floaty.rawWindow(
<frame bg="#00000000" id="frame" h="*">
<text id="action1" text="拖动|最小化" gravity="center" textColor="#ffffffff" bg="#66000000" />
<text id="action2" text="关闭" gravity="center" textColor="#ffffffff" bg="#66000000" />
<text id="action4" text="切换" gravity="center" textColor="#ffffffff" bg="#66000000" />
<text id="action5" text="网页路径" gravity="center" textColor="#ffffffff" bg="#66000000" />
<text id="action6" text="嗅探资源" gravity="center" textColor="#ffffffff" bg="#66000000" />
<text id="action7" text="输入网址" gravity="center" textColor="#ffffffff" bg="#66000000" />

    <input id="action3" text="..." gravity="left|top" textColor="#ff000000" bg="#ffeeffff" textSize="10sp"/>
    <webview id="webView" textSize="16sp" />
</frame>);

function rip(str, str) {
ui.run(function() {
window.disableFocus();
});
window.setPosition(2000, 2000);

kjsr = dialogs.rawInput(str, str);

window.setPosition(0, 0);
ui.run(function() {
    window.requestFocus();
});
log(kjsr);
if (kjsr == null) {
    return arr;
} else {
    return kjsr;
}

}
zrjspic = `
 
// 选择所有的<a>标签
var linkspenglishan = document.querySelectorAll('img');

// 遍历链接并打印href属性
linkspenglishan.forEach(function(linkspenglishan) {
console.log(linkspenglishan.src);
});
 
; zrjsvideo =
 
 
// 选择所有的 <video> 元素
var videos = document.querySelectorAll('video');

// 遍历所有视频元素并打印它们的 src 属性
videos.forEach(function(video) {
// 获取视频的 src 属性
var src = video.src;

// 如果 video 元素使用了 source 子元素定义视频源
var sources = video.querySelectorAll('source');
sources.forEach(function(source) {
console.log(source.src); // 打印 source 元素的 src 属性
});

// 如果 video 元素直接定义了 src 属性
if (src) {
console.log(src);
}
});
 
 
; zrjssy =
 
// 使用var代替const
var resources = window.performance.getEntriesByType('resource');

// 遍历资源并打印相关信息
for (var i = 0; i < resources.length; i++) {
var resource = resources[i];
var type = resource.initiatorType; // 获取资源类型
var url = resource.name; // 获取资源URL
console.log('Resource Type: ' + type + ', URL: ' + url);
}
 
`;

window.action7.on("touch_down", function() { 
threads.start(function() {
xwz=rip("输入网址", "http://");
ui.run(function() {
window.webView.loadUrl(xwz);
});
});
});

window.action6.on("touch_down", function() { 
threads.start(function() {
ui.run(function() {
window.action3.text("");
nr = zrjssy;
window.webView.evaluateJavascript("javascript:" + nr, null);
mog("注入javascript:\n<script>\n" + nr + "\n</script>"); 
});

});

});

ui.run(function() {
view = window.webView;
var MyWebChromeClient = JavaAdapter(android.webkit.WebChromeClient, {
onConsoleMessage: function(message) {
tmp = message.message();
if (!tmp.includes("base64")) {
mog("" + tmp);
}
}
});
view.setWebChromeClient(MyWebChromeClient);
webSettings = view.getSettings();
webSettings.setJavaScriptEnabled(true); 
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
webSettings.setMixedContentMode(webSettings.MIXED_CONTENT_ALWAYS_ALLOW);

window.requestFocus();
view.setBackgroundColor(colors.parseColor("#11000000"));
view.loadUrl("https://i.meituan.com/mttouch/page/home");
});

function mog(str) {
builder = new android.text.SpannableStringBuilder();
currentText = window.action3.getText();
builder.append(str + "\n").append(currentText);
ui.run(function() {
window.action3.text(builder);
});

}

function onClick() {
if (zkkz == 0) {
zkkz = 1;
zhankaiaction();
window.setPosition(0, 0);
window.requestFocus();

} else {
    zkkz = 0;
    zhedieaction();
    window.disableFocus();
    window.setPosition(window.getX(), window.getY());
}

}
window.action1.setOnTouchListener(function(view, event) {
switch (event.getAction()) {
case event.ACTION_DOWN:
x = event.getRawX();
y = event.getRawY();
windowX = window.getX();
windowY = window.getY();
return true;
case event.ACTION_MOVE:
//移动手指时调整悬浮窗位置
dx = (event.getRawX() - x);
dy = (event.getRawY() - y);
window.setPosition(windowX + dx, windowY + dy);
return true;
case event.ACTION_UP:
//手指弹起时如果偏移很小则判断为点击
if (Math.abs(event.getRawY() - y) < 5 && Math.abs(event.getRawX() - x) < 5) {
onClick();
}
return true;
}
return true;
});

function dbfo(k, x, y, w, h) {
ui.run(function() {
eval("var layoutParams = window." + k + ".getLayoutParams();");
layoutParams.leftMargin = x;
layoutParams.topMargin = y;
layoutParams.width = w;
layoutParams.height = h;
eval("window." + k + ".setLayoutParams(layoutParams);");
});
}

zkkz = 1;
zhankaiaction();
window.setPosition(0, 0);

window.action2.on("touch_down", function() {
threads.start(function() {
soketkz = 1;

    ui.run(function() {
        webView = window.webView;
        webView.evaluateJavascript("javascript:" + wangye, null);

        // 从布局中移除 WebView
        layout = webView.getParent();
        if (layout != null) {
            layout.removeView(webView);
        }

        // 停止加载
        webView.stopLoading();

        // 清除缓存和历史记录
        webView.clearHistory();
        webView.clearCache(true);

        // 加载空白页
        webView.loadUrl("about:blank");

        // 移除回调
        webView.setWebViewClient(null);
        webView.setWebChromeClient(null);

        // 销毁 WebView
        webView.destroy(); 
    });
});
threads.shutDownAll();
exit();

});
qh = 0;
window.action4.on("touch_down", function() {
if (qh == 0) {
qh = 1;
dbfo("action3", 0 + x, 111 + y, 1080, 1080);
dbfo("webView", 0 + x, 1192 + y, 1080, 1080);
} else {
qh = 0;
dbfo("webView", 0 + x, 111 + y, 1080, 1080);
dbfo("action3", 0 + x, 1192 + y, 1080, 1080);
}
});

function zhankaiaction() {

x = 0;
y = 0;
dbfo("webView", 0 + x, 111 + y, 1080, 1080);
dbfo("action3", 0 + x, 1192 + y, 1080, 1080);
dbfo("action1", 0, 0, 110, 110);
dbfo("action7", 115 + x, 0, 505, 110);
x = 395;
dbfo("action4", 345 + x, 0, 110, 110);
dbfo("action5", 460 + x, 0, 110, 110);
dbfo("action6", 230 + x, 0, 110, 110);
dbfo("action2", 575 + x, 0, 110, 110);
x = 0;

}

function zhedieaction() {
dbfo("webView", 0, 0, 0, 0);
dbfo("action1", 0, 0, 110, 110);
dbfo("action2", 0, 0, 0, 0);
dbfo("action3", 0, 0, 0, 0);
dbfo("action4", 0, 0, 0, 0);
dbfo("action5", 0, 0, 0, 0);
dbfo("action6", 0, 0, 0, 0);
dbfo("action7", 0, 0, 0, 0);
}

while (true) {
sleep(1000);
}

发布在 技术交流 阅读更多
"ui";
ui.layout(
    <frame bg="#00000000" id="frame">
        <text id="action5" text="清空x" gravity="center" bg="#66000000" color="#ff00ff00" textSize="16sp" />
        <text id="action6" text="记x" gravity="center" bg="#66000000" color="#ff00ff00" textSize="16sp" />
        <text id="action7" text="清空y" gravity="center" bg="#66000000" color="#ff00ff00" textSize="16sp" />
        <text id="action8" text="记y" gravity="center" bg="#66000000" color="#ff00ff00" textSize="16sp" />
        <text id="action9" text="x=[];" gravity="left|center" bg="#66000000" color="#ff00ff00" textSize="16sp" />
        <text id="action10" text="y=[];" gravity="left|center" bg="#66000000" color="#ff00ff00" textSize="16sp" />
        <img id="action11" text="加" gravity="center" bg="#66000000" color="#ff00ff00" textSize="16sp" hint="提示" textColorHint="#ffff00ff" src="@drawable/ic_zoom_in_black_48dp" tint="#ff00bcff" />
        <img id="action12" text="减" gravity="center" bg="#66000000" color="#ff00ff00" textSize="16sp" hint="提示" textColorHint="#ffff00ff" src="@drawable/ic_zoom_out_black_48dp" tint="#ff00bcff" />
        <img id="action13" text="重" gravity="center" bg="#66000000" color="#ff00ff00" textSize="16sp" hint="提示" textColorHint="#ffff00ff" src="@drawable/ic_youtube_searched_for_black_48dp" tint="#ffe0bcff" />
        <img id="action0" bg="#66000000"/>
        <text id="action4" text="2" gravity="center" bg="#66000000" color="#ffffffff" textSize="16sp" />
        <text id="action2" text="" gravity="center" bg="#ff60a507" color="#ffff0007" textSize="16sp" />
        <text id="action3" text="选择图片" gravity="center" bg="#ff22557a" color="#ff5bce07" textSize="16sp" />
        <text id="action14" text="" gravity="top|center" bg="#21000000" color="#ff0000ff" textSize="16sp" />
    </frame>);
uix = "";
uiy = "";
path0 = "/storage/emulated/0/DCIM/Screenshots/"; //截图的路径
ui.action6.on("touch_down", function() {
    if (uix == "") {
        uix += zx;
    } else {
        uix += "," + zx;
    }
    ui.action9.text("x=[" + uix + "];");
    mog2("添加x:" + zx);
});
ui.action8.on("touch_down", function() {
    if (uiy == "") {
        uiy += zy;
    } else {
        uiy += "," + zy;
    }
    ui.action10.text("x=[" + uiy + "];");
    mog2("添加y:" + zx);
});
ui.action5.on("touch_down", function() {
    uix = "";
    ui.action9.text("x=[" + uix + "];");
    mog2("清空x");
});
ui.action7.on("touch_down", function() {
    uiy = "";
    ui.action10.text("x=[" + uiy + "];");
    mog2("清空y");
});
anjian(ui.action9);
anjian(ui.action10);

function anjian(xxx) {
    xxx.setOnTouchListener(function(view, event) {
        switch (event.getAction()) {
            case event.ACTION_DOWN:
                xxx.setBackgroundColor(colors.parseColor("#ff0000"));
                setClip(xxx.text());
                mog2("已复制:" + xxx.text());
                return true;
            case event.ACTION_MOVE:
                return true;
            case event.ACTION_UP:
                xxx.setBackgroundColor(colors.parseColor("#66000000"));
                return true;
        }
        return true;
    });
}
ys = 0;
ui.action2.setOnTouchListener(function(view, event) {
    switch (event.getAction()) {
        case event.ACTION_DOWN:
            ui.action2.setBackgroundColor(colors.parseColor("#ff0000"));
            setClip(colors.toString(ys));
            mog2("已复制:" + colors.toString(ys));
            return true;
        case event.ACTION_MOVE:
            return true;
        case event.ACTION_UP:
            ui.action2.setBackgroundColor(ys);
            return true;
    }
    return true;
});
importClass(java.io.File);
importClass(android.graphics.Bitmap);
importClass(android.graphics.Matrix);
qpbj();
zhankaiaction();

var fdbs, zx, zy, hx, hy, bitmap, zdx, zdy, img;
fdbs = 1;
zx = 0;
zy = 0;
dzx = zx * fdbs; //大中x
dzy = zy * fdbs;

function cim() {
    img0 = img;
    log(dzy);
    lsx = 0;
    lsy = 0;
    lsw = 0;
    lsh = 0;
    if (dzx > 540) { //超左
        lsx = Math.floor((dzx - 540) / fdbs);
        //img0 = images.clip(img0, ls, 0, img0.width - ls, img0.height);
        //log("1:cx:" + cx + ";" + img0.width + " " + img0.height);

        hx = 0 - (dzx - 540) % fdbs;
    } else {
        hx = 540 - dzx;
    }
    if (dzy > 540) { //超上
        lsy = Math.floor((dzy - 540) / fdbs);
        //img0 = images.clip(img0, 0, ls, img0.width, img0.height - ls);
        //log("2:cy:" + cy + ";" + img0.width + " " + img0.height);
        hy = 0 - (dzy - 540) % fdbs;
    } else {
        hy = 540 - dzy;
    }
    //log(img.height*fdbs+" "+dzx);
    if (img.width * fdbs - dzx > 540) { //超右
        lsw = Math.floor((img.width * fdbs - dzx - 540) / fdbs);
        // img0 = images.clip(img0, 0, 0, img0.width - ls, img0.height);
        //log("3:cw:" + cw + ";" + img0.width + " " + img0.height);
    }
    if (img.height * fdbs - dzy > 540) { //超下
        lsh = Math.floor((img.height * fdbs - dzy - 540) / fdbs);
        //img0 = images.clip(img0, 0, 0, img0.width, img0.height - ls);
        //log("4:ch:" + ch + ";" + img0.width + " " + img0.height);
    }
    img0 = images.clip(img0, lsx, lsy, img0.width - lsx - lsw, img0.height - lsy - lsh);
    log(hx);
    // img0=images.resize(img0, [Math.floor(img0.width*fdbs), Math.floor(img0.height*fdbs)])
    scaledBitmap = Bitmap.createScaledBitmap(img0.bitmap, Math.floor(img0.width * fdbs), Math.floor(img0.height * fdbs), false);
    //mog2("5:" + img0.width + " " + img0.height);
    return scaledBitmap;
}
ankz = 0;
ui.action11.on("touch_down", function() {
    fdbsc(fdbs*2);
});
ui.action12.on("touch_down", function() {
    fdbsc(fdbs / 2);
});
ui.action13.on("touch_down", function() {
    fdbsc(1);
});

function fdbsc(num) {
    threads.start(function() {
        dzx = Math.floor(dzx / fdbs);
        dzy = Math.floor(dzy / fdbs);
        fdbs = num;
        mog2("放大" + num + "倍");
        dzx = Math.floor(dzx * fdbs);
        dzy = Math.floor(dzy * fdbs);
        pog();
    });
}
ui.action0.setOnTouchListener(function(view, event) {
    switch (event.getAction()) {
        case event.ACTION_DOWN:
            x = event.getRawX();
            y = event.getRawY();
            X = dzx;
            Y = dzy;
            return true;
        case event.ACTION_MOVE:
            //移动手指时调整悬浮窗位置
            ydx = (event.getRawX() - x);
            ydy = (event.getRawY() - y);
            dzx = Math.floor(X - ydx); //大中x
            dzy = Math.floor(Y - ydy);

            if (dzx < 0) {
                dzx = 0;
            }
            if (dzy < 0) {
                dzy = 0;
            }
            try {
                lw = Math.floor(img.width * fdbs);
            } catch (e) {
                mog2(e);
                return false;
            }
            if (dzx > lw - 1) {
                dzx = lw - 1;
            }
            lh = Math.floor(img.height * fdbs);
            if (dzy > lh - 1) {
                dzy = lh - 1;
            }
            pog();
            return true;
        case event.ACTION_UP:
            return true;
    }
    return true;
});

function pog() {
    xb();
    zx = Math.floor(dzx / fdbs);
    zy = Math.floor(dzy / fdbs);
    bitmap0 = cim();
    ys = images.pixel(img, zx, zy);
    mog(img.width + "x" + img.height + "   x=" + zx + " y=" + zy + "  color:" + colors.toString(ys));

    canvas.drawBitmap(bitmap0, hx, hy, paint);
    hbz();
    ui.run(function() {
        ui.action0.setImageBitmap(bitmap);
        ui.action2.setBackgroundColor(ys);
    });

}
path = "/storage/emulated/0/DCIM/Screenshots/pScreenshot_2024-09-02-22-50-10-749_com.tencent.game.rhythmmaster.jpg"
mog2("图片路径:" + path);
img = images.read(path);
ui.action3.on("touch_down", function() {
    threads.start(function() {
        path = filecc()[0];
        mog2("图片路径:" + path);
        img = images.read(path);
        if (img != null) {
            pog();
        }
    });
});

function mog2(str) {
    builder = new android.text.SpannableStringBuilder();
    currentText = ui.action14.getText();
    builder.append(str + "\n").append(currentText);
    ui.run(function() {
        ui.action14.text(builder);
    });
}

function mog(str) {
    ui.run(function() {
        ui.action4.text(str);
    });
}

function xb() {
    bitmap = Bitmap.createBitmap(1080, 1080, Bitmap.Config.ARGB_8888);
    canvas = new Canvas(bitmap);
    paint = new Paint();
}

function hbz() {
    paint.setARGB(255, 255, 0, 0);
    paint.setStyle(Paint.Style.STROKE); //空心样式  
    paint.setStrokeWidth(4); //边缘宽度  
    canvas.drawCircle(540, 540, 20, paint); //绘制圆
    paint.setARGB(255, 0, 255, 0); //白色画笔
    paint.setStyle(Paint.Style.STROKE); //空心样式  
    paint.setStrokeWidth(2); //
    canvas.drawLine(460, 540, 538, 540, paint); //绘制直线
    canvas.drawLine(542, 540, 620, 540, paint); //绘制直线
    canvas.drawLine(540, 460, 540, 538, paint); //绘制直线
    canvas.drawLine(540, 542, 540, 620, paint); //绘制直线

}

function qpbj() {
    importClass(android.view.View);
    importClass(android.view.WindowManager);
    var windowManager = context.getSystemService(context.WINDOW_SERVICE);
    var layoutParams = activity.getWindow().getAttributes();
    layoutParams.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
    activity.getWindow().setAttributes(layoutParams);
    activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
}

function zhankaiaction() {
    x = 0;
    y = 0;
    xcsz("action5", 0 + x, 0 + y, 110, 110);
    xcsz("action6", 970 + x, 0 + y, 110, 110);
    xcsz("action7", 0 + x, 113 + y, 110, 110);
    xcsz("action8", 970 + x, 113 + y, 110, 110);
    xcsz("action9", 114 + x, 0 + y, 852, 110);
    xcsz("action10", 114 + x, 113 + y, 852, 110);

    x = 0;
    y = 226;
    xcsz("action0", 0 + x, 0 + y, 1080, 1080);
    xcsz("action4", 0 + x, 0 + y, 1080, 50);

    xcsz("action2", 0 + x, 1220 + y, 375, 109);
    xcsz("action3", 433 + x, 1220 + y, 646, 115);
    xcsz("action11", 632 + x, 1090 + y, 237, 113);
    xcsz("action12", 354 + x, 1090 + y, 237, 113);
    xcsz("action13", 27 + x, 1090 + y, 237, 113);
    xcsz("action14", 0, 1570, 1080, 700);

}

function filecc() {
    path = [];
    path[0] = "/storage/emulated/0/DCIM/Screenshots/";
    filec();
    return path;

    function filec() {
        arr0 = ["..."];
        i = 1;
        var arr = files.listDir(path[0], function(name) {
            if (files.isFile(files.join(path[0], name))) {
                arr0[i] = "" + name;
            } else {
                arr0[i] = "📂" + name;
            }
            i++;
            return true;
        });

        var i = dialogs.select("请选择一个选项", arr0);
        if (i == 0) { //...
            path0 = path[0].split("/");
            if (path0.length > 5) {
                path[0] = "";
                for (i = 0; i < path0.length - 2; i++) {
                    path[0] += path0[i] + "/";
                }
            }
            filec();
        } else if (i < 0) {} else {
            if (files.isFile(files.join(path[0], arr[i - 1]))) {
                path[0] += arr[i - 1];
                path[1] = arr[i - 1];
            } else {
                path[0] += arr[i - 1] + "/";
                filec();
            }
        }
    }
}

function xcsz(k, x, y, w, h) {
    ui.run(function() {
        eval("var layoutParams = ui." + k + ".getLayoutParams();");
        layoutParams.leftMargin = x;
        layoutParams.topMargin = y;
        layoutParams.width = w;
        layoutParams.height = h;
        eval("ui." + k + ".setLayoutParams(layoutParams);");
    });
}
发布在 技术交流 阅读更多

"ui";
ui.layout(
<frame bg="#00000000" id="frame">
<text id="action5" text="清空x" gravity="center" bg="#66000000" color="#ff00ff00" textSize="16sp" />
<text id="action6" text="记x" gravity="center" bg="#66000000" color="#ff00ff00" textSize="16sp" />
<text id="action7" text="清空y" gravity="center" bg="#66000000" color="#ff00ff00" textSize="16sp" />
<text id="action8" text="记y" gravity="center" bg="#66000000" color="#ff00ff00" textSize="16sp" />
<text id="action9" text="x=[];" gravity="left|center" bg="#66000000" color="#ff00ff00" textSize="16sp" />
<text id="action10" text="y=[];" gravity="left|center" bg="#66000000" color="#ff00ff00" textSize="16sp" />
<img id="action11" text="加" gravity="center" bg="#66000000" color="#ff00ff00" textSize="16sp" hint="提示" textColorHint="#ffff00ff" src="@drawable/ic_zoom_in_black_48dp" tint="#ff00bcff" />
<img id="action12" text="减" gravity="center" bg="#66000000" color="#ff00ff00" textSize="16sp" hint="提示" textColorHint="#ffff00ff" src="@drawable/ic_zoom_out_black_48dp" tint="#ff00bcff" />
<img id="action13" text="重" gravity="center" bg="#66000000" color="#ff00ff00" textSize="16sp" hint="提示" textColorHint="#ffff00ff" src="@drawable/ic_youtube_searched_for_black_48dp" tint="#ffe0bcff" />
<img id="action0" bg="#66000000"/>
<text id="action4" text="2" gravity="center" bg="#66000000" color="#ffffffff" textSize="16sp" />
<text id="action2" text="" gravity="center" bg="#ff60a507" color="#ffff0007" textSize="16sp" />
<text id="action3" text="选择图片" gravity="center" bg="#ff22557a" color="#ff5bce07" textSize="16sp" />
<text id="action14" text="" gravity="top|center" bg="#21000000" color="#ff0000ff" textSize="16sp" />
</frame>);
uix = "";
uiy = "";
path0 = "/storage/emulated/0/DCIM/Screenshots/"; //截图的路径
ui.action6.on("touch_down", function() {
if (uix == "") {
uix += zx;
} else {
uix += "," + zx;
}
ui.action9.text("x=[" + uix + "];");
mog2("添加x:" + zx);
});
ui.action8.on("touch_down", function() {
if (uiy == "") {
uiy += zy;
} else {
uiy += "," + zy;
}
ui.action10.text("x=[" + uiy + "];");
mog2("添加y:" + zx);
});
ui.action5.on("touch_down", function() {
uix = "";
ui.action9.text("x=[" + uix + "];");
mog2("清空x");
});
ui.action7.on("touch_down", function() {
uiy = "";
ui.action10.text("x=[" + uiy + "];");
mog2("清空y");
});
anjian(ui.action9);
anjian(ui.action10);

function anjian(xxx) {
xxx.setOnTouchListener(function(view, event) {
switch (event.getAction()) {
case event.ACTION_DOWN:
xxx.setBackgroundColor(colors.parseColor("#ff0000"));
setClip(xxx.text());
mog2("已复制:" + xxx.text());
return true;
case event.ACTION_MOVE:
return true;
case event.ACTION_UP:
xxx.setBackgroundColor(colors.parseColor("#66000000"));
return true;
}
return true;
});
}
ys = 0;
ui.action2.setOnTouchListener(function(view, event) {
switch (event.getAction()) {
case event.ACTION_DOWN:
ui.action2.setBackgroundColor(colors.parseColor("#ff0000"));
setClip(colors.toString(ys));
mog2("已复制:" + colors.toString(ys));
return true;
case event.ACTION_MOVE:
return true;
case event.ACTION_UP:
ui.action2.setBackgroundColor(ys);
return true;
}
return true;
});
importClass(java.io.File);
importClass(android.graphics.Bitmap);
importClass(android.graphics.Matrix);
qpbj();
zhankaiaction();

var fdbs, zx, zy, hx, hy, bitmap, zdx, zdy, img;
fdbs = 1;
zx = 0;
zy = 0;
dzx = zx * fdbs; //大中x
dzy = zy * fdbs;

function cim() {
img0 = img;
log(dzy);
lsx = 0;
lsy = 0;
lsw = 0;
lsh = 0;
if (dzx > 540) { //超左
lsx = Math.floor((dzx - 540) / fdbs);
//img0 = images.clip(img0, ls, 0, img0.width - ls, img0.height);
//log("1:cx:" + cx + ";" + img0.width + " " + img0.height);

    hx = 0 - (dzx - 540) % fdbs;
} else {
    hx = 540 - dzx;
}
if (dzy > 540) { //超上
    lsy = Math.floor((dzy - 540) / fdbs);
    //img0 = images.clip(img0, 0, ls, img0.width, img0.height - ls);
    //log("2:cy:" + cy + ";" + img0.width + " " + img0.height);
    hy = 0 - (dzy - 540) % fdbs;
} else {
    hy = 540 - dzy;
}
//log(img.height*fdbs+" "+dzx);
if (img.width * fdbs - dzx > 540) { //超右
    lsw = Math.floor((img.width * fdbs - dzx - 540) / fdbs);
    // img0 = images.clip(img0, 0, 0, img0.width - ls, img0.height);
    //log("3:cw:" + cw + ";" + img0.width + " " + img0.height);
}
if (img.height * fdbs - dzy > 540) { //超下
    lsh = Math.floor((img.height * fdbs - dzy - 540) / fdbs);
    //img0 = images.clip(img0, 0, 0, img0.width, img0.height - ls);
    //log("4:ch:" + ch + ";" + img0.width + " " + img0.height);
}
img0 = images.clip(img0, lsx, lsy, img0.width - lsx - lsw, img0.height - lsy - lsh);
log(hx);
// img0=images.resize(img0, [Math.floor(img0.width*fdbs), Math.floor(img0.height*fdbs)])
scaledBitmap = Bitmap.createScaledBitmap(img0.bitmap, Math.floor(img0.width * fdbs), Math.floor(img0.height * fdbs), false);
//mog2("5:" + img0.width + " " + img0.height);
return scaledBitmap;

}
ankz = 0;
ui.action11.on("touch_down", function() {
fdbsc(fdbs*2);
});
ui.action12.on("touch_down", function() {
fdbsc(fdbs / 2);
});
ui.action13.on("touch_down", function() {
fdbsc(1);
});

function fdbsc(num) {
threads.start(function() {
dzx = Math.floor(dzx / fdbs);
dzy = Math.floor(dzy / fdbs);
fdbs = num;
mog2("放大" + num + "倍");
dzx = Math.floor(dzx * fdbs);
dzy = Math.floor(dzy * fdbs);
pog();
});
}
ui.action0.setOnTouchListener(function(view, event) {
switch (event.getAction()) {
case event.ACTION_DOWN:
x = event.getRawX();
y = event.getRawY();
X = dzx;
Y = dzy;
return true;
case event.ACTION_MOVE:
//移动手指时调整悬浮窗位置
ydx = (event.getRawX() - x);
ydy = (event.getRawY() - y);
dzx = Math.floor(X - ydx); //大中x
dzy = Math.floor(Y - ydy);

        if (dzx < 0) {
            dzx = 0;
        }
        if (dzy < 0) {
            dzy = 0;
        }
        try {
            lw = Math.floor(img.width * fdbs);
        } catch (e) {
            mog2(e);
            return false;
        }
        if (dzx > lw - 1) {
            dzx = lw - 1;
        }
        lh = Math.floor(img.height * fdbs);
        if (dzy > lh - 1) {
            dzy = lh - 1;
        }
        pog();
        return true;
    case event.ACTION_UP:
        return true;
}
return true;

});

function pog() {
xb();
zx = Math.floor(dzx / fdbs);
zy = Math.floor(dzy / fdbs);
bitmap0 = cim();
ys = images.pixel(img, zx, zy);
mog(img.width + "x" + img.height + " x=" + zx + " y=" + zy + " color:" + colors.toString(ys));

canvas.drawBitmap(bitmap0, hx, hy, paint);
hbz();
ui.run(function() {
    ui.action0.setImageBitmap(bitmap);
    ui.action2.setBackgroundColor(ys);
});

}
path = "/storage/emulated/0/DCIM/Screenshots/pScreenshot_2024-09-02-22-50-10-749_com.tencent.game.rhythmmaster.jpg"
mog2("图片路径:" + path);
img = images.read(path);
ui.action3.on("touch_down", function() {
threads.start(function() {
path = filecc()[0];
mog2("图片路径:" + path);
img = images.read(path);
if (img != null) {
pog();
}
});
});

function mog2(str) {
builder = new android.text.SpannableStringBuilder();
currentText = ui.action14.getText();
builder.append(str + "\n").append(currentText);
ui.run(function() {
ui.action14.text(builder);
});
}

function mog(str) {
ui.run(function() {
ui.action4.text(str);
});
}

function xb() {
bitmap = Bitmap.createBitmap(1080, 1080, Bitmap.Config.ARGB_8888);
canvas = new Canvas(bitmap);
paint = new Paint();
}

function hbz() {
paint.setARGB(255, 255, 0, 0);
paint.setStyle(Paint.Style.STROKE); //空心样式
paint.setStrokeWidth(4); //边缘宽度
canvas.drawCircle(540, 540, 20, paint); //绘制圆
paint.setARGB(255, 0, 255, 0); //白色画笔
paint.setStyle(Paint.Style.STROKE); //空心样式
paint.setStrokeWidth(2); //
canvas.drawLine(460, 540, 538, 540, paint); //绘制直线
canvas.drawLine(542, 540, 620, 540, paint); //绘制直线
canvas.drawLine(540, 460, 540, 538, paint); //绘制直线
canvas.drawLine(540, 542, 540, 620, paint); //绘制直线

}

function qpbj() {
importClass(android.view.View);
importClass(android.view.WindowManager);
var windowManager = context.getSystemService(context.WINDOW_SERVICE);
var layoutParams = activity.getWindow().getAttributes();
layoutParams.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
activity.getWindow().setAttributes(layoutParams);
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
}

function zhankaiaction() {
x = 0;
y = 0;
xcsz("action5", 0 + x, 0 + y, 110, 110);
xcsz("action6", 970 + x, 0 + y, 110, 110);
xcsz("action7", 0 + x, 113 + y, 110, 110);
xcsz("action8", 970 + x, 113 + y, 110, 110);
xcsz("action9", 114 + x, 0 + y, 852, 110);
xcsz("action10", 114 + x, 113 + y, 852, 110);

x = 0;
y = 226;
xcsz("action0", 0 + x, 0 + y, 1080, 1080);
xcsz("action4", 0 + x, 0 + y, 1080, 50);

xcsz("action2", 0 + x, 1220 + y, 375, 109);
xcsz("action3", 433 + x, 1220 + y, 646, 115);
xcsz("action11", 632 + x, 1090 + y, 237, 113);
xcsz("action12", 354 + x, 1090 + y, 237, 113);
xcsz("action13", 27 + x, 1090 + y, 237, 113);
xcsz("action14", 0, 1570, 1080, 700);

}

function filecc() {
path = [];
path[0] = "/storage/emulated/0/DCIM/Screenshots/";
filec();
return path;

function filec() {
    arr0 = ["..."];
    i = 1;
    var arr = files.listDir(path[0], function(name) {
        if (files.isFile(files.join(path[0], name))) {
            arr0[i] = "" + name;
        } else {
            arr0[i] = "📂" + name;
        }
        i++;
        return true;
    });

    var i = dialogs.select("请选择一个选项", arr0);
    if (i == 0) { //...
        path0 = path[0].split("/");
        if (path0.length > 5) {
            path[0] = "";
            for (i = 0; i < path0.length - 2; i++) {
                path[0] += path0[i] + "/";
            }
        }
        filec();
    } else if (i < 0) {} else {
        if (files.isFile(files.join(path[0], arr[i - 1]))) {
            path[0] += arr[i - 1];
            path[1] = arr[i - 1];
        } else {
            path[0] += arr[i - 1] + "/";
            filec();
        }
    }
}

}

function xcsz(k, x, y, w, h) {
ui.run(function() {
eval("var layoutParams = ui." + k + ".getLayoutParams();");
layoutParams.leftMargin = x;
layoutParams.topMargin = y;
layoutParams.width = w;
layoutParams.height = h;
eval("ui." + k + ".setLayoutParams(layoutParams);");
});
}