Skip to content

Commit f8b733c

Browse files
authored
Merge pull request #4265 from owncloud/fix/navigation_details_view
[FIX] Some bugs related to Details view
2 parents 124fe21 + 96dce53 commit f8b733c

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ ownCloud admins and users.
2929

3030
* Security - Improve biometric authentication security: [#4180](https://github.com/owncloud/android/issues/4180)
3131
* Bugfix - Some Null Pointer Exceptions in MainFileListViewModel: [#4065](https://github.com/owncloud/android/issues/4065)
32+
* Bugfix - Bugs related to Details view: [#4188](https://github.com/owncloud/android/issues/4188)
3233
* Bugfix - Some Null Pointer Exceptions fixed from Google Play: [#4207](https://github.com/owncloud/android/issues/4207)
3334
* Bugfix - Add "scope" parameter to /token endpoint HTTP requests: [#4260](https://github.com/owncloud/android/pull/4260)
3435
* Change - Android library as a module instead of submodule: [#3962](https://github.com/owncloud/android/issues/3962)
@@ -68,6 +69,15 @@ ownCloud admins and users.
6869
https://github.com/owncloud/android/issues/4065
6970
https://github.com/owncloud/android/pull/4241
7071

72+
* Bugfix - Bugs related to Details view: [#4188](https://github.com/owncloud/android/issues/4188)
73+
74+
When coming to Details view from video or image previews, now the top bar is
75+
shown correctly and navigation has the correct stack, so the back button has the
76+
expected flow.
77+
78+
https://github.com/owncloud/android/issues/4188
79+
https://github.com/owncloud/android/pull/4265
80+
7181
* Bugfix - Some Null Pointer Exceptions fixed from Google Play: [#4207](https://github.com/owncloud/android/issues/4207)
7282

7383
FileDisplayActivity and ReceiverExternalFilesActivity have prevented some

changelog/unreleased/4265

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Bugfix: Bugs related to Details view
2+
3+
When coming to Details view from video or image previews, now the top bar is shown correctly
4+
and navigation has the correct stack, so the back button has the expected flow.
5+
6+
https://github.com/owncloud/android/issues/4188
7+
https://github.com/owncloud/android/pull/4265

owncloudApp/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ class FileDisplayActivity : FileActivity(),
326326
0,
327327
file.remotePath.lastIndexOf(file.fileName)
328328
)
329-
if (storageManager.getFileByPath(parentPath) == null) {
329+
if (storageManager.getFileByPath(parentPath, file.spaceId) == null) {
330330
file = null // not able to know the directory where the file is uploading
331331
}
332332
} else {
@@ -470,7 +470,7 @@ class FileDisplayActivity : FileActivity(),
470470
private fun setSecondFragment(fragment: Fragment) {
471471
val transaction = supportFragmentManager.beginTransaction()
472472
transaction.replace(R.id.right_fragment_container, fragment, TAG_SECOND_FRAGMENT)
473-
transaction.commit()
473+
transaction.commitNow()
474474
updateFragmentsVisibility(true)
475475
}
476476

@@ -498,7 +498,7 @@ class FileDisplayActivity : FileActivity(),
498498
if (second != null) {
499499
val tr = supportFragmentManager.beginTransaction()
500500
tr.remove(second)
501-
tr.commit()
501+
tr.commitNow()
502502
}
503503
updateFragmentsVisibility(false)
504504
updateToolbar(null)
@@ -916,6 +916,9 @@ class FileDisplayActivity : FileActivity(),
916916
private fun updateToolbar(chosenFileFromParam: OCFile?, space: OCSpace? = null) {
917917
val chosenFile = chosenFileFromParam ?: file // If no file is passed, current file decides
918918

919+
// If we come from a preview activity (image or video), not updating toolbar when initializing this activity or it will show the root folder one
920+
if (intent.action == ACTION_DETAILS && chosenFile?.remotePath == OCFile.ROOT_PATH && secondFragment is FileDetailsFragment) return
921+
919922
if (chosenFile == null || (chosenFile.remotePath == OCFile.ROOT_PATH && (space == null || !space.isProject))) {
920923
val title =
921924
when (fileListOption) {

owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ class PreviewImageActivity : FileActivity(),
262262
putExtra(EXTRA_FILE, file)
263263
putExtra(EXTRA_ACCOUNT, AccountUtils.getCurrentOwnCloudAccount(this@PreviewImageActivity))
264264
}
265+
finishAffinity()
265266
startActivity(showDetailsIntent)
266267
}
267268

owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewVideoActivity.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ class PreviewVideoActivity : FileActivity(), Player.Listener, OnPrepareVideoPlay
310310
putExtra(FileActivity.EXTRA_FILE, file)
311311
putExtra(FileActivity.EXTRA_ACCOUNT, AccountUtils.getCurrentOwnCloudAccount(this@PreviewVideoActivity))
312312
}
313+
finishAffinity()
313314
startActivity(showDetailsIntent)
314315
}
315316

0 commit comments

Comments
 (0)