do not ask for authentication on every screen, at locked folders
This commit is contained in:
parent
a1e0d07798
commit
638dab9d97
|
@ -835,6 +835,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
handleLockedFolderOpening(path) { success ->
|
||||
if (success) {
|
||||
Intent(this, MediaActivity::class.java).apply {
|
||||
putExtra(SKIP_AUTHENTICATION, true)
|
||||
putExtra(DIRECTORY, path)
|
||||
handleMediaIntent(this)
|
||||
}
|
||||
|
|
|
@ -160,6 +160,9 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
|||
media_empty_text_placeholder_2.setTextColor(getAdjustedPrimaryColor())
|
||||
|
||||
if (mMedia.isEmpty() || config.getFolderSorting(mPath) and SORT_BY_RANDOM == 0) {
|
||||
if (shouldSkipAuthentication()) {
|
||||
tryLoadGallery()
|
||||
} else {
|
||||
handleLockedFolderOpening(mPath) { success ->
|
||||
if (success) {
|
||||
tryLoadGallery()
|
||||
|
@ -169,6 +172,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
|
@ -274,8 +278,8 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
|||
private fun startSlideshow() {
|
||||
if (mMedia.isNotEmpty()) {
|
||||
Intent(this, ViewPagerActivity::class.java).apply {
|
||||
val item = mMedia.firstOrNull { it is Medium } as? Medium
|
||||
?: return
|
||||
val item = mMedia.firstOrNull { it is Medium } as? Medium ?: return
|
||||
putExtra(SKIP_AUTHENTICATION, shouldSkipAuthentication())
|
||||
putExtra(PATH, item.path)
|
||||
putExtra(SHOW_ALL, mShowAll)
|
||||
putExtra(SLIDESHOW_START_ON_ENTER, true)
|
||||
|
@ -865,6 +869,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
|||
openPath(path, false, extras)
|
||||
} else {
|
||||
Intent(this, ViewPagerActivity::class.java).apply {
|
||||
putExtra(SKIP_AUTHENTICATION, shouldSkipAuthentication())
|
||||
putExtra(PATH, path)
|
||||
putExtra(SHOW_ALL, mShowAll)
|
||||
putExtra(SHOW_FAVORITES, mPath == FAVORITES)
|
||||
|
@ -932,6 +937,8 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
|||
}
|
||||
}
|
||||
|
||||
private fun shouldSkipAuthentication() = intent.getBooleanExtra(SKIP_AUTHENTICATION, false)
|
||||
|
||||
private fun deleteFilteredFiles(filtered: ArrayList<FileDirItem>) {
|
||||
deleteFiles(filtered) {
|
||||
if (!it) {
|
||||
|
|
|
@ -308,6 +308,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
|
||||
showSystemUI(true)
|
||||
|
||||
if (intent.getBooleanExtra(SKIP_AUTHENTICATION, false)) {
|
||||
initContinue()
|
||||
} else {
|
||||
handleLockedFolderOpening(mPath.getParentPath()) { success ->
|
||||
if (success) {
|
||||
initContinue()
|
||||
|
@ -316,6 +319,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initContinue() {
|
||||
if (intent.extras?.containsKey(IS_VIEW_INTENT) == true) {
|
||||
|
|
|
@ -132,6 +132,7 @@ const val IS_VIEW_INTENT = "is_view_intent"
|
|||
const val PICKED_PATHS = "picked_paths"
|
||||
const val SHOULD_INIT_FRAGMENT = "should_init_fragment"
|
||||
const val PORTRAIT_PATH = "portrait_path"
|
||||
const val SKIP_AUTHENTICATION = "skip_authentication"
|
||||
|
||||
// rotations
|
||||
const val ROTATE_BY_SYSTEM_SETTING = 0
|
||||
|
|
Loading…
Reference in New Issue