"ui";
require('rhino').install();
const MenuItem = android.view.MenuItem;
const Snackbar = com.google.android.material.snackbar.Snackbar;
const ui = require('ui');
const app = require('app');
const {
showConfirmDialog
} = require('dialogs');
class MainActivity extends ui.Activity {
get layoutXml() {
return `
<column>
<button id="按钮" text="按钮"/>
</column>
`
}
onContentViewSet(view) {
view.findView("按钮").on("click", async () => {
if (await showConfirmDialog("是否增加列表数据?")) {
this.listData.push({
text: "New",
enabled: false
});
}
});
}
}
ui.setMainActivity(MainActivity);