Skip to content

Commit

Permalink
handle for single files
Browse files Browse the repository at this point in the history
Signed-off-by: parneet-guraya <[email protected]>
  • Loading branch information
parneet-guraya committed Jan 24, 2024
1 parent ff002a3 commit a1603be
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class FileDetailsFragment : FileFragment() {
}

R.id.action_remove_file -> {
val dialog = RemoveFilesDialogFragment.newInstance(safeFile.file)
val dialog = RemoveFilesDialogFragment.newInstance(safeFile.file, safeFile.file.isAvailableLocally)
dialog.show(parentFragmentManager, FRAGMENT_TAG_CONFIRMATION)
true
}
Expand Down Expand Up @@ -353,7 +353,7 @@ class FileDetailsFragment : FileFragment() {
thumbnailImageView.bringToFront()
thumbnailImageView.isVisible = false

val file = ocFileWithSyncInfo.file
val file = ocFileWithSyncInfo.file
if (ocFileWithSyncInfo.isSynchronizing) {
thumbnailImageView.setImageResource(R.drawable.sync_pin)
thumbnailImageView.visibility = View.VISIBLE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ class MainFileListFragment : Fragment(),
}

FileMenuOption.REMOVE -> {
val dialogRemove = RemoveFilesDialogFragment.newInstance(file)
val dialogRemove = RemoveFilesDialogFragment.newInstance(file, file.isAvailableLocally)
dialogRemove.show(requireActivity().supportFragmentManager, ConfirmationDialogFragment.FTAG_CONFIRMATION)
}

Expand Down Expand Up @@ -1095,7 +1095,8 @@ class MainFileListFragment : Fragment(),
}

R.id.action_remove_file -> {
val dialog = RemoveFilesDialogFragment.newInstance(checkedFiles)
// to handle using usecase
val dialog = RemoveFilesDialogFragment.newInstance(checkedFiles, false)
dialog.show(requireActivity().supportFragmentManager, ConfirmationDialogFragment.FTAG_CONFIRMATION)
fileListAdapter.clearSelection()
updateActionModeAfterTogglingSelected()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,35 +260,43 @@ class PreviewAudioFragment : FileFragment() {
mContainerActivity.fileOperationsHelper.showShareFile(file)
true
}

R.id.action_open_file_with -> {
openFile()
true
}

R.id.action_remove_file -> {
val dialog = RemoveFilesDialogFragment.newInstance(file)
val dialog = RemoveFilesDialogFragment.newInstance(file, file.isAvailableLocally)
dialog.show(parentFragmentManager, ConfirmationDialogFragment.FTAG_CONFIRMATION)
true
}

R.id.action_see_details -> {
seeDetails()
true
}

R.id.action_send_file -> {
requireActivity().sendDownloadedFilesByShareSheet(listOf(file))
true
}

R.id.action_sync_file -> {
mContainerActivity.fileOperationsHelper.syncFile(file)
true
}

R.id.action_set_available_offline -> {
fileOperationsViewModel.performOperation(FileOperation.SetFilesAsAvailableOffline(listOf(file)))
true
}

R.id.action_unset_available_offline -> {
fileOperationsViewModel.performOperation(FileOperation.UnsetFilesAsAvailableOffline(listOf(file)))
true
}

else -> super.onOptionsItemSelected(item)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,35 +213,43 @@ class PreviewImageFragment : FileFragment() {
mContainerActivity.fileOperationsHelper.showShareFile(file)
true
}

R.id.action_open_file_with -> {
openFile()
true
}

R.id.action_remove_file -> {
val dialog = RemoveFilesDialogFragment.newInstance(file)
val dialog = RemoveFilesDialogFragment.newInstance(file, file.isAvailableLocally)
dialog.show(requireFragmentManager(), ConfirmationDialogFragment.FTAG_CONFIRMATION)
true
}

R.id.action_see_details -> {
seeDetails()
true
}

R.id.action_send_file -> {
requireActivity().sendDownloadedFilesByShareSheet(listOf(file))
true
}

R.id.action_sync_file -> {
mContainerActivity.fileOperationsHelper.syncFile(file)
true
}

R.id.action_set_available_offline -> {
fileOperationsViewModel.performOperation(FileOperation.SetFilesAsAvailableOffline(listOf(file)))
true
}

R.id.action_unset_available_offline -> {
fileOperationsViewModel.performOperation(FileOperation.UnsetFilesAsAvailableOffline(listOf(file)))
true
}

else -> super.onOptionsItemSelected(item)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
return true;
}
case R.id.action_remove_file: {
RemoveFilesDialogFragment dialog = RemoveFilesDialogFragment.newInstanceForSingleFile(getFile());
RemoveFilesDialogFragment dialog = RemoveFilesDialogFragment.newInstanceForSingleFile(getFile(), getFile().isAvailableLocally());
dialog.show(getFragmentManager(), ConfirmationDialogFragment.FTAG_CONFIRMATION);
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ class PreviewVideoActivity : FileActivity(), Player.Listener, OnPrepareVideoPlay

R.id.action_remove_file -> {
player?.pause()
val dialog = newInstance(file)
val dialog = newInstance(file, file.isAvailableLocally)
dialog.show(supportFragmentManager, ConfirmationDialogFragment.FTAG_CONFIRMATION)
true
}
Expand Down

0 comments on commit a1603be

Please sign in to comment.