Uploads: Snackbar

This commit is contained in:
Benoit Marty 2020-05-20 14:49:01 +02:00
parent f0f3e8ddb9
commit c52aae7c29
2 changed files with 4 additions and 3 deletions

View File

@ -18,11 +18,11 @@ package im.vector.riotx.features.roomprofile.uploads
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import android.widget.Toast
import androidx.core.net.toUri import androidx.core.net.toUri
import com.airbnb.mvrx.args import com.airbnb.mvrx.args
import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState import com.airbnb.mvrx.withState
import com.google.android.material.snackbar.Snackbar
import com.google.android.material.tabs.TabLayoutMediator import com.google.android.material.tabs.TabLayoutMediator
import im.vector.matrix.android.api.util.toMatrixItem import im.vector.matrix.android.api.util.toMatrixItem
import im.vector.riotx.R import im.vector.riotx.R
@ -77,9 +77,9 @@ class RoomUploadsFragment @Inject constructor(
mediaMimeType = getMimeTypeFromUri(requireContext(), it.file.toUri()) mediaMimeType = getMimeTypeFromUri(requireContext(), it.file.toUri())
) )
if (saved) { if (saved) {
Toast.makeText(requireContext(), R.string.media_file_added_to_gallery, Toast.LENGTH_LONG).show() Snackbar.make(roomUploadsCoordinator, R.string.media_file_added_to_gallery, Snackbar.LENGTH_LONG).show()
} else { } else {
Toast.makeText(requireContext(), R.string.error_adding_media_file_to_gallery, Toast.LENGTH_LONG).show() Snackbar.make(roomUploadsCoordinator, R.string.error_adding_media_file_to_gallery, Snackbar.LENGTH_LONG).show()
} }
} }
is RoomUploadsViewEvents.Failure -> showFailure(it.throwable) is RoomUploadsViewEvents.Failure -> showFailure(it.throwable)

View File

@ -2,6 +2,7 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/roomUploadsCoordinator"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">