Browse Source

Add an indefinite option to the confirmation snackbar

merge-requests/2174/head
Nicolas Pomepuy 1 year ago
committed by Duncan McNamara
parent
commit
6ac89a3209
  1. 4
      application/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt

4
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)

Loading…
Cancel
Save