diff --git a/app/src/main/java/com/casic/app/safetreecontroller/view/MainActivity.kt b/app/src/main/java/com/casic/app/safetreecontroller/view/MainActivity.kt index a0fa938..4b05170 100644 --- a/app/src/main/java/com/casic/app/safetreecontroller/view/MainActivity.kt +++ b/app/src/main/java/com/casic/app/safetreecontroller/view/MainActivity.kt @@ -145,10 +145,11 @@ * rtsp流IP地址,默认是192.168.10.137 * */ private fun modifyCameraIp() { - AlertDialog.Builder(context) + AlertDialog.Builder(this) .setTitle(getString(R.string.app_name)) .setIcon(R.mipmap.ic_launcher) .setView(R.layout.dialog_input_camera_ip) + .setCancelable(false) .setNegativeButton("取消") { _, _ -> } .setPositiveButton("确定") { dialog, _ -> val inputView = (dialog as AlertDialog).findViewById( @@ -171,6 +172,7 @@ .setTitle(getString(R.string.app_name)) .setIcon(R.mipmap.ic_launcher) .setView(R.layout.dialog_input_socket_ip) + .setCancelable(false) .setNegativeButton("取消") { _, _ -> } .setPositiveButton("确定") { dialog, _ -> val inputView = (dialog as AlertDialog).findViewById( @@ -194,8 +196,18 @@ }.create().show() } + /** + * 跳转WiFi连接界面 + * */ private fun disconnectCurrentWiFi() { - "安全树数据通信IP地址已更改,请注意切换网络".show(this) + AlertDialog.Builder(this) + .setTitle(getString(R.string.app_name)) + .setMessage("数据通信IP地址已更改,请手动切换到相应WiFi") + .setIcon(R.mipmap.ic_launcher) + .setCancelable(false) + .setPositiveButton("好的") { _, _ -> + startActivity(Intent(android.provider.Settings.ACTION_WIFI_SETTINGS)) + }.create().show() } override fun onRequestPermissionsResult(