fix #786, do not request the pattern/pin/fp again after rotating the device

This commit is contained in:
tibbi 2018-06-15 15:05:42 +02:00
parent 75151956d0
commit 5c608de61b
2 changed files with 15 additions and 2 deletions

View file

@ -47,7 +47,7 @@ ext {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:4.1.16' implementation 'com.simplemobiletools:commons:4.1.17'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0' implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation 'com.android.support:multidex:1.0.3' implementation 'com.android.support:multidex:1.0.3'
implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'it.sephiroth.android.exif:library:1.0.1'

View file

@ -43,6 +43,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
private val PICK_WALLPAPER = 3 private val PICK_WALLPAPER = 3
private val LAST_MEDIA_CHECK_PERIOD = 3000L private val LAST_MEDIA_CHECK_PERIOD = 3000L
private val NEW_APP_PACKAGE = "com.simplemobiletools.clock" private val NEW_APP_PACKAGE = "com.simplemobiletools.clock"
private val IS_PROTECTION_DIALOG_SHOWN = "is_protection_dialog_shown"
private var mIsPickImageIntent = false private var mIsPickImageIntent = false
private var mIsPickVideoIntent = false private var mIsPickVideoIntent = false
@ -55,6 +56,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
private var mIsGettingDirs = false private var mIsGettingDirs = false
private var mLoadedInitialPhotos = false private var mLoadedInitialPhotos = false
private var mIsPasswordProtectionPending = false private var mIsPasswordProtectionPending = false
private var mWasProtectionHandled = false
private var mLatestMediaId = 0L private var mLatestMediaId = 0L
private var mLatestMediaDateId = 0L private var mLatestMediaDateId = 0L
private var mLastMediaHandler = Handler() private var mLastMediaHandler = Handler()
@ -154,8 +156,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
directories_empty_text_label.setTextColor(config.textColor) directories_empty_text_label.setTextColor(config.textColor)
directories_empty_text.setTextColor(getAdjustedPrimaryColor()) directories_empty_text.setTextColor(getAdjustedPrimaryColor())
if (mIsPasswordProtectionPending) { if (mIsPasswordProtectionPending && !mWasProtectionHandled) {
handleAppPasswordProtection { handleAppPasswordProtection {
mWasProtectionHandled = it
if (it) { if (it) {
mIsPasswordProtectionPending = false mIsPasswordProtectionPending = false
tryLoadGallery() tryLoadGallery()
@ -231,6 +234,16 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
return true return true
} }
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
outState.putBoolean(WAS_PROTECTION_HANDLED, mWasProtectionHandled)
}
override fun onRestoreInstanceState(savedInstanceState: Bundle) {
super.onRestoreInstanceState(savedInstanceState)
mWasProtectionHandled = savedInstanceState.getBoolean(WAS_PROTECTION_HANDLED, false)
}
private fun getRecyclerAdapter() = directories_grid.adapter as? DirectoryAdapter private fun getRecyclerAdapter() = directories_grid.adapter as? DirectoryAdapter
private fun storeStateVariables() { private fun storeStateVariables() {