/*
软件作者:https://xuhss.com/oxox/pro
*/
"ui";
var bgcolor = "#ffffff";
var color = "#000000";
ui.statusBarColor(color);
/***************图片***** */
var img_path = "/storage/emulated/0/00细雨/图片/";
files.createWithDirs(img_path);
/***************音乐*****/
var music_list = [];
var music_source = ["netease","kugou","baidu","xiami","tencent"];
var music_page = 1;
var music_word = "";
var music_flag1 = true;
dialogs.confirm("小哥哥and小姐姐,本软件由晓雨独自编程滴,可能有些不稳定。所以搜索时,多摁几下搜索,懂吗。/n记住了,这个软件叫灵晶哦")
ui.layout(
<drawer id="drawer">
<vertical>
<appbar bg={color}>
<toolbar id="toolbar" h="30" title="" />
<tabs id="tabs" h="30" />
</appbar>
<viewpager id="viewpager">
<!-- 第一页内容-->
<frame>
<vertical >
<horizontal bg={bgcolor} alpha="1" h="45">
<input id="input" hint="搜索图片" layout_weight="1" textSize="16sp" marginLeft="16" />
<button id="search" text="搜索" w="60" h="40" margin="0,0,0,-50" style="Widget.AppCompat.Button.Borderless.Colored" />
<button id="last" text="⬅" w="70" margin="0,0,0,-20" style="Widget.AppCompat.Button.Borderless.Colored" />
<button id="rand" text="随机" w="70" margin="0,-10" style="Widget.AppCompat.Button.Borderless.Colored" />
<button id="next" text="➡" w="70" margin="0,0" style="Widget.AppCompat.Button.Borderless.Colored" />
</horizontal >
<list id="icons" spanCount="1" bg={bgcolor}>
<img id="image" src="{{this}}" w="*" h="*" margin="-0,0" tint="#00ffffff" />
</list>
<text text="请稍等" textSize="30sp" textColor="#000000" />
</vertical>
</frame>
<!-- 第二页内容-->
<frame>
<vertical bg={bgcolor}>
<horizontal>
<input id="music_search_input" hint="搜索音乐" layout_weight="1" textSize="16sp" marginLeft="16" />
<button id="music_search_button" text="搜索" textSize="20sp" w="100" h="50" margin="-5,0,0,-80" style="Widget.AppCompat.Button.Borderless.Colored" />
<spinner id="music_sp1" textSize="20sp" w="100" h="50" margin="-4,-40,0,0" entries="网易音乐|酷狗音乐|百度音乐|虾米音乐|QQ音乐"/>
</horizontal>
<frame>
<list id="music_list">
<horizontal>
<linear bg="?selectableItemBackground" w="1000">
<img src="{{pic}}" h="50" w="50" />
<vertical h="50">
<text text="{{name}}" textSize="15sp" textColor="#000000" h="20" w="*" margin="10,0,5,10" />
<text text="{{artist}}" textSize="10sp" h="20" w="*" margin="0,0,0,10" />
</vertical>
</linear>
</horizontal>
</list>
</frame>
</vertical>
</frame>
<!-- 第三页内容-->
<frame>
<vertical bg={bgcolor}>
<horizontal h="45">
<input id="search_input" layout_weight="1" hint="搜索视频" textSize="16sp" marginLeft="16" />
<button id="search_button" text="搜索" textSize="20sp" w="100" h="50" margin="-5,0,0,-80" style="Widget.AppCompat.Button.Borderless.Colored" />
</horizontal>
<frame>
<list id="list">
<horizontal>
<linear bg="?selectableItemBackground" w="1000">
<img src="{{icon}}" h="50" w="50" tint="#000000" />
<text text="{{name}}" textSize="15sp" h="40" w="*" textColor="#000000" margin="10,10" />
</linear>
</horizontal>
</list>
</frame>
</vertical>
</frame>
</viewpager>
</vertical>
<vertical layout_gravity="left" bg="#ffffff" w="280">
<img src="http://pic1.16pic.com/00/52/10/16pic_5210406_b.jpg" h="200" scaleType="centerCrop" />
<list id="menu">
<horizontal bg="?selectableItemBackground" w="*">
<img w="50" h="50" padding="16" src="{{this.icon}}" tint="{{color}}" />
<text textColor="black" textSize="15sp" text="{{this.title}}" layout_gravity="center" />
</horizontal>
</list>
</vertical>
</drawer>
);
/*******************************ui模板******************************** */
//创建选项菜单(右上角)
ui.emitter.on("create_options_menu", menu => {
menu.add("设置");
menu.add("关于");
});
//监听选项菜单点击
ui.emitter.on("options_item_selected", (e, item) => {
switch (item.getTitle()) {
case "设置":
toast("还没有设置,哼(* ̄m ̄)");
break;
case "关于":
alert("关于", "内个 没啥好关于滴,知道我叫啥就行。");
break;
}
e.consumed = true;
});
activity.setSupportActionBar(ui.toolbar);
//设置滑动页面的标题
ui.viewpager.setTitles(["图片", "音乐", "视频"]);
//让滑动页面和标签栏联动
ui.tabs.setupWithViewPager(ui.viewpager);
//让工具栏左上角可以打开侧拉菜单
ui.toolbar.setupWithDrawer(ui.drawer);
ui.menu.setDataSource([{
title: "图片下载路径",
icon: "@drawable/ic_android_black_48dp"
},
{
title: "视频搜索说明",
icon: "@drawable/ic_settings_black_48dp"
},
{
title: "交流",
icon: "@drawable/ic_favorite_black_48dp"
},
{
title: "退出",
icon: "@drawable/ic_exit_to_app_black_48dp"
}
]);
ui.menu.on("item_click", item => {
switch (item.title) {
case "图片下载路径":
alert(null, img_path);
break;
case "视频搜索说明":
alert(null, "视频网页不稳定请耐心等待,\n也有可能出现点击搜索后什么结果也没有,但多试几次就行了");
break;
case "交流":
qq = "3375338014"
dialogs.confirm(null, "QQ:" + qq, function(i) {
if (i) {
app.startActivity({
action: "android.intent.action.VIEW",
data: "mqqapi://card/show_pslcard?&uin=" + qq
});
}
});
break;
case "退出":
ui.finish();
break;
}
});
/***************************百度图片******************************* */
function menu(url1) {
let a = ["下载", "取消"];
dialogs.select(null, a, function(i) {
switch (i) {
case 0:
name = url1.replace(/\//g, "_");
dirlist = files.listDir(img_path);
let j;
for (j = 0;