|
@@ -54,6 +54,19 @@ class RemoteCtrlActivity : BaseNoActionBarActivity() {
|
|
(findViewById<View>(R.id.lyt_remote_reboot) as RelativeLayout).apply {
|
|
(findViewById<View>(R.id.lyt_remote_reboot) as RelativeLayout).apply {
|
|
setOnClickListener { showAlertDialog(1) }
|
|
setOnClickListener { showAlertDialog(1) }
|
|
}
|
|
}
|
|
|
|
+ (findViewById<View>(R.id.lyt_restore_factory_settings) as RelativeLayout).apply {
|
|
|
|
+ setOnClickListener { showRestoreFactorySettingsDialog() }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private fun showRestoreFactorySettingsDialog() {
|
|
|
|
+ Logger.d("showAlertDialog")
|
|
|
|
+ AlertDialog.Builder(this)
|
|
|
|
+ .setTitle(getString(R.string.restore_factory_settings))
|
|
|
|
+ .setMessage(getString(R.string.restore_factory_settings_query))
|
|
|
|
+ .setNegativeButton(R.string.protect_cancel_cancel) { dialog, _ -> dialog.dismiss() }
|
|
|
|
+ .setPositiveButton(R.string.alert_dialog_ok) { _, _ -> sendCmd(2) }
|
|
|
|
+ .show()
|
|
}
|
|
}
|
|
|
|
|
|
private fun showAlertDialog(type: Int) {
|
|
private fun showAlertDialog(type: Int) {
|
|
@@ -76,12 +89,21 @@ class RemoteCtrlActivity : BaseNoActionBarActivity() {
|
|
"cid" to cid
|
|
"cid" to cid
|
|
)
|
|
)
|
|
).flowable
|
|
).flowable
|
|
- } else {
|
|
|
|
|
|
+ } else if (type == 1) {
|
|
(RetrofitFactory.retrofit(WatchSettingService::class.java) as WatchSettingService).remoteReboot(
|
|
(RetrofitFactory.retrofit(WatchSettingService::class.java) as WatchSettingService).remoteReboot(
|
|
mutableMapOf(
|
|
mutableMapOf(
|
|
"cid" to cid
|
|
"cid" to cid
|
|
)
|
|
)
|
|
).flowable
|
|
).flowable
|
|
|
|
+ } else if (type == 2) {
|
|
|
|
+ (RetrofitFactory.retrofit(WatchSettingService::class.java) as WatchSettingService).restoreFactorySettings(
|
|
|
|
+ mutableMapOf(
|
|
|
|
+ "cid" to cid
|
|
|
|
+ )
|
|
|
|
+ ).flowable
|
|
|
|
+ } else {
|
|
|
|
+ hideProgressDialog()
|
|
|
|
+ return@launch
|
|
}
|
|
}
|
|
|
|
|
|
HttpServiceExecutor.execute(
|
|
HttpServiceExecutor.execute(
|