Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Incorrect top bar when coming from preview & Repetitive navigation when coming from preview #4261

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ class FileDisplayActivity : FileActivity(),
private val secondFragment: FileFragment?
get() = supportFragmentManager.findFragmentByTag(TAG_SECOND_FRAGMENT) as FileFragment?

private var secondFragmentFocus:Boolean? = false
private var selectAllMenuItem: MenuItem? = null
private var mainMenu: Menu? = null

Expand Down Expand Up @@ -263,6 +264,18 @@ class FileDisplayActivity : FileActivity(),
checkNotificationPermission()
Timber.v("onCreate() end")
}
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
when(intent?.action){
ACTION_DETAILS ->{
//show file details
intent?.extras?.getParcelable<OCFile>(EXTRA_FILE)?.let {
file = it
initFragmentsWithFile()
}
}
}
}

private fun checkNotificationPermission() {
// Ask for permission only in case it's api >= 33 and notifications are not granted.
Expand Down Expand Up @@ -366,6 +379,7 @@ class FileDisplayActivity : FileActivity(),
}

private fun initAndShowListOfFiles(fileListOption: FileListOption = FileListOption.ALL_FILES) {

val mainListOfFiles = MainFileListFragment.newInstance(
initialFolderToDisplay = file,
fileListOption = fileListOption,
Expand Down Expand Up @@ -408,6 +422,7 @@ class FileDisplayActivity : FileActivity(),
secondFragment?.let {
setSecondFragment(it)
updateToolbar(it.file)
secondFragmentFocus = true;
} ?: cleanSecondFragment()

} else {
Expand Down Expand Up @@ -499,9 +514,11 @@ class FileDisplayActivity : FileActivity(),
val tr = supportFragmentManager.beginTransaction()
tr.remove(second)
tr.commit()
secondFragmentFocus=false
}
updateFragmentsVisibility(false)
updateToolbar(null)

}

private fun refreshListOfFilesFragment() {
Expand Down Expand Up @@ -915,7 +932,7 @@ class FileDisplayActivity : FileActivity(),

private fun updateToolbar(chosenFileFromParam: OCFile?, space: OCSpace? = null) {
val chosenFile = chosenFileFromParam ?: file // If no file is passed, current file decides

if ( secondFragmentFocus == true) return //skip up toolbar updates till MainListFragment comes bacl
if (chosenFile == null || (chosenFile.remotePath == OCFile.ROOT_PATH && (space == null || !space.isProject))) {
val title =
when (fileListOption) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,11 @@ class PreviewImageActivity : FileActivity(),
override fun showDetails(file: OCFile) {
val showDetailsIntent = Intent(this, FileDisplayActivity::class.java).apply {
action = FileDisplayActivity.ACTION_DETAILS
flags = Intent.FLAG_ACTIVITY_SINGLE_TOP
putExtra(EXTRA_FILE, file)
putExtra(EXTRA_ACCOUNT, AccountUtils.getCurrentOwnCloudAccount(this@PreviewImageActivity))
}
finish()
startActivity(showDetailsIntent)
}

Expand Down