Skip to content

Commit

Permalink
Merge pull request #6080 from Bnyro/master
Browse files Browse the repository at this point in the history
fix: explicitely set status bar color after app start
  • Loading branch information
Bnyro authored May 26, 2024
2 parents 1ffb180 + a481a71 commit aa40047
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 3 additions & 0 deletions app/src/main/java/com/github/libretube/helpers/ThemeHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.text.HtmlCompat
import androidx.core.text.parseAsHtml
import androidx.core.view.WindowCompat
import com.github.libretube.R
import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.ui.adapters.IconsSheetAdapter
Expand All @@ -40,6 +41,8 @@ object ThemeHelper {
} else {
getThemeColor(context, android.R.attr.colorBackground)
}
WindowCompat.getInsetsController(window, window.decorView)
.isAppearanceLightStatusBars = !isDarkMode(context)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ import com.github.libretube.helpers.PlayerHelper.getVideoStats
import com.github.libretube.helpers.PlayerHelper.isInSegment
import com.github.libretube.helpers.PreferenceHelper
import com.github.libretube.helpers.ProxyHelper
import com.github.libretube.helpers.ThemeHelper
import com.github.libretube.helpers.WindowHelper
import com.github.libretube.obj.PlayerNotificationData
import com.github.libretube.obj.ShareData
Expand Down Expand Up @@ -692,12 +693,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
@SuppressLint("SourceLockedOrientationActivity")
fun unsetFullscreen() {
// 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
}
windowInsetsControllerCompat.isAppearanceLightStatusBars = !ThemeHelper.isDarkMode(requireContext())

viewModel.isFullscreen.value = false

Expand Down

0 comments on commit aa40047

Please sign in to comment.