Skip to content

Commit

Permalink
Intent works with folders and files by displaying the file's detail
Browse files Browse the repository at this point in the history
  • Loading branch information
fesave committed Apr 5, 2022
1 parent c4e93de commit 838fb97
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,7 @@ class FileDisplayActivity : FileActivity(), FileFragment.ContainerActivity, OnEn
} else if (uri != null && AccountUtils.getAccounts(applicationContext).size == 1) {
isFileDiscovered(uri).let { OCFile ->
if (OCFile != null) {
openFile(OCFile)
manageItem(OCFile)
} else {
showMessageInToast(getString(R.string.no_file_found))
}
Expand All @@ -1673,10 +1673,16 @@ class FileDisplayActivity : FileActivity(), FileFragment.ContainerActivity, OnEn

private fun isFileDiscovered(uri: Uri?): OCFile? = storageManager.getFileByPrivateLink(uri.toString())

private fun openFile(file: OCFile) {
private fun manageItem(file: OCFile) {
onBrowsedDownTo(file)
setFile(file)
setAccount(AccountUtils.getOwnCloudAccountByName(this, file.owner))
initFragmentsWithFile()

if (PreviewImageFragment.canBePreviewed(file)) {
startImagePreview(file)
} else {
initFragmentsWithFile()
}
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ public void syncFile(OCFile file) {
intent.setAction(OperationsService.ACTION_SYNC_FILE);
intent.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
intent.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());

mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(intent);

} else {
Expand Down

0 comments on commit 838fb97

Please sign in to comment.