autojs-漂亮的UI设计
"ui";
var appName ="我爱挂机";
const appId="01"
var isInTime=false;
const ZZ_version="1.0.82"
const TYPE={KS:"kshou",DY:"douyin"}
let isLogin=false;
let OutTimeTip="攒攒登录失效(点击更新)"
let workThread=null;
let ate("攒攒⾃赚")
let backTag=false;
let快⼿关注上限=false
ui.statusBarColor("#FF4FB3FF")
ui.layout(
<drawer id="drawer">
<vertical>
<appbar>
<toolbar id="toolbar" bg="#ff4fb3ff" title="{{appName}}"/>
</appbar>
<vertical gravity="center" layout_weight="1">
<frame>
{/* <View bg="#ff4fb3ff" h="54"/> */}
<viewpager h="84" id="pager">
<vertical>
<card w="*" h="68" margin="10 8" cardCornerRadius="6dp"
cardElevation="2dp" gravity="center">
<linear>
<vertical margin="10" layout_gravity="center_vertical" layout_weight="1">
<text id="name" size="18" color="#444444" text="⽆帐号"/>
<text id="integral"  padding="1" size="16" text="..." foreground="?selectableItemBackground"/>
</vertical>
<button id="login" w="90" text="登录账号" color="#ff5d85ff" /> </linear>
</card>
</vertical>
<vertical>
<card w="*" h="68" margin="10 8" cardCornerRadius="6dp"
cardElevation="2dp" gravity="center">
<linear>
<vertical margin="10" layout_gravity="center_vertical" layout_weight="1">
<text id="imei" textIsSelectable="true" size="18" color="#444444" text="{}"/>
<text id="Etime" size="16" text="..."/>
</vertical>
<button id="recharge" w="70" text="绑卡" color="#ff5d85ff" /> </linear>
</card>
</vertical>
</viewpager>
</frame>
<tabs w="40" id="tabs" tabIndicatorColor="#777777" bg="#cfcfcf"  h="2"/>
<vertical padding="10 6 0 6" bg="#ffffff" w="*" h="auto" margin="0 5" elevation="1dp">
<Switch id="autoService" w="*" checked="{{auto.service != null}}" textColor="#666666" text="⽆障碍服务"/>
<View h="5"/>
<Switch w="*" textColor="#666666" text="不做评论任务" id="noComment"/>
</vertical>
<vertical margin="0 5" bg="#ffffff" elevation="1dp" padding="5 5 10 5" w="*" h="auto">
<checkbox id="DYcheck" text="抖⾳" layout_weight="1"/>
<text text="单次运⾏任务上限↓"/>
</linear>
<linear>
<seekbar id="DYseekbar" max="50" layout_weight="1"/>
<text gravity="center" id="DYlimit"/>
</linear>
<View h="5"/>
<linear gravity="center">
<checkbox id="KScheck" text="快⼿" layout_weight="1"/>
<text text="单次运⾏任务上限↓"/>
</linear>
<linear>
<seekbar id="KSseekbar" max="50" layout_weight="1"/>
<text gravity="center" id="KSlimit"/>
</linear>
</vertical>
<linear>
<text layout_weight="1" size="19" color="#222222" text="⽇志"/>
<button id="tolog" h="40" text="全部⽇志" />
</linear>
<text paddingLeft="5" size="16" id="oneLog"/>
<list bg="#ffffff" elevation="1dp" h="*" id="logList">
<linear>
<text size="13" textColor="#555555" text="{{time}} "/>
<text size="13" text="{{message}}"/>
</linear>
</list>
</vertical>
<button id="start" text="开始运⾏" tag="ScriptTag" color="#ffffff" bg="#FF4FB3FF" foreground="?selectableItemBackground"/> </vertical>
</drawer>
);
//设置滑动模式
ui.logList.setOverScrollMode(2);
//设置滑动页⾯的标题
ui.pager.setTitles(["",""]);
//让滑动页⾯和标签栏联动
ui.tabs.setupWithViewPager(ui.pager);
ui.login.click((view)=>{
var dialog =new android.app.AlertDialog.Builder(activity).create()
dialog.setView(new android.widget.EditText(context))
dialog.show();
dialog.setCancelable(false)
var window = Window();
window.setDimAmount(0.6);
var vv=ui.inflate(
<vertical>
<text text="攒攒登录" size="19" color="#000000" padding="12 12"/>
<vertical margin="25 0 25 10">
<linear>
<text gravity="center" color="#555555" size="17" text="账号 "/>
<input textColor="#000000" inputType="number" id="username" w="*"/>
</linear>
<linear>
<text gravity="center" color="#555555" size="17" text="密码 "/>
<input textColor="#000000" id="password" w="*"/>
</linear>
</vertical>
<button id="cancle" layout_alignParentLeft="true" text="取消" w="auto"/> <button id="login" layout_alignParentRight="true" text="登录" w="auto"/> </relative>
</vertical>)
window.setContentView(vv);
vv.cancle.click(()=>{dialog.dismiss();});
vv.login.click(()=>{
if(!()){toast("账号不能为空!");return;}
if(!()){toast("密码不能为空");return;}
threads.start(function(){
var pL=login((),());
if(!pL.data||!ken){toast("登录失败!");return;}
toast("登陆成功!");
STORAGE.put("username",())
STORAGE.put("password",())
STORAGE.put("token",ken);
ui.run(function(){
// refreshZZ();
});
dialog.dismiss();
});
});
});
//⽆障碍开关监控
ui.autoService.setOnCheckedChangeListener(function(widget,checked){
if(checked&&!auto.service){
app.startActivity({
action:"android.settings.ACCESSIBILITY_SETTINGS"
});
textstyle}
if(!checked&&auto.service)auto.service.disableSelf()
ui.autoService.setChecked(auto.service!=null)
});
//存储
ui.DYseekbar.setOnSeekBarChangeListener({
onProgressChanged:function(v,i,fromUser){
ui.run(()=>{ui.DYlimit.setText(""+i*10)})
}
})
//存储器
ui.DYseekbar.ate(appName).get("DYlimit",200)/10)
//回到本界⾯时,resume事件会被触发
<("resume",()=>{
// 此时根据⽆障碍服务的开启情况,同步开关的状态
ui.autoService.checked = auto.service !=null;
});
//禁⽌返回退出脚本
<("back_pressed",function(event){
if(workThread&&workThread.isAlive()){
backTag=true;
toast("为防⽌脚本⾃动退出,脚本运⾏时不可返回退出软件");
}
})
app.startActivity("console")
})
ui.integral.click((v)=>{
()==OutTimeTip){
if(!("username",null)){toast("未保存账号");return;}
if(!("password",null)){toast("未保存密码");return;}
threads.start(function(){
var pL=("username",null),("password",null));
if(!pL.data||!ken){toastLog("⾃动登录失败!"+pL.msg);return;}
toast("⾃动登陆成功!");
STORAGE.put("token",ken);
ui.run(function(){
// refreshZZ();
});
});
}
})
ui.start.click(()=>{
ui.start.setText("停⽌运⾏");
workThread=threads.start(function(){
try{
clearLog()
if(!auto.service)toast("请先打开⽆障碍服务");
else workMain()
}catch(e){
if(!e.javaException instanceof java.lang.InterruptedException)
<("运⾏出错:"+e.toString())
}finally{
ui.run(function(){
ui.start.setText("开始运⾏")
});
}
});
});

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