Security mode toggle added

This commit is contained in:
tom5079
2019-05-13 21:45:18 +09:00
parent 48c190b449
commit fe523da6ed
8 changed files with 54 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
package xyz.quaver.pupil
import android.os.Bundle
import android.preference.PreferenceManager
import android.view.MenuItem
import android.view.WindowManager
import androidx.appcompat.app.AlertDialog
@@ -27,6 +28,18 @@ class SettingsActivity : AppCompatActivity() {
supportActionBar?.setDisplayHomeAsUpEnabled(true)
}
override fun onResume() {
val preferences = PreferenceManager.getDefaultSharedPreferences(this)
if (preferences.getBoolean("security_mode", false))
window.setFlags(
WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE)
else
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
super.onResume()
}
class SettingsFragment : PreferenceFragmentCompat() {
private val suffix = listOf(