17 Commits
v11 ... v14

Author SHA1 Message Date
StageGuard
a9cbc2348f Update version 14 2020-09-13 20:55:41 +08:00
StageGuard
13979f81ae Update version 14 2020-09-13 20:54:26 +08:00
StageGuard
8ff1de8e21 Upload user shared sheets 2020-09-13 17:30:27 +08:00
StageGuard
383d79f95b Upload user shared sheets 2020-09-13 17:28:49 +08:00
StageGuard
93918c8a8a Upload resource 2020-09-13 15:30:09 +08:00
StageGuard
8f737fa07b Add resources 2020-09-12 23:40:16 +08:00
StageGuard
32d83d3b3d small change 2020-09-10 20:48:42 +08:00
StageGuard
ae090a2141 small change 2020-09-10 20:47:33 +08:00
StageGuard
e9dc16cf9d Upload user shared sheets 2020-09-06 08:53:12 +08:00
StageGuard
d88424e659 ? 2020-09-05 10:54:55 +08:00
StageGuard
07e17626a3 Update version 13 2020-09-05 10:49:29 +08:00
StageGuard
adca548b63 Update version 13 2020-09-05 10:48:52 +08:00
StageGuard
e5d024e2d2 Fix: Show speed in idle state 2020-09-02 23:26:32 +08:00
StageGuard
2d44ba080b Fix: Show speed in idle state 2020-09-02 23:24:27 +08:00
StageGuard
aeae50875b Add contributor list 2020-09-02 23:21:16 +08:00
StageGuard
e9a4662001 Fix info error 2020-09-02 00:15:51 +08:00
StageGuard
3b83a9b113 Fix info error 2020-09-02 00:15:05 +08:00
28 changed files with 709 additions and 384 deletions

View File

@@ -15,8 +15,10 @@ A script to play Sheets generated by SkyStudio automatically in game Sky with ac
* ...
## 使用
Auto.js开启**无障碍服务**和**悬浮窗权限**。
</br>②在Auto.js中新建一个脚本并粘贴以下代码并运行
<br>①Auto.js`4.1.1 Alpha2 (461)`版本下载: [`Ericwyn/Auto.js/releases@V4.1.1.Alpha2`](https://github.com/Ericwyn/Auto.js/releases/tag/V4.1.1.Alpha2)
<br>手机请下载`autoJs-V4.1.1.Alpha2-common-armeabi-v7a-debug.apk`
<br>②为Auto.js开启**无障碍服务**和**悬浮窗权限**。
<br>③在Auto.js中新建一个脚本并粘贴以下代码并运行
```javascript
"ui";
"use strict";
@@ -42,17 +44,17 @@ emitter.on('evaluate', function(s){
```
在Auto.js版本`4.1.1 Alpha2 (461)`中测试通过,不保证其他版本的兼容性(取决于其他版本相对于此版本的API是否有`breaking changes`)
</br>Auto.js`4.1.1 Alpha2 (461)`版本下载: [`Ericwyn/Auto.js/releases@V4.1.1.Alpha2`](https://github.com/Ericwyn/Auto.js/releases/tag/V4.1.1.Alpha2)
</br>手机请下载`autoJs-V4.1.1.Alpha2-common-armeabi-v7a-debug.apk`
### 清除数据
## 清除数据
SkyAutoPlayer在使用过程中会产生本地数据存储若想全部删除请使用Auto.js执行以下代码
```
storages.remove("StageGuard:SkyAutoPlayer:Config");
files.removeDir("/storage/emulated/0/Documents/SkyAutoPlayer/");
```
## 上传乐谱
<br>
# 上传乐谱
你可以fork本仓库将你要上传的乐谱添加至`shared_sheets`文件夹,并按照以下要求在`shared_sheets.json`添加项目
```javascript
@@ -77,8 +79,9 @@ files.removeDir("/storage/emulated/0/Documents/SkyAutoPlayer/");
修改完成后,申请`Pull Request`等待merge即可。
> 请注意:在申请`Pull Request`之前请确保你的SkyAutoPlayerScript仓库已同步至最新以免出现意外问题
<br>
## 注意
# 注意
### 请仔细阅读以下使用须知!
1. 未充分测试若遇到BUG请酷安私信@StageGuard或新建Issue来反馈BUG
@@ -87,16 +90,38 @@ files.removeDir("/storage/emulated/0/Documents/SkyAutoPlayer/");
4. 脚本只能给你一时满足感而不能使你进步,请适当使用,只有真正的技术才是王道,才能使你感到快乐。
5. 本脚本只是一个"弹奏机"并不内置曲谱请在GooglePlay下载[SkyStudio](https://play.google.com/store/apps/details?id=com.Maple.SkyStudio)编谱。
## 贡献
# 贡献
欢迎任何人贡献本项目包括但不限于Pull RequestIssueNew feature request
## 图标来源
## 贡献者名单(按照首次贡献时间排序)
### SkyAutoPlayerScript
### 共享乐谱
酷安[@Aex技术总监](http://www.coolapk.com/u/1286879)<br>
酷安[@夏卡卡卡](http://www.coolapk.com/u/2313452)<br>
酷安[@深空失忆か](http://www.coolapk.com/u/3005974)<br>
抖音@子哲啊🌈(zizhe1880689503)<br>
酷安[@你们很有趣呢](http://www.coolapk.com/u/2416229)<br>
酷安[@情如风雪无常](http://www.coolapk.com/u/643670)<br>
酷安[@慕疵](http://www.coolapk.com/u/3286967)<br>
酷安[@社区最弱萌新](http://www.coolapk.com/u/3291313)<br>
酷安[@九方辰](http://www.coolapk.com/u/634078)<br>
酷安[@北极马可罗尼](http://www.coolapk.com/u/463478)<br>
酷安[@UTF16](http://www.coolapk.com/u/3751911)<br>
酷安[@]()<br>
<br>
# 图标来源
[Iconfont-阿里巴巴矢量图标库](https://www.iconfont.cn/)
<br>
## 鸣谢
# 鸣谢
[projectXero](https://gitee.com/projectXero) (提供适用于Rhino的`ListAdapter`)
<br>
## 许可证协议
# 许可证协议
```
SkyAutoPlayer (Auto.js script)
Copyright © 2020 StageGuard

View File

@@ -1 +1 @@
c45c75bad3b4ddc25595429bcfc38101865f78e3
13979f81ae3a4e415446100d56b9499592d89b8d

BIN
resources/filter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
resources/search.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@@ -1,12 +1,180 @@
{
"sheets": [{
"name": "极乐净土(和弦)",
"file": "极乐净土(和弦).txt",
"author": "酷安@Syngene",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/1093421>@Syngene<a/>分享乐谱 极乐净土(和弦)",
"bpm" : 532,
"suggested_instrument": 1,
"pitchLevel": 0
}, {
"name": "极乐净土(无和弦)",
"file": "极乐净土(无和弦).txt",
"author": "酷安@Syngene",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/1093421>@Syngene<a/>分享乐谱 极乐净土(无和弦)",
"bpm" : 532,
"suggested_instrument": 1,
"pitchLevel": 0
}, {
"name": "阿珍爱上了阿强",
"file": "阿珍爱上了阿强_UTF16.txt",
"author": "酷安@UTF16",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/3751911>@UTF16<a/>分享乐谱 阿珍爱上了阿强",
"bpm" : 197,
"suggested_instrument": 1,
"pitchLevel": 0
}, {
"name": "虫儿飞儿歌",
"file": "虫儿飞儿歌_UTF16.txt",
"author": "酷安@UTF16",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/3751911>@UTF16<a/>分享乐谱 虫儿飞儿歌",
"bpm" : 240,
"suggested_instrument": 1,
"pitchLevel": 0
}, {
"name": "辞乆门回忆",
"file": "辞乆门回忆_UTF16.txt",
"author": "酷安@UTF16",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/3751911>@UTF16<a/>分享乐谱 辞乆门回忆",
"bpm" : 270,
"suggested_instrument": 1,
"pitchLevel": 0
}, {
"name": "打上花火",
"file": "打上花火_UTF16.txt",
"author": "酷安@UTF16",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/3751911>@UTF16<a/>分享乐谱 打上花火",
"bpm" : 300,
"suggested_instrument": 1,
"pitchLevel": 0
}, {
"name": "大悲咒",
"file": "大悲咒_UTF16.txt",
"author": "酷安@UTF16",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/3751911>@UTF16<a/>分享乐谱 大悲咒",
"bpm" : 230,
"suggested_instrument": 1,
"pitchLevel": 0
}, {
"name": "好运来HX",
"file": "好运来HX_UTF16.txt",
"author": "酷安@UTF16",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/3751911>@UTF16<a/>分享乐谱 好运来HX",
"bpm" : 240,
"suggested_instrument": 1,
"pitchLevel": 0
}, {
"name": "幻昼CH",
"file": "幻昼CH_UTF16.txt",
"author": "酷安@UTF16",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/3751911>@UTF16<a/>分享乐谱 幻昼CH",
"bpm" : 200,
"suggested_instrument": 1,
"pitchLevel": 0
}, {
"name": "偏爱",
"file": "偏爱_UTF16.txt",
"author": "酷安@UTF16",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/3751911>@UTF16<a/>分享乐谱 偏爱",
"bpm" : 220,
"suggested_instrument": 1,
"pitchLevel": 0
}, {
"name": "四月是你的谎言",
"file": "四月是你的谎言_UTF16.txt",
"author": "酷安@UTF16",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/3751911>@UTF16<a/>分享乐谱 四月是你的谎言",
"bpm" : 240,
"suggested_instrument": 1,
"pitchLevel": 0
}, {
"name": "误红装A1",
"file": "误红装A1_UTF16.txt",
"author": "酷安@UTF16",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/3751911>@UTF16<a/>分享乐谱 误红装A1",
"bpm" : 200,
"suggested_instrument": 1,
"pitchLevel": 0
}, {
"name": "夏天的风",
"file": "夏天的风_UTF16.txt",
"author": "酷安@UTF16",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/3751911>@UTF16<a/>分享乐谱 夏天的风",
"bpm" : 220,
"suggested_instrument": 1,
"pitchLevel": 0
}, {
"name": "夏天的风GF",
"file": "夏天的风GF_UTF16.txt",
"author": "酷安@UTF16",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/3751911>@UTF16<a/>分享乐谱 夏天的风GF",
"bpm" : 220,
"suggested_instrument": 1,
"pitchLevel": 0
}, {
"name": "小星星",
"file": "小星星_UTF16.txt",
"author": "酷安@UTF16",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/3751911>@UTF16<a/>分享乐谱 小星星",
"bpm" : 240,
"suggested_instrument": 1,
"pitchLevel": 0
}, {
"name": "心作",
"file": "心作_UTF16.txt",
"author": "酷安@UTF16",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/3751911>@UTF16<a/>分享乐谱 心作",
"bpm" : 240,
"suggested_instrument": 1,
"pitchLevel": 0
}, {
"name": "雨林",
"file": "雨林_UTF16.txt",
"author": "酷安@UTF16",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/3751911>@UTF16<a/>分享乐谱 雨林",
"bpm" : 249,
"suggested_instrument": 1,
"pitchLevel": 0
}, {
"name": "猪猪侠",
"file": "猪猪侠_UTF16.txt",
"author": "酷安@UTF16",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/3751911>@UTF16<a/>分享乐谱 猪猪侠",
"bpm" : 280,
"suggested_instrument": 1,
"pitchLevel": 0
}, {
"name": "もペもぺmopemope",
"file": "もペもぺmopemope.txt",
"author": "酷安@夏卡卡卡",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/2313452>@夏卡卡卡<a/>分享乐谱 もペもぺmopemope\n一首音游玩家熟悉的、好听的儿歌(并不)\n非完整版",
"bpm" : 400,
"suggested_instrument": 1,
"pitchLevel": 7
}, {
"name": "[IPhone]马林巴琴",
"file": "IPhone马林巴琴.txt",
"author": "酷安@夏卡卡卡",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/2313452>@夏卡卡卡<a/>分享乐谱 [IPhone]马林巴琴",
"bpm" : 660,
"suggested_instrument": 1,
"pitchLevel": 0
}, {
"name": "穿越时空的思念",
"file": "穿越时空的思念.txt",
"author": "酷安@北极马可罗尼",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/463478>@北极马可罗尼<a/>分享乐谱 穿越时空的思念",
"bpm" : 160,
"suggested_instrument": 1,
"pitchLevel": 0
}, {
"name": "不染",
"file": "不染_enhanced.txt",
"author": "酷安@九方辰",
"desc": "酷安酷友<a href=http://www.coolapk.com/u/634078>酷安@九方辰<a/>分享乐谱 不染\n原作者为 抖音用户@子哲啊🌈(zizhe1880689503) \n 完善后续,修改了杂音",
"bpm" : 720,
"bpm" : 150,
"suggested_instrument": 1,
"pitchLevel": 7
"pitchLevel": 0
}, {
"name": "Souvevirs d'Enfance\n童年的回忆",
"file": "Souvevirs_d'Enfance.txt",

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -80,6 +80,14 @@ sheetmgr = {
return this.cachedOnlineSharedSheetInfoList;
},
filterOnlineSharedSheet: function(filterBlock) {
var resultList = [];
this.getOnlineSharedSheetInfoList().map(function(element, index) {
if(filterBlock(element)) resultList.push(element);
});
return resultList;
},
downloadAndLoad: function(file, author, listener) {
listener({status:1});
config.fetchRepoFile("shared_sheets/" + file, null, function(body) {
@@ -244,17 +252,11 @@ sheetplayer = {
play: function(listener) {
if(this.playing == true) return;
this.playing = true;
this.thread = threads.start(function() {
while(
sheetplayer.playing && sheetplayer.currentNote < sheetplayer.noteCount
) {
if((sheetplayer.currentNote + 1) == sheetplayer.noteCount) {
sheetplayer.nextInterval = sheetplayer.notes[sheetplayer.currentNote].time - sheetplayer.notes[sheetplayer.currentNote - 1].time;
} else {
sheetplayer.nextInterval = sheetplayer.notes[sheetplayer.currentNote + 1].time - sheetplayer.notes[sheetplayer.currentNote].time;
}
threads.start(function() {
this.thread = threads.start(function() {
var executor = java.util.concurrent.Executors.newCachedThreadPool();
var tragetRunnable = new java.lang.Runnable({
run: function() {
var gestureMap = [];
sheetplayer.notes[sheetplayer.currentNote].keys.map(function(e, i) {
gestureMap.push([
@@ -265,7 +267,15 @@ sheetplayer = {
});
gestureMap = sheetplayer.toSource(gestureMap);
eval("gestures(" + gestureMap.slice(1, gestureMap.length - 1) + ");");
}
});
while(sheetplayer.playing && sheetplayer.currentNote < sheetplayer.noteCount) {
if((sheetplayer.currentNote + 1) == sheetplayer.noteCount) {
sheetplayer.nextInterval = sheetplayer.notes[sheetplayer.currentNote].time - sheetplayer.notes[sheetplayer.currentNote - 1].time;
} else {
sheetplayer.nextInterval = sheetplayer.notes[sheetplayer.currentNote + 1].time - sheetplayer.notes[sheetplayer.currentNote].time;
}
executor.execute(tragetRunnable);
if(listener != null) listener();
java.lang.Thread.sleep(sheetplayer.nextInterval = Math.round(sheetplayer.nextInterval * sheetplayer.speed));
sheetplayer.currentNote ++;
@@ -341,7 +351,7 @@ config = {
skipImportLocalSheetTip: false,
showFailedSheets: true,
tipOnAndroidR: true,
currentVersion: 12,
currentVersion: 14,
gitVersion: "",
},
@@ -397,7 +407,7 @@ config = {
fetchResources: function(listener) {
var remoteHost = "https://cdn.jsdelivr.net/gh/StageGuard/SkyAutoPlayerScript@" + this.values.gitVersion + "/resources/";
var resourceList = ["local.png", "online.png", "play.png", "pause.png", "refresh.png", "settings.png", "info.png", "download.png", "bin.png", "speedup.png"];
var resourceList = ["local.png", "online.png", "play.png", "pause.png", "refresh.png", "settings.png", "info.png", "download.png", "bin.png", "speedup.png", "search.png"/*, "filter.png"*/];
var localRootDir = android.os.Environment.getExternalStorageDirectory() + "/Documents/SkyAutoPlayer/bitmaps/";
var downloadQueue = [];
var tryCount = 1;
@@ -1029,12 +1039,14 @@ gui = {
_global_title: null,
_global_navigation_bar: null,
_global_close: null,
_glonal_func: null,
_global_statusbar: null,
_glonal_func: [],
isShowing: false,
current_navigation_selection: NaN,
func_showing: false,
current: 0,
currentPageChangeListener: null,
cx: dp * 10,
cy: dp * 10,
@@ -1100,8 +1112,10 @@ gui = {
if(gui.main.views[i].index == index) {
gui.main.views[i].func_clickable = clickable;
if(gui.main.current == index && gui.main.isShowing) {
gui.main._glonal_func.setEnabled(clickable);
gui.main._glonal_func.setClickable(clickable);
for(var i in gui.main._glonal_func) {
gui.main._glonal_func[i].setEnabled(clickable);
gui.main._glonal_func[i].setClickable(clickable);
}
}
}
}
@@ -1118,10 +1132,10 @@ gui = {
gui.main._global_base.setLayoutParams(new android.widget.LinearLayout.LayoutParams(dp * gui.main.window_width, dp * gui.main.window_height));
gui.main._global_base.setBackgroundColor(gui.config.colors.background);
s.statusBar = new android.widget.RelativeLayout(ctx);
s.statusBar.setLayoutParams(new android.widget.RelativeLayout.LayoutParams(-1, dp * gui.main.status_bar_height));
s.statusBar.setBackgroundColor(gui.config.colors.background);
s.statusBar.setElevation(10 * dp);
gui.main._global_statusbar = new android.widget.RelativeLayout(ctx);
gui.main._global_statusbar.setLayoutParams(new android.widget.RelativeLayout.LayoutParams(-1, dp * gui.main.status_bar_height));
gui.main._global_statusbar.setBackgroundColor(gui.config.colors.background);
gui.main._global_statusbar.setElevation(10 * dp);
gui.main._global_title = new android.widget.TextView(ctx);
gui.main._global_title.setGravity(android.view.Gravity.LEFT | android.view.Gravity.CENTER);
@@ -1151,7 +1165,7 @@ gui = {
return true;
},
}));
s.statusBar.addView(gui.main._global_title);
gui.main._global_statusbar.addView(gui.main._global_title);
gui.main._global_close = new android.widget.TextView(ctx);
gui.main._global_close.setId(23);
@@ -1169,17 +1183,10 @@ gui = {
gui.suspension.show();
}
}));
gui.main._glonal_func = new android.widget.ImageView(ctx);
gui.main._glonal_func.setLayoutParams(new android.widget.RelativeLayout.LayoutParams(dp * gui.main.status_bar_height, dp * gui.main.status_bar_height));
gui.main._glonal_func.setPadding(dp * 1, dp * 1, dp * 1, dp * 1);
gui.main._glonal_func.getLayoutParams().addRule(android.widget.RelativeLayout.LEFT_OF, 23);
gui.main._glonal_func.measure(0, 0);
gui.main._glonal_func.setBackgroundDrawable(gui.utils.ripple_drawable(gui.main._glonal_func.getMeasuredWidth(), gui.main._glonal_func.getMeasuredHeight(), "rect"));
gui.main._glonal_func.setPadding(dp * 5, dp * 5, dp * 5, dp * 5);
s.statusBar.addView(gui.main._glonal_func);
s.statusBar.addView(gui.main._global_close);
gui.main._global_base.addView(s.statusBar);
gui.main._global_statusbar.addView(gui.main._global_close);
gui.main._global_base.addView(gui.main._global_statusbar);
gui.main._global_content_container = new android.widget.RelativeLayout(ctx);
gui.main._global_content_container.setLayoutParams(new android.widget.LinearLayout.LayoutParams(-1, dp * (gui.main.window_height - gui.main.status_bar_height - gui.main.navigation_bar_height)));
@@ -1209,25 +1216,14 @@ gui = {
gui.main._global_navigation_bar.setLayoutParams(new android.widget.LinearLayout.LayoutParams(-1, dp * (gui.main.navigation_bar_height + gui.main.navigation_bar_updown_margin * 2)));
gui.main._global_navigation_bar.setBackgroundColor(gui.config.colors.background);
gui.main.__internal_genNavigationList(s);
gui.main.__internal_genNavigationList(s, content);
gui.main._global_base.addView(gui.main._global_navigation_bar);
//ui.setContentView(gui.main._global_base);
/*gui.main._global_main_popup = new android.widget.PopupWindow(ctx);
gui.main._global_main_popup.setWindowLayoutType(android.os.Build.VERSION.SDK_INT >= 26 ? android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY : android.view.WindowManager.LayoutParams.TYPE_PHONE);
gui.main._global_main_popup.setFocusable(false);
gui.main._global_main_popup.setOutsideTouchable(false);
gui.main._global_main_popup.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(0));
gui.main._global_main_popup.setContentView(gui.main._global_base);
gui.main._global_main_popup.setWidth(gui.main.window_width * dp);
gui.main._global_main_popup.setHeight((gui.main.window_height + gui.main.navigation_bar_updown_margin * 2) * dp);
gui.main._global_main_popup.showAtLocation(ctx.getWindow().getDecorView(), 0, s.x = gui.main.cx, s.y = gui.main.cy);*/
s._winParams = new android.view.WindowManager.LayoutParams();
s._winParams.type = android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
s._winParams.flags = android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
s._winParams.format = android.graphics.PixelFormat.TRANSLUCENT;
s._winParams.softInputMode = android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE;
s._winParams.width = gui.main.window_width * dp;
s._winParams.height = (gui.main.window_height + gui.main.navigation_bar_updown_margin * 2) * dp;
s._winParams.x = s.x = gui.main.cx;
@@ -1272,16 +1268,18 @@ gui = {
gui.main._global_content_container.findViewById(cid).findViewById(15).setAlpha(1.0 - anim.getAnimatedValue());
gui.main._global_content_container.findViewById(tid).findViewById(15).setAlpha(anim.getAnimatedValue());
if(anim.getAnimatedValue() == 1.0) {
gui.main._global_content_container.findViewById(cid).findViewById(15).setEnabled(false);
gui.main._global_content_container.findViewById(cid).findViewById(15).setClickable(false);
gui.main._global_content_container.findViewById(cid).setEnabled(false);
gui.main._global_content_container.findViewById(cid).setClickable(false); //飞了
gui.main._global_content_container.findViewById(cid).setZ(0);
gui.main._global_content_container.findViewById(tid).findViewById(15).setEnabled(true);
gui.main._global_content_container.findViewById(tid).findViewById(15).setClickable(true);
gui.main._global_content_container.findViewById(tid).setEnabled(true);
gui.main._global_content_container.findViewById(tid).setClickable(true);
gui.main._global_content_container.findViewById(tid).setZ(1); //回来
var previousContainer = gui.main._global_content_container.findViewById(cid);
previousContainer.findViewById(15).setEnabled(false);
previousContainer.findViewById(15).setClickable(false);
previousContainer.setEnabled(false);
previousContainer.setClickable(false);
previousContainer.setZ(0);
var targetContainer = gui.main._global_content_container.findViewById(tid);
targetContainer.findViewById(15).setEnabled(true);
targetContainer.findViewById(15).setClickable(true);
targetContainer.setEnabled(true);
targetContainer.setClickable(true);
targetContainer.setZ(1);
if(gui.main.views[tid].update != null && anim.getAnimatedValue() == 1.0) gui.main.views[tid].update(s);
}
});
@@ -1289,53 +1287,53 @@ gui = {
gui.main._global_title.setAlpha(anim.getAnimatedValue());
});
gui.main.currentPageChangeListener = content.onPageChanged;
gui.main.__internal_changeNavigationStatus(s, content);
}
gui.main.__internal_changeNavigationStatus(s.index);
}
if(gui.main.views[s.index].func == null) {
if(gui.main.views[s.index].func == null || !gui.main.views[s.index].func.length) {
if(gui.main.func_showing) {
//no extra func and previous page has func
gui.main.func_showing = false;
gui.utils.value_animation("Float", 0, 1, 300 , new android.view.animation.DecelerateInterpolator(), function(anim) {
gui.main._glonal_func.setTranslationX(anim.getAnimatedValue() * gui.main._glonal_func.getMeasuredWidth());
gui.main._glonal_func.setAlpha(1 - anim.getAnimatedValue());
if(anim.getAnimatedValue() == 1.0) {
gui.main._glonal_func.setClickable(false);
gui.main._glonal_func.setEnabled(false);
gui.main._glonal_func.setOnClickListener(new android.view.View.OnClickListener({
onClick: function() {}
}));
gui.main._glonal_func.setImageBitmap(android.graphics.Bitmap.createBitmap(1, 1, android.graphics.Bitmap.Config.ARGB_8888));
}
});
}
} else {
if(gui.main.func_showing) {
gui.main._glonal_func.setOnClickListener(new android.view.View.OnClickListener({
onClick: function() {gui.main.views[s.index].func(s)}
}));
gui.main._glonal_func.setImageBitmap(gui.main.views[s.index].func_icon);
gui.utils.value_animation("Float", 0, 1, 200 , new android.view.animation.DecelerateInterpolator(), function(anim) {
gui.main._glonal_func.setAlpha(anim.getAnimatedValue());
});
} else {
gui.main.func_showing = true;
gui.main._glonal_func.setClickable(true);
gui.main._glonal_func.setEnabled(true);
gui.main._glonal_func.setOnClickListener(new android.view.View.OnClickListener({
onClick: function() {gui.main.views[s.index].func(s)}
}));
gui.main._glonal_func.setImageBitmap(gui.main.views[s.index].func_icon);
gui.utils.value_animation("Float", 1, 0, 300 , new android.view.animation.DecelerateInterpolator(), function(anim) {
gui.main._glonal_func.setTranslationX(anim.getAnimatedValue() * gui.main._glonal_func.getMeasuredWidth());
gui.main._glonal_func.setAlpha(1 - anim.getAnimatedValue());
for(var i in gui.main._glonal_func) {
gui.main._glonal_func[i].setAlpha(1 - anim.getAnimatedValue());
if(anim.getAnimatedValue() == 1.0) {
gui.main._global_statusbar.removeView(gui.main._glonal_func[i]);
}
}
});
}
} else {
for(var i in gui.main._glonal_func) gui.main._global_statusbar.removeView(gui.main._glonal_func[i]);
gui.main.func_showing = true;
s.baseFuncIndex = gui.main._global_close.getId();
for(var i in content.func) {
var view = new android.widget.ImageView(ctx);
view.setId(++s.baseFuncIndex);
view.setLayoutParams(new android.widget.RelativeLayout.LayoutParams(dp * gui.main.status_bar_height, dp * gui.main.status_bar_height));
view.setPadding(dp * 1, dp * 1, dp * 1, dp * 1);
view.getLayoutParams().addRule(android.widget.RelativeLayout.LEFT_OF, s.baseFuncIndex - 1);
view.measure(0, 0);
view.setBackgroundDrawable(gui.utils.ripple_drawable(view.getMeasuredWidth(), view.getMeasuredHeight(), "rect"));
view.setPadding(dp * 5, dp * 5, dp * 5, dp * 5);
view.setAlpha(0);
view.setImageBitmap(content.func[i].icon);
view.setOnClickListener(new android.view.View.OnClickListener({
onClick: function(view) {content.func[view.getId() - (gui.main._global_close.getId() + 1)].onClick(s, content)}
}));
gui.main._global_statusbar.addView(view);
gui.main._glonal_func.push(view);
}
gui.utils.value_animation("Float", 0, 1, 200 , new android.view.animation.DecelerateInterpolator(), function(anim) {
for(var i in gui.main._glonal_func) {
gui.main._glonal_func[i].setAlpha(anim.getAnimatedValue());
}
});
}
gui.main.current_navigation_selection = s.index;
gui.main._glonal_func.setClickable(content.func_clickable);
gui.main._glonal_func.setEnabled(content.func_clickable);
})},
__internal_genNavigationList: function(s) { gui.run(function(){
__internal_genNavigationList: function(s, content) { gui.run(function(){
if(gui.main._global_navigation_bar == null) return;
s.__2x_navigation_padding = (gui.main.window_width - gui.main.views.length * gui.main.navigation_bar_height) / (gui.main.views.length);
for(var i in gui.main.views) {
@@ -1351,10 +1349,11 @@ gui = {
default: s["navigationBtn" + i].getLayoutParams().setMargins(s.__2x_navigation_padding / 2, dp * gui.main.navigation_bar_updown_margin, s.__2x_navigation_padding / 2, dp * gui.main.navigation_bar_updown_margin); break;
}
s["navigationBtn" + i].setOnClickListener(new android.view.View.OnClickListener({
onClick: function(view) {
onClick: function(view) { if(gui.main.current_navigation_selection != Number(view.getId())) {
if(typeof(gui.main.currentPageChangeListener) == "function") gui.main.currentPageChangeListener(s, content);
gui.main.__internal_show(gui.main.views[Number(view.getId())]);
gui.main.current_navigation_selection = Number(view.getId());
}
}}
}));
s["navigationBtnText" + i] = new android.widget.TextView(ctx);
@@ -1381,11 +1380,11 @@ gui = {
gui.main._global_navigation_bar.addView(s["navigationBtn" + i]);
}
})},
__internal_changeNavigationStatus: function(index) { gui.run(function(){
__internal_changeNavigationStatus: function(s, content) { gui.run(function(){
if(gui.main._global_navigation_bar == null) return;
if(!/^android/.test(String(gui.main._global_navigation_bar.findViewById(index)))) return;
if(gui.main.current_navigation_selection == index) return;
var colorAnim = android.animation.ObjectAnimator.ofInt(gui.main._global_navigation_bar.findViewById(index).findViewById(12), "textColor", gui.config.colors.sec_text, gui.config.colors.text);
if(!/^android/.test(String(gui.main._global_navigation_bar.findViewById(s.index)))) return;
if(gui.main.current_navigation_selection == s.index) return;
var colorAnim = android.animation.ObjectAnimator.ofInt(gui.main._global_navigation_bar.findViewById(s.index).findViewById(12), "textColor", gui.config.colors.sec_text, gui.config.colors.text);
colorAnim.setDuration(300);
colorAnim.setEvaluator(new android.animation.ArgbEvaluator());
colorAnim.start();
@@ -1393,7 +1392,18 @@ gui = {
colorAnim.setDuration(300);
colorAnim.setEvaluator(new android.animation.ArgbEvaluator());
colorAnim.start();
gui.main.current_navigation_selection = index;
for(var i in gui.main.views) {
s["navigationBtn" + i].setOnClickListener(new android.view.View.OnClickListener({
onClick: function(view) { if(gui.main.current_navigation_selection != Number(view.getId())) {
if(typeof(gui.main.currentPageChangeListener) == "function") gui.main.currentPageChangeListener(s, content);
gui.main.__internal_show(gui.main.views[Number(view.getId())]);
gui.main.current_navigation_selection = Number(view.getId());
}}
}));
}
gui.main.current_navigation_selection = s.index;
})},
__internal_rmNavigationList: function() { gui.run(function(){
@@ -1918,7 +1928,7 @@ gui = {
}
});},
refreshStatus: function() { gui.run(function(){
gui.player_panel._global_status.setText(String(sheetplayer.playing ? (sheetplayer.speed_list[sheetplayer.current_speed_index] + "x: " + Number(sheetplayer.currentNote + 1) + "/" + sheetplayer.noteCount + " -> " + sheetplayer.nextInterval + "ms") : (sheetplayer.thread == null ? "Idle" : "Paused")));
gui.player_panel._global_status.setText(String(sheetplayer.speed_list[sheetplayer.current_speed_index] + "x: " + (sheetplayer.playing ? (Number(sheetplayer.currentNote + 1) + "/" + sheetplayer.noteCount + " -> " + sheetplayer.nextInterval + "ms") : (sheetplayer.thread == null ? "Idle" : "Paused"))));
gui.player_panel._global_cnote.setText(String(sheetplayer.playing ? (sheetplayer.notes[sheetplayer.currentNote < sheetplayer.noteCount ? sheetplayer.currentNote : sheetplayer.noteCount - 1].keys) : "-"));
gui.player_panel._global_seek.setProgress(sheetplayer.currentNote);
gui.utils.value_animation("Float", 0, 1, 80 , new android.view.animation.LinearInterpolator(), function(anim) {
@@ -2001,10 +2011,12 @@ gui.dialogs.showProgressDialog(function(o) {
title: "本地乐谱",
navigation_title: "本地乐谱",
navigation_icon: config.bitmaps.local,
func: function(s) {
this.getSheetList(s, true);
func: [{
icon: android.graphics.Bitmap.createBitmap(config.bitmaps.refresh),
onClick: function(s, selfContent) {
selfContent.getSheetList(s, true);
},
func_icon: android.graphics.Bitmap.createBitmap(config.bitmaps.refresh),
}],
view: function(s) {
s.ns0_rl = new android.widget.RelativeLayout(ctx);
s.ns0_rl.setLayoutParams(new android.widget.LinearLayout.LayoutParams(-1, s._content_height));
@@ -2312,10 +2324,27 @@ gui.dialogs.showProgressDialog(function(o) {
title: "共享乐谱",
navigation_title: "共享乐谱",
navigation_icon: config.bitmaps.online,
func: function(s) {
this.getOnlineSheetList(s, true);
func: [{
icon: android.graphics.Bitmap.createBitmap(config.bitmaps.refresh),
onClick: function(s, selfContent) {
if(s.ns1_isShowingSearchEditTextView) selfContent.removeSearchEditTextView(s, selfContent);
selfContent.getOnlineSheetList(s, true);
},
func_icon: android.graphics.Bitmap.createBitmap(config.bitmaps.refresh),
},/* {
icon: android.graphics.Bitmap.createBitmap(config.bitmaps.filter),
onClick: function(s, selfContent) {
toast("Click filter")
},
},*/ {
icon: android.graphics.Bitmap.createBitmap(config.bitmaps.search),
onClick: function(s, selfContent) {
if(s.ns1_isShowingSearchEditTextView) {
selfContent.removeSearchEditTextView(s, selfContent);
} else {
selfContent.showSearchEditTextView(s, selfContent);
}
},
}],
view: function(s) {
s.ns1_rl = new android.widget.RelativeLayout(ctx);
@@ -2330,7 +2359,9 @@ gui.dialogs.showProgressDialog(function(o) {
element.isShowingStatusBar = false;
if(element.type == -1) {
switch(element.type) {
//top notification
case -1: {
element.v_info = new android.widget.ImageView(ctx);
element.v_info.setId(10);
element.v_info.setScaleType(android.widget.ImageView.ScaleType.CENTER_CROP);
@@ -2351,9 +2382,12 @@ gui.dialogs.showProgressDialog(function(o) {
element.v_upload.setTextColor(gui.config.colors.sec_text);
element.v_upload.setText(element.title);
element.v_relative.addView(element.v_upload);
return element.v_relative;
}
};break;
case -2: {
//empty result view
};break;
default: {
//sheet item
element.v_title = new android.widget.TextView(ctx);
element.v_title.setId(10);
element.v_title.setGravity(android.view.Gravity.LEFT | android.view.Gravity.CENTER);
@@ -2479,7 +2513,8 @@ gui.dialogs.showProgressDialog(function(o) {
element.v_progress.setProgressDrawable(new android.graphics.drawable.ColorDrawable(gui.config.colors.background));
element.v_progress.setIndeterminate(false);
element.v_progress.setAlpha(0);
};break;
}
return element.v_relative;
}));
s.ns1_listAdapterController = RhinoListAdapter.getController(s.ns1_listAdapter);
@@ -2488,7 +2523,8 @@ gui.dialogs.showProgressDialog(function(o) {
s.ns1_listView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener({
onItemClick: function(parent, view, pos, id) {
var item = s.ns1_listAdapterController.get(pos);
if(item.type == -1) {
switch(item.type) {
case -1: {
switch(item.index) {
case 0: {
gui.dialogs.showConfirmDialog({
@@ -2536,8 +2572,11 @@ gui.dialogs.showProgressDialog(function(o) {
break;
}
}
return true;
}
};break;
case -2: {
};break;
default: {
gui.dialogs.showDialog((function () {
var scr = new android.widget.ScrollView(ctx);
scr.setBackgroundColor(gui.config.colors.background);
@@ -2596,6 +2635,9 @@ gui.dialogs.showProgressDialog(function(o) {
scr.addView(layout)
return scr;
}()), -2, -2, null, true);
}break;
}
return true;
}
}));
s.ns1_rl.addView(s.ns1_listView);
@@ -2613,16 +2655,84 @@ gui.dialogs.showProgressDialog(function(o) {
s.ns1_rl.addView(s.ns1_progress);
return s.ns1_rl;
},
onPageChanged: function(s, selfContent) {
if(s.ns1_isShowingSearchEditTextView) selfContent.removeSearchEditTextView(s);
},
showSearchEditTextView: function(s, selfContent) {
gui.main.setFuncClickable(s.index, false);
s.ns1_isShowingSearchEditTextView = true;
s.ns1_searchEditText = new android.widget.EditText(ctx);
s.ns1_searchEditText.setGravity(android.view.Gravity.LEFT | android.view.Gravity.CENTER);
s.ns1_searchEditText.setLayoutParams(new android.widget.RelativeLayout.LayoutParams(-2, -1));
s.ns1_searchEditText.setPadding(dp * 5, dp * 5, dp * 5, dp * 5);
s.ns1_searchEditText.getLayoutParams().addRule(android.widget.RelativeLayout.ALIGN_PARENT_LEFT);
s.ns1_searchEditText.setTextSize(15);
s.ns1_searchEditText.setTextColor(gui.config.colors.text);
s.ns1_searchEditText.setHintTextColor(gui.config.colors.sec_text);
s.ns1_searchEditText.setHint("按回车开始搜索");
s.ns1_searchEditText.setAlpha(0);
s.ns1_searchEditText.setOnClickListener(new android.view.View.OnClickListener({
onClick: function(view) {
view.setFocusable(true);
view.setFocusableInTouchMode(true);
view.requestFocus();
ctx.getSystemService(android.content.Context.INPUT_METHOD_SERVICE).showSoftInput(view, 0);
}
}));
s.ns1_searchEditText.setOnKeyListener(new android.view.View.OnKeyListener({
onKey: function(view, keycode, event) {
if (keycode == android.view.KeyEvent.KEYCODE_ENTER && event.getAction() == android.view.KeyEvent.ACTION_DOWN) {
selfContent.getOnlineSheetList(s, false, function(item) {
return (new RegExp(view.getText(), "gi")).test(item.name);
});
return true;
}
return false;
},
}));
gui.main._global_statusbar.addView(s.ns1_searchEditText);
s.ns1_searchEditText.setFocusable(true);
s.ns1_searchEditText.setFocusableInTouchMode(true);
s.ns1_searchEditText.requestFocus();
ctx.getSystemService(android.content.Context.INPUT_METHOD_SERVICE).showSoftInput(s.ns1_searchEditText, 0);
gui.main._global_title.setEnabled(false);
gui.main._global_title.setClickable(false);
gui.utils.value_animation("Float", 0, 1.0, 300 , new android.view.animation.DecelerateInterpolator(), function(anim) {
s.ns1_searchEditText.setAlpha(anim.getAnimatedValue());
gui.main._global_title.setAlpha(1.0 - anim.getAnimatedValue());
if(anim.getAnimatedValue() == 1.0) gui.main.setFuncClickable(s.index, true);
});
},
removeSearchEditTextView: function(s, selfContent) { try {
s.ns1_isShowingSearchEditTextView = false;
gui.main.setFuncClickable(s.index, false);
s.ns1_searchEditText.setEnabled(false);
s.ns1_searchEditText.setClickable(false);
gui.main._global_title.setEnabled(true);
gui.main._global_title.setClickable(true);
gui.utils.value_animation("Float", 0, 1.0, 300 , new android.view.animation.DecelerateInterpolator(), function(anim) {
s.ns1_searchEditText.setAlpha(1.0 - anim.getAnimatedValue());
gui.main._global_title.setAlpha(anim.getAnimatedValue());
if(anim.getAnimatedValue() == 1.0) {
gui.main._global_statusbar.removeView(s.ns1_searchEditText);
gui.main.setFuncClickable(s.index, true);
}
});
} catch (e) {}},
update: function(s) {
if(s.initial) this.getOnlineSheetList(s, false);
},
getOnlineSheetList: function(s, isForce) {
getOnlineSheetList: function(s, isForce, filterBlock) {
gui.run(function() {
gui.main.setFuncClickable(s.index, false);
s.ns1_progress.setIndeterminate(true);
s.ns1_listAdapterController.removeAll();
s.ns1_listAdapterController.notifyChange();
gui.utils.value_animation("Float", 0, 1.0, 200, new android.view.animation.DecelerateInterpolator(), function(anim) {
if(typeof(filterBlock) != "function") gui.utils.value_animation("Float", 0, 1.0, 200, new android.view.animation.DecelerateInterpolator(), function(anim) {
gui.main._global_title.setAlpha(anim.getAnimatedValue());
});
gui.utils.value_animation("Float", 1.0, 0, 100, new android.view.animation.DecelerateInterpolator(), function(anim) {
@@ -2643,7 +2753,13 @@ gui.dialogs.showProgressDialog(function(o) {
s.ns1_listView.setAlpha(1);
gui.main._global_title.setText("获取列表中...");
threads.start(function() {
sheetmgr.getOnlineSharedSheetInfoList(isForce).map(function(e, i) {
var list = [];
if(typeof(filterBlock) == "function") {
list = sheetmgr.filterOnlineSharedSheet(filterBlock);
} else {
list = sheetmgr.getOnlineSharedSheetInfoList(isForce);
}
list.map(function(e, i) {
gui.run(function() { s.ns1_listAdapterController.add(e); });
});
gui.run(function() {
@@ -2651,11 +2767,13 @@ gui.dialogs.showProgressDialog(function(o) {
s.ns1_listAdapterController.notifyChange();
gui.main._global_title.setText(gui.main.getPageInfo(s.index).title);
gui.utils.value_animation("Float", 0, 1.0, 200, new android.view.animation.DecelerateInterpolator(), function(anim) {
gui.main._global_title.setAlpha(anim.getAnimatedValue());
s.ns1_listView.setAlpha(anim.getAnimatedValue());
s.ns1_progress.setAlpha(1 - anim.getAnimatedValue());
if(anim.getAnimatedValue() == 1.0) s.ns1_progress.setIndeterminate(false);
});
if(typeof(filterBlock) != "function") gui.utils.value_animation("Float", 0, 1.0, 200, new android.view.animation.DecelerateInterpolator(), function(anim) {
gui.main._global_title.setAlpha(anim.getAnimatedValue());
});
});
});
}
@@ -2696,8 +2814,10 @@ gui.dialogs.showProgressDialog(function(o) {
onClick: function(checked) {
config.values.tipOnAndroidR = config.save("tip_storage_on_android_r", checked);
}
},
{
}, {
type: "tag",
name: "关于",
}, {
type: "default",
name: "查看使用须知",
onClick: function(v) {
@@ -2819,7 +2939,7 @@ gui.dialogs.showProgressDialog(function(o) {
});
gui.suspension.show();
o.close();
ctx.moveTaskToBack(true);
//ctx.moveTaskToBack(true);
if(!config.values.skipRunScriptTip) {
gui.dialogs.showConfirmDialog({
title: "使用须知",

View File

@@ -1,3 +1,15 @@
版本: 14
更新时间: 2020.09.03 20:51
更新内容:
* 新增:共享乐谱支持搜索功能
* 改善:窗口拓展功能
版本: 13
更新时间: 2020.09.05 10:46
更新内容:
* 改善使用ThreadPool实现线程循环而不是持续创建新的线程
* 改善在Idle和Paused状态时也能显示当前倍速
版本: 12
更新时间: 2020.09.01 23:12
更新内容: