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 * Check whether the player is running by observing the notification
*/ */
val notificationManager = try {
context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager val notificationManager =
notificationManager.activeNotifications.forEach { context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
if (it.id == PLAYER_NOTIFICATION_ID) { notificationManager.activeNotifications.forEach {
optionsList += context?.getString(R.string.add_to_queue) if (it.id == PLAYER_NOTIFICATION_ID) {
optionsList += context?.getString(R.string.add_to_queue)
}
} }
} catch (e: Exception) {
e.printStackTrace()
} }
return MaterialAlertDialogBuilder(requireContext()) return MaterialAlertDialogBuilder(requireContext())

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
} }