|
|
|
@ -203,18 +203,20 @@ class PlaylistAdapter(private val player: IPlayer) : DiffUtilAdapter<MediaWrappe |
|
|
|
} |
|
|
|
|
|
|
|
override fun onItemDismiss(position: Int) { |
|
|
|
val media = getItem(position) |
|
|
|
val message = String.format(AppContextProvider.appResources.getString(R.string.remove_playlist_item), media.title) |
|
|
|
if (player is Fragment) { |
|
|
|
UiTools.snackerWithCancel(player.requireActivity(), message, overAudioPlayer = true, action = {}) { |
|
|
|
model?.run { insertMedia(position, media) } |
|
|
|
} |
|
|
|
} else if (player is Activity) { |
|
|
|
UiTools.snackerWithCancel(player, message, action = {}) { |
|
|
|
model?.run { insertMedia(position, media) } |
|
|
|
model?.let { |
|
|
|
val media = getItem(position) |
|
|
|
val message = String.format(AppContextProvider.appResources.getString(R.string.remove_playlist_item), media.title) |
|
|
|
if (player is Fragment) { |
|
|
|
UiTools.snackerWithCancel(player.requireActivity(), message, overAudioPlayer = true, action = {}) { |
|
|
|
model?.run { insertMedia(it.getOriginalPosition(position), media) } |
|
|
|
} |
|
|
|
} else if (player is Activity) { |
|
|
|
UiTools.snackerWithCancel(player, message, action = {}) { |
|
|
|
model?.run { insertMedia(it.getOriginalPosition(position), media) } |
|
|
|
} |
|
|
|
} |
|
|
|
remove(position) |
|
|
|
} |
|
|
|
remove(position) |
|
|
|
} |
|
|
|
|
|
|
|
fun setModel(model: PlaylistModel) { |
|
|
|
|