[Android] Add an indefinite option to the confirmation snackbar

Nicolas Pomepuy git at videolan.org
Fri Feb 28 10:58:03 UTC 2025


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Feb 25 15:28:50 2025 +0100| [6ac89a3209018e5555a7b91bae3e55475329c43f] | committer: Duncan McNamara

Add an indefinite option to the confirmation snackbar

> https://code.videolan.org/videolan/vlc-android/commit/6ac89a3209018e5555a7b91bae3e55475329c43f
---

 application/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt b/application/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt
index 916321ce31..65e748549b 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt
@@ -303,9 +303,9 @@ object UiTools {
      * Print an on-screen message to alert the user, with undo action
      */
     @TargetApi(Build.VERSION_CODES.LOLLIPOP)
-    fun snackerConfirm(activity: Activity, message: String, overAudioPlayer: Boolean = false, @StringRes confirmMessage:Int = R.string.ok, action: () -> Unit) {
+    fun snackerConfirm(activity: Activity, message: String, overAudioPlayer: Boolean = false, @StringRes confirmMessage:Int = R.string.ok, indefinite:Boolean = false, action: () -> Unit) {
         val view = getSnackAnchorView(activity, overAudioPlayer) ?: return
-        val snack = Snackbar.make(view, message, Snackbar.LENGTH_LONG)
+        val snack = Snackbar.make(view, message, if (indefinite) Snackbar.LENGTH_INDEFINITE else Snackbar.LENGTH_LONG)
                 .setAction(confirmMessage) { action.invoke() }
         if (overAudioPlayer) snack.setAnchorView(R.id.time)
         if (VlcMigrationHelper.isLolliPopOrLater)



More information about the Android mailing list