/*
软件作者:https://xuhss.com/oxox/pro
*/
"ui";
/**
*作者QQ: 1811588980
*完成时间: 2019年2月13日 下午8:41:29
*测试机型: meizu_M5 Note
*Auto.js版本: 4.1.0 Alpha5
*屏幕: 1080*1920
*API: 24
*备注: 文件和文件夹分类排序。
**/
var scrollView = XmlToView(
<scroll/>
);
var myView = new getMyView("/sdcard/脚本");
scrollView.addView(myView.view);
ui.setContentView(scrollView);
function getMyView(path) {
this.fun = arguments.callee;
this.file = new myFile(path);
this.thread = null;
this.view = XmlToView(
<vertical id="vt_1" margin="5" >
<text id="name" textSize="25"margin="5"bg="#dddddd"/>
<vertical id="vt_2" marginLeft="25">
</vertical>
</vertical>
);
if (this.file.file.isDirectory()) {
//ui.run(()=>{
this.view.name.setText("▽" + String(this.file.name));
//});
} else {
//ui.run(()=>{
this.view.name.setText("♢" + String(this.file.name));
//});
};
this.view.name.click(() => {
if (this.file.file.isDirectory()) {
//变量值为空则代表线程没有开启。变量值不为空,则判断线程是不是正在运行。
if (this.thread ? !this.thread.isAlive() : true) { //线程没有运行。
if (!this.file.isOpen) {
this.isadd = true;
var ary = this.file.list();
this.thread = threads.start(new java.lang.Runnable(() => {
ary.forEach((file) => {
ui.run(() => {
this.view.vt_2.addView(new this.fun(file.file).view);
});
});
this.file.isOpen = true;
ui.run(() => {
this.view.name.setText("△" + String(this.file.name));
});
}));
} else {
this.view.vt_2.removeAllViews();
this.file.isOpen = false;
//ui.run(()=>{
this.view.name.setText("▽" + String(this.file.name));
//});
};
} else {
toast("正在加载,我也没办法改这个问题呀");
};
} else {
threads.start(new java.lang.Runnable(() => {
let k = dialogs.confirm("打开文件?", this.file.name);
if (k) {
app.editFile(this.file.path);
};
}));
}
});
};
function myFile(path) {
this.fun = arguments.callee;
this.file = new java.io.File(path);
this.name = this.file.name;
this.path = this.file.path;
this.isOpen = false;
this.list = function() {
return []
};
if (this.file.isDirectory()) {
this.list = function() {
var fileList = this.file.listFiles();
// log(fileList);
var dirList = fileList.filter(function(file) {
return file.isDirectory();
}).sort();
var fileList = fileList.filter(function(file) {
return file.isFile();
}).sort();
return dirList.concat(fileList).map((file) => {
return new this.fun(file);
});
};
};
};
function XmlToView(xml) {
runtime.ui.layoutInflater.setContext(context);
return runtime.ui.layoutInflater.inflate(xml.toXMLString().toString(), null, true);
};
没有合适的资源?快使用搜索试试~ 我知道了~
AutoJs源码-文件查看(1)
共1个文件
js:1个
需积分: 1 0 下载量 144 浏览量
2022-11-15
23:16:09
上传
评论
收藏 1KB 7Z 举报
温馨提示
AutoJs源码-文件查看(1)。本资源购买前提醒:本源码都是实际autojs项目模板,安装好autojs直接运行即可打开。1、支持低版本autojs。2、资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!。3、安装过程详见具体资源,不会使用autojs谨慎下载
资源推荐
资源详情
资源评论
收起资源包目录
AutoJs源码-文件查看(1).7z (1个子文件)
AutoJs源码-文件查看(1).js 4KB
共 1 条
- 1
资源评论
[虚幻私塾】
- 粉丝: 335
- 资源: 1559
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功