-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1112 from aiselp/setup-v7
一些更新
- Loading branch information
Showing
71 changed files
with
1,642 additions
and
333 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { loadClass, java } from 'java' | ||
|
||
const File = loadClass('java.io.File') | ||
|
||
const a = new File('/sdcard') | ||
const b = new java.io.File('/sdcard') | ||
|
||
console.log(a.isFile()); | ||
console.log(b.isFile()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { showAlertDialog } from 'dialogs' | ||
|
||
await showAlertDialog("AlertDialog", { | ||
content: "对话框内容" | ||
}) | ||
|
||
|
||
await showAlertDialog("提示", { | ||
content: "不可通过点击返回键和点击外部取消的对话框", | ||
dismissOnBackPress: false, | ||
dismissOnClickOutside: false, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { showConfirmDialog } from 'dialogs' | ||
import { showToast } from 'toast' | ||
|
||
const cilik = await showConfirmDialog("提示", { | ||
content: "对话框内容" | ||
}) | ||
|
||
showToast('你点击了:' + (cilik ? '确认' : '取消')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { showInputDialog } from 'dialogs' | ||
import { showToast } from 'toast' | ||
|
||
const input = await showInputDialog("请输入一些内容") | ||
|
||
showToast('你输入了:' + input) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { showMultiChoiceDialog } from 'dialogs' | ||
import { showToast } from 'toast' | ||
|
||
|
||
const select = await showMultiChoiceDialog("标题", ['item1', 'item2', 'item3']) | ||
|
||
showToast('你选择了:' + select) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { showSelectDialog } from 'dialogs' | ||
import { showToast } from 'toast' | ||
|
||
|
||
const select = await showSelectDialog("标题", ['item1', 'item2', 'item3']) | ||
|
||
showToast('你选择了:' + select) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { showSingleChoiceDialog } from 'dialogs' | ||
import { showToast } from 'toast' | ||
|
||
|
||
const select = await showSingleChoiceDialog("标题", ['item1', 'item2', 'item3']) | ||
|
||
showToast('你选择了:' + select) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { showAlertDialog, DialogFactory } from 'dialogs' | ||
import { | ||
createApp, xml, startActivity, Icons, defineComponent, ModifierExtension | ||
} from "vue-ui"; | ||
import { showToast } from 'toast' | ||
|
||
/** | ||
* 如果有ui界面,建议使用以下方法创建对话框,拥有更好的交互效果 | ||
*/ | ||
const factory = new DialogFactory() | ||
|
||
function alert() { | ||
factory.showAlertDialog('提示', { | ||
content: '这是ui中的对话框' | ||
}) | ||
} | ||
|
||
async function confirm() { | ||
const b = await factory.showConfirmDialog('提示', { | ||
content: '这是一个确认框' | ||
}) | ||
showToast(b) | ||
} | ||
const app = createApp({ | ||
render() { | ||
return xml` | ||
<column> | ||
<Button onClick=${alert}>弹出提示</Button> | ||
<Button onClick=${confirm}>弹出确认框</Button> | ||
<${factory.Dialog/**对话框的挂载点 */} /> | ||
</column> | ||
` | ||
} | ||
}) | ||
|
||
startActivity(app) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { getRunningEngines } from 'engines' | ||
|
||
getRunningEngines().forEach(engine => { | ||
engine.emit('test', 789012) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
engines.all().forEach(e => { | ||
e.emit('test', 123456) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
events.on('test', (data) => { | ||
toast(`收到test事件, data:${data}`) | ||
}) | ||
|
||
//保持脚本运行 | ||
setInterval(() => { }, 1000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { selfEngine } from 'engines' | ||
import { showToast } from 'toast' | ||
|
||
// console.log(myEngine()); | ||
|
||
selfEngine.on('test', (data) => { | ||
showToast(`收到test事件, data:${data}`) | ||
}) | ||
|
||
//保持脚本运行 | ||
setInterval(() => { }, 1000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { execScriptFile, stopAll } from 'engines' | ||
import { writeFile, rm } from 'fs/promises' | ||
import { showToast } from 'toast' | ||
|
||
|
||
const file = process.cwd() + '/test.js' | ||
await writeFile(file, ` | ||
setTimeout(() => { }, 2000) | ||
`, "utf8") | ||
console.log(process.cwd()); | ||
|
||
execScriptFile(file, { | ||
onStart() { | ||
showToast('开始执行') | ||
}, | ||
onSuccess() { | ||
showToast('执行成功') | ||
rm(file, { force: true }) | ||
}, | ||
onException() { | ||
showToast('执行出错') | ||
rm(file, { force: true }) | ||
} | ||
}) | ||
|
||
setTimeout(() => { }, 5000) |
Oops, something went wrong.