Skip to content

Commit

Permalink
fix(player): hide system bars when closing dialog on API < 30
Browse files Browse the repository at this point in the history
  • Loading branch information
jarnedemeulemeester committed Aug 31, 2024
1 parent 8c148f3 commit ed6c6e8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package dev.jdtech.jellyfin.dialogs

import android.app.Dialog
import android.os.Bundle
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat
import androidx.fragment.app.DialogFragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import dev.jdtech.jellyfin.player.video.R
Expand Down Expand Up @@ -30,4 +33,15 @@ class SpeedSelectionDialogFragment(
builder.create()
} ?: throw IllegalStateException("Activity cannot be null")
}

override fun onDestroy() {
super.onDestroy()
// Fix for hiding the system bars on API < 30
activity?.window?.let {
WindowCompat.getInsetsController(it, it.decorView).apply {
systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
hide(WindowInsetsCompat.Type.systemBars())
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package dev.jdtech.jellyfin.dialogs

import android.app.Dialog
import android.os.Bundle
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat
import androidx.fragment.app.DialogFragment
import androidx.media3.common.C
import com.google.android.material.dialog.MaterialAlertDialogBuilder
Expand Down Expand Up @@ -38,4 +41,15 @@ class TrackSelectionDialogFragment(
builder.create()
} ?: throw IllegalStateException("Activity cannot be null")
}

override fun onDestroy() {
super.onDestroy()
// Fix for hiding the system bars on API < 30
activity?.window?.let {
WindowCompat.getInsetsController(it, it.decorView).apply {
systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
hide(WindowInsetsCompat.Type.systemBars())
}
}
}
}

0 comments on commit ed6c6e8

Please sign in to comment.