This commit is contained in:
lucky 2022-01-14 15:34:17 +03:00
parent 0f1a47ff79
commit 5f31be5eba
1 changed files with 15 additions and 11 deletions

View File

@ -133,22 +133,26 @@ open class MainActivity : AppCompatActivity() {
}
toggle.setOnLongClickListener {
if (!toggle.isChecked) return@setOnLongClickListener false
MaterialAlertDialogBuilder(this@MainActivity)
.setTitle(R.string.dialog_confirm_panic_title)
.setMessage(R.string.dialog_confirm_panic_message)
.setPositiveButton(R.string.yes) { _, _ ->
try {
admin.lockNow()
if (prefs.isWipeData) admin.wipeData()
} catch (exc: SecurityException) {}
}
.setNegativeButton(R.string.cancel, null)
.show()
showPanicDialog()
true
}
}
}
private fun showPanicDialog() {
MaterialAlertDialogBuilder(this)
.setTitle(R.string.dialog_confirm_panic_title)
.setMessage(R.string.dialog_confirm_panic_message)
.setPositiveButton(R.string.yes) { _, _ ->
try {
admin.lockNow()
if (prefs.isWipeData) admin.wipeData()
} catch (exc: SecurityException) {}
}
.setNegativeButton(R.string.cancel, null)
.show()
}
private fun showLaunchersSettings() {
var launchers = prefs.launchers
val checkedLaunchers = mutableListOf<Boolean>()