基于auto.js的滑动脚本"ui";
importClass(android.view.View);
auto.waitFor();
auto.setMode('normal');
// setInterval(() => { }, 1000);
threads.start(function () {
var window = floaty.window(
<vertical>
<button id="center" margin="0" w="60"></button>
<button id="upSwipe" margin="0" w="60">向上滑动</button>
<button id="stop" margin="0" w="60" visibility="gone">停⽌</button>
<button id="downSwipe" margin="0" w="60">向下滑动</button>
<button id="exit" margin="0" w="60">退出</button>
</vertical>
);
window.X(), Y() + 200);
var x = 0,
y = 0,
windowX = 0,
windowY = 0;
switch (Action()) {
case event.ACTION_DOWN:
js脚本开发x = RawX();
y = RawY();
windowX = X();
windowY = Y();
break;
case event.ACTION_MOVE:
window.setPosition(windowX + (RawX() - x), windowY + (RawY() - y));
break;
case event.ACTION_UP:
toast("center")
if (Math.RawY() - y) < 5 && Math.RawX() - x) < 5) {
ui.run(function () {
window.upSwipe.setVisibility(View.GONE);
window.stop.setVisibility(View.GONE);
window.downSwipe.setVisibility(View.GONE);
});
}
break;
}
return true;
});
window.upSwipe.setOnTouchListener(function (view, event) { // 可以改成 click()
toast("upSwipe");
var upSwipeEvt = itter(threads.currentThread());
threads.start(function () {
try {
} catch (e) {
var logName = "testLog" + ".log";
path = "logdir/" + logName;
files.append(path, e);
toast(e);
}
});
return true;
});
window.downSwipe.setOnTouchListener(function (view, event) { // 可以改成 click()
toast("downSwipe");
var downSwipeEvt = itter(threads.currentThread());
threads.start(function () {
try {
} catch (e) {

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。