do not ask for authentication on every screen, at locked folders
This commit is contained in:
parent
a1e0d07798
commit
638dab9d97
4 changed files with 25 additions and 12 deletions
|
@ -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,11 +160,15 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
|||
media_empty_text_placeholder_2.setTextColor(getAdjustedPrimaryColor())
|
||||
|
||||
if (mMedia.isEmpty() || config.getFolderSorting(mPath) and SORT_BY_RANDOM == 0) {
|
||||
handleLockedFolderOpening(mPath) { success ->
|
||||
if (success) {
|
||||
tryLoadGallery()
|
||||
} else {
|
||||
finish()
|
||||
if (shouldSkipAuthentication()) {
|
||||
tryLoadGallery()
|
||||
} else {
|
||||
handleLockedFolderOpening(mPath) { success ->
|
||||
if (success) {
|
||||
tryLoadGallery()
|
||||
} else {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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,11 +308,15 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
|
||||
showSystemUI(true)
|
||||
|
||||
handleLockedFolderOpening(mPath.getParentPath()) { success ->
|
||||
if (success) {
|
||||
initContinue()
|
||||
} else {
|
||||
finish()
|
||||
if (intent.getBooleanExtra(SKIP_AUTHENTICATION, false)) {
|
||||
initContinue()
|
||||
} else {
|
||||
handleLockedFolderOpening(mPath.getParentPath()) { success ->
|
||||
if (success) {
|
||||
initContinue()
|
||||
} else {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 a new issue