- "ui";
-
- const storage = storages.create("Coolxx");
-
- const isShow = storage.get("show",false)
- const loopNum = storage.get("loopNum",100)
- const sleepTime = storage.get("sleepTime",10)
- const findADTime = storage.get("findADTime",20)
- const waitADTime = storage.get("waitADTime",20)
- const failADTime = storage.get("failADTime",20)
- const isVip = storage.get("isVip",false)
- const AdLink = storage.get("AdLink","http://www.baidu.com")
- const ADViewTime = storage.get("ADViewTime",20)
- //const isAnti = storage.get("anti",true)
- const model = storage.get("model",0)
-
- ui.statusBarColor("#1495E7")
- ui.layout(
- <frame>
- <vertical>
- <appbar>
- <toolbar id="toolbar" bg="#1495E7" title="木木触控助手" >toolbar>
- appbar>
- <ScrollView>
- <vertical>
- <card w="*" h="70" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
- <horizontal gravity="center_vertical">
- <View bg="#1495E7" h="*" w="5"/>
- <vertical padding="10 8" h="auto" w="0" layout_weight="1">
- <horizontal>
- <Switch id="autoService" text="无障碍服务" checked="{{auto.service != null}}" padding="8 8 8 8" textSize="14"/>
- <Switch id="isShow" text="悬浮窗" checked="{{isShow}}" padding="8 8 8 8" textSize="14"/>
- horizontal>
- vertical>
- horizontal>
- card>
- <card w="*" h="270" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
- <horizontal gravity="center_vertical">
- <View bg="#1495E7" h="*" w="5"/>
- <vertical padding="10 8" h="auto" w="0" layout_weight="1">
- <horizontal id="ADViewTime"><text text="广告浏览时间/秒"/><input w="*" id="ADViewTime" text="{{ADViewTime}}" />horizontal>
- <horizontal id="IDLink"><text text="广告链接"/><input w="*" id="AdLink" text="{{AdLink}}" />horizontal>
- <horizontal><text text="循环次数"/><input w="*" id="loopNum" inputType="number" text="{{loopNum}}" />horizontal>
- <horizontal><text text="切歌间隔"/><input w="*" id="sleepTime" inputType="number" text="{{sleepTime}}" />horizontal>
- vertical>
- horizontal>
- card>
-
- <card w="*" h="200" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
- <horizontal gravity="center_vertical">
- <View bg="#1495E7" h="*" w="5"/>
- <vertical padding="10 8" h="auto" w="0" layout_weight="1">
- <horizontal><text text="找广告图等待时间/秒"/><input w="*" id="findADTime" inputType="number" text="{{findADTime}}" />horizontal>
- <horizontal padding="0 5"><text id="title" text="指定时间不出现广告切换下一个IP" textSize="13sp" />horizontal>
- <horizontal><text text="网页加载等待时间/秒"/><input w="*" id="waitADTime" inputType="number" text="{{waitADTime}}" />horizontal>
- <horizontal padding="0 5"><text id="title" text="指定时间加载未完成切换下一个IP" textSize="13sp" />horizontal>
- <horizontal><text text="网页加载等待时间/秒"/><input w="*" id="failADTime" inputType="number" text="{{failADTime}}" />horizontal>
- vertical>
- horizontal>
- card>
-
- <vertical padding="5">
- <button id="start" style="Widget.AppCompat.Button.Colored" text="启动浮窗"/>
- {/* <fab id = "start" w="auto" h="auto" src="@drawable/ic_play_arrow_black_48dp" layout_gravity = "bottom" margin ="16"/> */}
- vertical>
- vertical>
- ScrollView>
- vertical>
- frame>
- )
-
-
- function requestForFloatingPermission(){
- //设置为显示应用内对话框
- $dialogs.setDefaultDialogType('app');
- $dialogs.confirm("权限申请","需要打开悬浮窗权限,请在设置界面允许在其他应用上层显示")
- .then(ok=>{
- if(ok){
- $floaty.requestPermission()
- }
- })
- }
-
-
- //打开悬浮窗
- ui.start.on("click", e => {
- threads.start(function(){
- //在新线程执行的代码
- sleep(1000);
- execTask();
- });
-
- })
-
- function execTask() {
- toast("开始执行");
- var i = 0;
- while(i < loopNum) {
- console.log("第" + i + "次 访问: " + AdLink);
- app.openUrl(AdLink);
- sleep(3000);
- //浏览20s
- viewWeb(20);
- console.log("关闭浏览器")
- back();
- sleep(2000);
- i++;
-
- }
- }
-
- function viewWeb(time) {
- console.log("........开始浏览网页");
- gesture(1000, [300, 600], [300, 300]);
- var cnt = 1;
- while(true) {
- if (cnt > time) {
- break;
- }
- sleep(1000);
- cnt += 1;
- }
- }
"ui";
const storage = storages.create("Coolxx");
const isShow = storage.get("show",false)
const loopNum = storage.get("loopNum",100)
const sleepTime = storage.get("sleepTime",10)
const findADTime = storage.get("findADTime",20)
const waitADTime = storage.get("waitADTime",20)
const failADTime = storage.get("failADTime",20)
const isVip = storage.get("isVip",false)
const AdLink = storage.get("AdLink","http://www.baidu.com")
const ADViewTime = storage.get("ADViewTime",20)
//const isAnti = storage.get("anti",true)
const model = storage.get("model",0)
ui.statusBarColor("#1495E7")
ui.layout(
<toolbar id="toolbar" bg="#1495E7" title="木木触控助手" >
{/*
)
function requestForFloatingPermission(){
//设置为显示应用内对话框
$dialogs.setDefaultDialogType('app');
$dialogs.confirm("权限申请","需要打开悬浮窗权限,请在设置界面允许在其他应用上层显示")
.then(ok=>{
if(ok){
$floaty.requestPermission()
}
})
}
//打开悬浮窗
ui.start.on("click", e => {
threads.start(function(){
//在新线程执行的代码
sleep(1000);
execTask();
});
})
function execTask() {
toast("开始执行");
var i = 0;
while(i < loopNum) {
console.log("第" + i + "次 访问: " + AdLink);
app.openUrl(AdLink);
sleep(3000);
//浏览20s
viewWeb(20);
console.log("关闭浏览器")
back();
sleep(2000);
i++;
}
}
function viewWeb(time) {
console.log("........开始浏览网页");
gesture(1000, [300, 600], [300, 300]);
var cnt = 1;
while(true) {
if (cnt > time) {
break;
}
sleep(1000);
cnt += 1;
}
}