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,6 +39,7 @@ class VideoOptionsDialog(
/** /**
* Check whether the player is running by observing the notification * Check whether the player is running by observing the notification
*/ */
try {
val notificationManager = val notificationManager =
context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.activeNotifications.forEach { notificationManager.activeNotifications.forEach {
@ -46,6 +47,9 @@ class VideoOptionsDialog(
optionsList += context?.getString(R.string.add_to_queue) optionsList += context?.getString(R.string.add_to_queue)
} }
} }
} catch (e: Exception) {
e.printStackTrace()
}
return MaterialAlertDialogBuilder(requireContext()) return MaterialAlertDialogBuilder(requireContext())
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)

View File

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