mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 00:17:58 +01:00
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 ->
|
handleLockedFolderOpening(path) { success ->
|
||||||
if (success) {
|
if (success) {
|
||||||
Intent(this, MediaActivity::class.java).apply {
|
Intent(this, MediaActivity::class.java).apply {
|
||||||
|
putExtra(SKIP_AUTHENTICATION, true)
|
||||||
putExtra(DIRECTORY, path)
|
putExtra(DIRECTORY, path)
|
||||||
handleMediaIntent(this)
|
handleMediaIntent(this)
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,11 +160,15 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
media_empty_text_placeholder_2.setTextColor(getAdjustedPrimaryColor())
|
media_empty_text_placeholder_2.setTextColor(getAdjustedPrimaryColor())
|
||||||
|
|
||||||
if (mMedia.isEmpty() || config.getFolderSorting(mPath) and SORT_BY_RANDOM == 0) {
|
if (mMedia.isEmpty() || config.getFolderSorting(mPath) and SORT_BY_RANDOM == 0) {
|
||||||
handleLockedFolderOpening(mPath) { success ->
|
if (shouldSkipAuthentication()) {
|
||||||
if (success) {
|
tryLoadGallery()
|
||||||
tryLoadGallery()
|
} else {
|
||||||
} else {
|
handleLockedFolderOpening(mPath) { success ->
|
||||||
finish()
|
if (success) {
|
||||||
|
tryLoadGallery()
|
||||||
|
} else {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,8 +278,8 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
private fun startSlideshow() {
|
private fun startSlideshow() {
|
||||||
if (mMedia.isNotEmpty()) {
|
if (mMedia.isNotEmpty()) {
|
||||||
Intent(this, ViewPagerActivity::class.java).apply {
|
Intent(this, ViewPagerActivity::class.java).apply {
|
||||||
val item = mMedia.firstOrNull { it is Medium } as? Medium
|
val item = mMedia.firstOrNull { it is Medium } as? Medium ?: return
|
||||||
?: return
|
putExtra(SKIP_AUTHENTICATION, shouldSkipAuthentication())
|
||||||
putExtra(PATH, item.path)
|
putExtra(PATH, item.path)
|
||||||
putExtra(SHOW_ALL, mShowAll)
|
putExtra(SHOW_ALL, mShowAll)
|
||||||
putExtra(SLIDESHOW_START_ON_ENTER, true)
|
putExtra(SLIDESHOW_START_ON_ENTER, true)
|
||||||
|
@ -865,6 +869,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
openPath(path, false, extras)
|
openPath(path, false, extras)
|
||||||
} else {
|
} else {
|
||||||
Intent(this, ViewPagerActivity::class.java).apply {
|
Intent(this, ViewPagerActivity::class.java).apply {
|
||||||
|
putExtra(SKIP_AUTHENTICATION, shouldSkipAuthentication())
|
||||||
putExtra(PATH, path)
|
putExtra(PATH, path)
|
||||||
putExtra(SHOW_ALL, mShowAll)
|
putExtra(SHOW_ALL, mShowAll)
|
||||||
putExtra(SHOW_FAVORITES, mPath == FAVORITES)
|
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>) {
|
private fun deleteFilteredFiles(filtered: ArrayList<FileDirItem>) {
|
||||||
deleteFiles(filtered) {
|
deleteFiles(filtered) {
|
||||||
if (!it) {
|
if (!it) {
|
||||||
|
|
|
@ -308,11 +308,15 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
|
|
||||||
showSystemUI(true)
|
showSystemUI(true)
|
||||||
|
|
||||||
handleLockedFolderOpening(mPath.getParentPath()) { success ->
|
if (intent.getBooleanExtra(SKIP_AUTHENTICATION, false)) {
|
||||||
if (success) {
|
initContinue()
|
||||||
initContinue()
|
} else {
|
||||||
} else {
|
handleLockedFolderOpening(mPath.getParentPath()) { success ->
|
||||||
finish()
|
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 PICKED_PATHS = "picked_paths"
|
||||||
const val SHOULD_INIT_FRAGMENT = "should_init_fragment"
|
const val SHOULD_INIT_FRAGMENT = "should_init_fragment"
|
||||||
const val PORTRAIT_PATH = "portrait_path"
|
const val PORTRAIT_PATH = "portrait_path"
|
||||||
|
const val SKIP_AUTHENTICATION = "skip_authentication"
|
||||||
|
|
||||||
// rotations
|
// rotations
|
||||||
const val ROTATE_BY_SYSTEM_SETTING = 0
|
const val ROTATE_BY_SYSTEM_SETTING = 0
|
||||||
|
|
Loading…
Reference in a new issue