Merge pull request #6080 from Bnyro/master

fix: explicitely set status bar color after app start
This commit is contained in:
Bnyro 2024-05-26 18:16:21 +02:00 committed by GitHub
commit aa40047b4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 6 deletions

View File

@ -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
@ -40,6 +41,8 @@ object ThemeHelper {
} else {
getThemeColor(context, android.R.attr.colorBackground)
}
WindowCompat.getInsetsController(window, window.decorView)
.isAppearanceLightStatusBars = !isDarkMode(context)
}
/**

View File

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