Skip to content

Commit

Permalink
use coordinator layout to keep the snackbar attached to fragment for …
Browse files Browse the repository at this point in the history
…messages related to particular file

Signed-off-by: parneet-guraya <[email protected]>
  • Loading branch information
parneet-guraya committed Sep 5, 2024
1 parent 48c9add commit 4af7335
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ class PreviewImageFragment : FileFragment(), Injectable {
private fun onFileActionChosen(itemId: Int) {
if (itemId == R.id.action_send_share_file) {
if (file.isSharedWithMe && !file.canReshare()) {
Snackbar.make(requireView(), R.string.resharing_is_not_allowed, Snackbar.LENGTH_LONG).show()
Snackbar.make(binding.top, R.string.resharing_is_not_allowed, Snackbar.LENGTH_LONG).show()
} else {
containerActivity.fileOperationsHelper.sendShareFile(file)
}
Expand Down Expand Up @@ -725,7 +725,7 @@ class PreviewImageFragment : FileFragment(), Injectable {
try {
if (activity != null) {
Snackbar.make(
binding.emptyListView,
binding.top,
R.string.resized_image_not_possible_download,
Snackbar.LENGTH_INDEFINITE
)
Expand All @@ -737,7 +737,7 @@ class PreviewImageFragment : FileFragment(), Injectable {
activity.requestForDownload(file)
} else if (context != null) {
Snackbar.make(
binding.emptyListView,
binding.top,
resources.getString(R.string.could_not_download_image),
Snackbar.LENGTH_INDEFINITE
).show()
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/preview_image_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
~ SPDX-FileCopyrightText: 2013 David A. Velasco <[email protected]>
~ SPDX-License-Identifier: GPL-2.0-only AND (AGPL-3.0-or-later OR GPL-2.0-only)
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/top"
Expand Down Expand Up @@ -119,4 +119,4 @@
android:src="@drawable/ic_image_outline" />

</FrameLayout>
</FrameLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

0 comments on commit 4af7335

Please sign in to comment.