mirror of https://github.com/x13a/Wasted.git
ref
This commit is contained in:
parent
0f1a47ff79
commit
5f31be5eba
|
@ -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>()
|
||||
|
|
Loading…
Reference in New Issue