最新⼀键热更新启动界⾯Autojs源码
// 此代码由攒外快⽹autojs开发交流整理提供,更多脚本和源码:。如有侵权,请联系我删除!
"ui";
importClass(android.view.View);
//设置状态栏为透明
ui.statusBarColor(colors.TRANSPARENT);
startUI();
function startUI() {
ui.layout(
<frame>
<img id="advertising" scaleType="fitXY" src="file://./res/background.jpg" />
<vertical id="skip" w="90" h="auto" bg="#00000000" margin="0 {{getNavigationBarHeight()}}px 15 0" layout_gravity="right" >
<card w="*" h="*" cardCornerRadius="3dp" cardElevation="0dp" cardBackgroundColor="#55000000" >
<horizontal gravity="center" >
<text id="countdown" textSize="13" layout_gravity="center" textColor="#ffffff" />
<View bg="#778899" w="1" h="20" margin="5" layout_gravity="center_vertical"/>
<img w="20" h="20" padding="0" src="@drawable/ic_clear_black_48dp" tint="#ffffff" layout_gravity="center"/>
</horizontal>
</card>
</vertical>
<vertical w="*" h="{{Math.floor(getNavigationBarHeight() * 3.5)}}px" bg="#66987654" layout_gravity="bottom">
<horizontal h="*" gravity="center" >
<img src="file://./res/icon.png" w="60" h="60" scaleType="fitXY" radius="10"/>
<vertical gravity="center" margin="15 0">
<text text="{{getAppName()}}" w="auto" h="auto" textSize="24" textColor="#ffffff" textStyle="bold" />
<text text="version: {{app.versionName}}" w="auto" h="auto" textSize="16" textColor="#ffffff"/>
</vertical>
</horizontal>
</vertical>
js脚本开发</frame>
)
}
//透明状态栏{沉浸模式}
//线程启动倒计时
threads.start(function() {
if (CheckFd()) {
toastLog("请关闭vpn/代理,重新打开");
exit();
} else {
getNetwork();
}
var time = 3;
if (getNetwork()) {
while (time >= 0) {
ui.post(() => {
time--;
})
if (time <= 0) {
SkipStartPage();
}
sleep(1000)
}
}
})
//跳转⼴告页或第三⽅应⽤
("click", () => {
app.openUrl("zwk365")
threads.shutDownAll()
})
//当⽤户回到本界⾯时,resume事件会被触发,避免卡在启动页
<("resume", function() {
SkipStartPage();
});
//跳过等待页⾯
("click", () => {
threads.shutDownAll()
SkipStartPage();
})
//跳过启动页/在这⾥修改下⼀步要运⾏的脚本路径
function SkipStartPage() {
ui.finish()
}
/
/获取状态栏⾼度
function getNavigationBarHeight() {
var navigationBarHeight = 0;
var rid = Resources().getIdentifier("config_showNavigationBar", "bool", "android");
if (rid != 0) {
var resourceId = Resources().getIdentifier("navigation_bar_height", "dimen", "android");        navigationBarHeight = Resources().getDimensionPixelSize(resourceId);
}
return navigationBarHeight;
}
//获取当前App应⽤名字
function getAppName() {
var packageManager = PackageManager();
var applicationInfo = PackageName(), 0);
ApplicationLabel(applicationInfo);
}
//判断当前⽹络是否可⽤
function getNetwork() {
importClass(android.ConnectivityManager);
var cm = SystemService(context.CONNECTIVITY_SERVICE);
var net = cm.getActiveNetworkInfo();
if (net == null || !net.isAvailable()) {
toastLog("当前⽹络不可⽤,请检查⽹络链接状态");
exit();
} else {
return true;
}
}
//检测抓包fd
function CheckFd() {
try {
var niList = NetworkInterfaces();
if (niList) {
var VPN;
var arry = java.util.Collections.list(niList).toArray()
for (ary = 0; ary < arry.length; ary++) {
if (!arry[ary].isUp() || arry[ary].getInterfaceAddresses().size() == 0) {
continue;
}
if (arry[ary].getName().search("tun0") !== -1 || arry[ary].getName().search("ppp0") !== -1) {                    VPN = true;
return true
} else {
VPN = false
}
}
return VPN
}
} catch (error) {}
}
//让返回键失效
var Liuyun_back = false;
<("back_pressed", e => {
if (!Liuyun_back) {
Liuyun_back = false;
} else {
};
});

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