Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dark status bar icons when player is in fullscreen #3445

Merged
merged 5 commits into from
Mar 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import androidx.core.net.toUri
import androidx.core.os.bundleOf
import androidx.core.os.postDelayed
import androidx.core.text.parseAsHtml
import androidx.core.view.WindowCompat
import androidx.core.view.isInvisible
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
Expand Down Expand Up @@ -183,6 +184,8 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {

private val handler = Handler(Looper.getMainLooper())
private val mainActivity get() = activity as MainActivity
private val windowInsetsControllerCompat get() = WindowCompat
.getInsetsController(mainActivity.window, mainActivity.window.decorView)

/**
* Receiver for all actions in the PiP mode
Expand Down Expand Up @@ -495,6 +498,9 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
enableTransition(R.id.yt_transition, false)
}

// set status bar icon color to white
windowInsetsControllerCompat.isAppearanceLightStatusBars = false

binding.mainContainer.isClickable = true
binding.linLayout.visibility = View.GONE
playerBinding.fullscreen.setImageResource(R.drawable.ic_fullscreen_exit)
Expand All @@ -520,6 +526,14 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
enableTransition(R.id.yt_transition, true)
}

// set status bar icon color back to theme color
windowInsetsControllerCompat.isAppearanceLightStatusBars =
when (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) {
Configuration.UI_MODE_NIGHT_YES -> false
Configuration.UI_MODE_NIGHT_NO -> true
else -> true
}

binding.mainContainer.isClickable = false
binding.linLayout.visibility = View.VISIBLE
playerBinding.fullscreen.setImageResource(R.drawable.ic_fullscreen)
Expand Down