diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewAudioFragment.kt b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewAudioFragment.kt index bf56144feb0..e83b4097f52 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewAudioFragment.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewAudioFragment.kt @@ -300,13 +300,13 @@ class PreviewAudioFragment : FileFragment() { R.id.action_set_available_offline -> { fileOperationsViewModel.performOperation(FileOperation.SetFilesAsAvailableOffline(listOf(file))) - Snackbar.make(requireView(), R.string.sync_file_nothing_to_do_msg, Snackbar.LENGTH_LONG).show() + showSnackbarMessage() true } R.id.action_unset_available_offline -> { fileOperationsViewModel.performOperation(FileOperation.UnsetFilesAsAvailableOffline(listOf(file))) - Snackbar.make(requireView(), R.string.sync_file_nothing_to_do_msg, Snackbar.LENGTH_LONG).show() + showSnackbarMessage() true } @@ -359,6 +359,15 @@ class PreviewAudioFragment : FileFragment() { } } + private fun showSnackbarMessage(){ + val snackbarString = if (file.isAvailableOffline){ + R.string.confirmation_unset_available_offline + } else { + R.string.confirmation_set_available_offline + } + Snackbar.make(requireView(), snackbarString, Snackbar.LENGTH_LONG).show() + } + /** * Defines callbacks for service binding, passed to bindService() */ diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.kt b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.kt index a04855a64e2..5ee2e87fb4c 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.kt @@ -348,7 +348,12 @@ class PreviewImageFragment : FileFragment() { } private fun showSnackbarMessage() { - val snackbar = Snackbar.make(requireView(), R.string.sync_file_nothing_to_do_msg, Snackbar.LENGTH_LONG) + val snackbarString = if (file.isAvailableOffline){ + R.string.confirmation_unset_available_offline + } else { + R.string.confirmation_set_available_offline + } + val snackbar = Snackbar.make(requireView(), snackbarString, Snackbar.LENGTH_LONG) val params = snackbar.view.layoutParams as ViewGroup.MarginLayoutParams params.setMargins(params.leftMargin, params.topMargin, params.rightMargin, 100) snackbar.view.layoutParams = params diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.kt b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.kt index eb93a2aceef..69ed495bf43 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.kt @@ -171,7 +171,7 @@ class PreviewTextFragment : FileFragment() { val fileToSetAsAvailableOffline = ArrayList() fileToSetAsAvailableOffline.add(file) fileOperationsViewModel.performOperation(FileOperation.SetFilesAsAvailableOffline(fileToSetAsAvailableOffline)) - Snackbar.make(requireView(), R.string.sync_file_nothing_to_do_msg, Snackbar.LENGTH_LONG).show() + showSnackbarMessage() true } @@ -179,7 +179,7 @@ class PreviewTextFragment : FileFragment() { val fileToUnsetAsAvailableOffline = ArrayList() fileToUnsetAsAvailableOffline.add(file) fileOperationsViewModel.performOperation(FileOperation.UnsetFilesAsAvailableOffline(fileToUnsetAsAvailableOffline)) - Snackbar.make(requireView(), R.string.sync_file_nothing_to_do_msg, Snackbar.LENGTH_LONG).show() + showSnackbarMessage() true } @@ -275,6 +275,15 @@ class PreviewTextFragment : FileFragment() { requireActivity().onBackPressed() } + private fun showSnackbarMessage(){ + val snackbarString = if (file.isAvailableOffline){ + R.string.confirmation_unset_available_offline + } else { + R.string.confirmation_set_available_offline + } + Snackbar.make(requireView(), snackbarString, Snackbar.LENGTH_LONG).show() + } + private inner class TextLoadAsyncTask( var textViewReference: TextView, var rootView: RelativeLayout, diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewVideoActivity.kt b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewVideoActivity.kt index 7af3460b036..0a23efb93b8 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewVideoActivity.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewVideoActivity.kt @@ -400,7 +400,7 @@ class PreviewVideoActivity : FileActivity(), Player.Listener, OnPrepareVideoPlay val fileToSetAsAvailableOffline = ArrayList() fileToSetAsAvailableOffline.add(file) fileOperationsViewModel.performOperation(SetFilesAsAvailableOffline(fileToSetAsAvailableOffline)) - Snackbar.make(binding.root, R.string.sync_file_nothing_to_do_msg, Snackbar.LENGTH_LONG).show() + showSnackbarMessage() true } @@ -408,7 +408,7 @@ class PreviewVideoActivity : FileActivity(), Player.Listener, OnPrepareVideoPlay val fileToUnsetAsAvailableOffline = ArrayList() fileToUnsetAsAvailableOffline.add(file) fileOperationsViewModel.performOperation(UnsetFilesAsAvailableOffline(fileToUnsetAsAvailableOffline)) - Snackbar.make(binding.root, R.string.sync_file_nothing_to_do_msg, Snackbar.LENGTH_LONG).show() + showSnackbarMessage() true } @@ -435,6 +435,15 @@ class PreviewVideoActivity : FileActivity(), Player.Listener, OnPrepareVideoPlay } } + private fun showSnackbarMessage(){ + val snackbarString = if (file.isAvailableOffline){ + R.string.confirmation_unset_available_offline + } else { + R.string.confirmation_set_available_offline + } + Snackbar.make(binding.root, snackbarString, Snackbar.LENGTH_LONG).show() + } + // The main_menu won't be displayed override fun onCreateOptionsMenu(menu: Menu): Boolean { return false diff --git a/owncloudApp/src/main/res/values/strings.xml b/owncloudApp/src/main/res/values/strings.xml index e16150338d5..a46cf6ba46d 100644 --- a/owncloudApp/src/main/res/values/strings.xml +++ b/owncloudApp/src/main/res/values/strings.xml @@ -369,6 +369,8 @@ Set as available offline Unset as available offline + The file was set as available offline correctly + The file was set as unavailable offline correctly Rename Remove Do you really want to remove %1$s?