Merge pull request #1093 from Bnyro/master

but fixes
This commit is contained in:
Bnyro 2022-08-19 15:16:25 +02:00 committed by GitHub
commit abff6e200f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -39,12 +39,16 @@ class VideoOptionsDialog(
/**
* Check whether the player is running by observing the notification
*/
val notificationManager =
context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.activeNotifications.forEach {
if (it.id == PLAYER_NOTIFICATION_ID) {
optionsList += context?.getString(R.string.add_to_queue)
try {
val notificationManager =
context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.activeNotifications.forEach {
if (it.id == PLAYER_NOTIFICATION_ID) {
optionsList += context?.getString(R.string.add_to_queue)
}
}
} catch (e: Exception) {
e.printStackTrace()
}
return MaterialAlertDialogBuilder(requireContext())

View File

@ -25,7 +25,7 @@ fun View?.setWatchProgressLength(videoId: String, duration: Long) {
.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
override fun onGlobalLayout() {
this@setWatchProgressLength.getViewTreeObserver().removeOnGlobalLayoutListener(this)
if (progress == null) {
if (progress == null || duration == 0L) {
view.visibility = View.GONE
return
}