diff --git a/pages/advance/advance.vue b/pages/advance/advance.vue
index 21b731d95d4f2129b4b152faa8cbab38f352c73d..9ec68f074886cfa98faf81e6156446deaaebf1ba 100644
--- a/pages/advance/advance.vue
+++ b/pages/advance/advance.vue
@@ -40,9 +40,7 @@
-
-
@@ -58,7 +56,6 @@
doIntervalTask,
clearIntervalTask,
playAssetAudio,
- getUserInput,
getMetaConfig
} from "../../uni_modules/uts-advance";
diff --git a/uni_modules/uts-advance/utssdk/app-android/index.uts b/uni_modules/uts-advance/utssdk/app-android/index.uts
index 342bb34507e55223730f360d60f924a9ff6aaa73..5aa92dba06a73984347f43faa9d0cbf2274e2721 100644
--- a/uni_modules/uts-advance/utssdk/app-android/index.uts
+++ b/uni_modules/uts-advance/utssdk/app-android/index.uts
@@ -141,69 +141,6 @@ export function removeViewToDecorView() {
UTSAndroid.getUniActivity()!.runOnUiThread(uiRunable)
}
-/**
- * 用户输入对话框监听器
- */
-class DialogListener extends DialogInterface.OnClickListener{
-
- inputET:EditText
- callback:UTSCallback
-
- constructor(et:EditText,cb:UTSCallback){
- super();
- this.callback = cb;
- this.inputET = et;
- }
-
- override onClick(_dialog:DialogInterface,_arg1:Int ):void {
- //数据获取
- let input = this.inputET.getText().toString()
- this.callback(input);
- Toast.makeText(UTSAndroid.getUniActivity(),input,
- Toast.LENGTH_LONG).show();
-
- }
-}
-
-
-/**
- * Dialog ui任务封装
- */
-class DialogUIRunnable extends Runnable {
-
- callback:UTSCallback
-
- constructor(success:UTSCallback){
- super();
- this.callback = success
- }
-
- override run():void {
-
- let et = new EditText(UTSAndroid.getUniActivity());
- et.setText("127.0.0.1");
-
- new AlertDialog.Builder(UTSAndroid.getUniActivity()).setTitle("请输入IP地址")
- .setIcon(android.R.drawable.ic_dialog_info).setView(et)
- .setPositiveButton("确定", new DialogListener(et,this.callback))
- .setNegativeButton("取消", null).show();
-
- }
-};
-
-
-
-/**
- * 通过对话框同步获取用户输入
- */
-export function getUserInput(success: (res: string) => void) {
-
- let uiRunable = new DialogUIRunnable(success);
- UTSAndroid.getUniActivity()!.runOnUiThread(uiRunable)
-
-}
-
-
/**
diff --git a/uni_modules/uts-alert/package.json b/uni_modules/uts-alert/package.json
index e44b0746160bd2e390b36ab48eac1b2920aeb8a6..f7f5ea165a815d681639e686063838613269de28 100644
--- a/uni_modules/uts-alert/package.json
+++ b/uni_modules/uts-alert/package.json
@@ -8,7 +8,7 @@
],
"repository": "",
"engines": {
- "HBuilderX": "^3.6.8"
+ "HBuilderX": "^3.6.11"
},
"dcloudext": {
"type": "uts",
diff --git a/uni_modules/uts-alert/utssdk/app-android/index.uts b/uni_modules/uts-alert/utssdk/app-android/index.uts
index 623aed275bd092b93794e66b6d242cd1e9ee0bb5..658c3562ac6bac28bb37f82aa4eb93555f8f6950 100644
--- a/uni_modules/uts-alert/utssdk/app-android/index.uts
+++ b/uni_modules/uts-alert/utssdk/app-android/index.uts
@@ -1,8 +1,104 @@
-@Suppress("unuse")
+
+import {
+ UTSAndroid
+} from "io.dcloud.uts";
+
+import Toast from 'android.widget.Toast';
+import AlertDialog from 'android.app.AlertDialog';
+import DialogInterface from 'android.content.DialogInterface';
+import EditText from 'android.widget.EditText';
+
export function showAlert(_title: string|null, _message: string|null, _result: (index: Number) => void) {
// todo
+ let uiRunable = new DialogUIRunnable(null,_title!,_message!,"",false);
+ UTSAndroid.getUniActivity()!.runOnUiThread(uiRunable)
}
-@Suppress("unuse")
-export function showPrompt(_title: string|null,_message: string|null,_placeholder: string|null, _result: (content: string)=>void) {
- // todo
+
+
+export function showPrompt(_title: string|null,_message: string|null,_placeholder: string|null, success: (content: string)=>void) {
+ let uiRunable = new DialogUIRunnable(success,_title!,_message!,_placeholder!,true);
+ UTSAndroid.getUniActivity()!.runOnUiThread(uiRunable)
+}
+
+/**
+ * 用户输入对话框监听器
+ */
+class DialogListener extends DialogInterface.OnClickListener{
+
+ inputET:EditText
+ callback:UTSCallback
+
+ constructor(et:EditText,cb:UTSCallback){
+ super();
+ this.callback = cb;
+ this.inputET = et;
+ }
+
+ override onClick(_dialog:DialogInterface,_arg1:Int ):void {
+ //数据获取
+ let input = this.inputET.getText().toString()
+ this.callback(input);
+ Toast.makeText(UTSAndroid.getUniActivity(),input,
+ Toast.LENGTH_LONG).show();
+
+ }
+}
+
+
+/**
+ * Dialog ui任务封装
+ */
+class DialogUIRunnable extends Runnable {
+
+ callback:UTSCallback|null = null
+ title: string
+ message: string
+ placeholder: string
+ needInput:boolean
+
+ constructor(success?:UTSCallback,title: string,message: string,placeholder: string,needInput:boolean){
+ super();
+ if(success != null){
+ this.callback = success
+ }
+
+ this.title = title
+ this.message = message
+ this.placeholder = placeholder
+ this.needInput = needInput
+ }
+
+ override run():void {
+
+ if(this.needInput){
+ let et = new EditText(UTSAndroid.getUniActivity());
+ et.setText(this.placeholder);
+
+ new AlertDialog.Builder(UTSAndroid.getUniActivity())
+ .setTitle(this.title)
+ .setMessage(this.message)
+ .setIcon(android.R.drawable.ic_dialog_info).setView(et)
+ .setPositiveButton("确定", new DialogListener(et,this.callback!))
+ .setNegativeButton("取消", null).show();
+ }else{
+ new AlertDialog.Builder(UTSAndroid.getUniActivity())
+ .setTitle(this.title)
+ .setMessage(this.message)
+ .setIcon(android.R.drawable.ic_dialog_info)
+ .setNegativeButton("取消", null).show();
+ }
+
+
+ }
+};
+
+
+
+/**
+ * 通过对话框同步获取用户输入
+ */
+export function getUserInput(success: (res: string) => void) {
+
+
}
+