From c17b8683f4ea248f7bf39cd83b5d7d64a05022ff Mon Sep 17 00:00:00 2001 From: wilinz Date: Fri, 3 Feb 2023 06:08:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=80=80=E5=87=BA=E6=92=AD?= =?UTF-8?q?=E6=94=BE=E7=95=8C=E9=9D=A2=E5=90=8E=E7=8A=B6=E6=80=81=E6=A0=8F?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E4=B8=8D=E5=8F=98=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 4 ++-- app/src/main/AndroidManifest.xml | 1 + .../yuetingmusic/ui/player/PlayerFragment.kt | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index aa2f2c2..2f750cf 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,8 +12,8 @@ android { applicationId "com.wilinz.yuetingmusic" minSdk 21 targetSdk 33 - versionCode 4 - versionName "1.1.2" + versionCode 5 + versionName "1.1.3" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d4b8063..a3b9045 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,6 +34,7 @@ diff --git a/app/src/main/java/com/wilinz/yuetingmusic/ui/player/PlayerFragment.kt b/app/src/main/java/com/wilinz/yuetingmusic/ui/player/PlayerFragment.kt index 77af22c..881b962 100644 --- a/app/src/main/java/com/wilinz/yuetingmusic/ui/player/PlayerFragment.kt +++ b/app/src/main/java/com/wilinz/yuetingmusic/ui/player/PlayerFragment.kt @@ -2,6 +2,7 @@ package com.wilinz.yuetingmusic.ui.player import android.annotation.SuppressLint import android.content.res.ColorStateList +import android.content.res.Configuration import android.graphics.Bitmap import android.graphics.Canvas import android.graphics.Color @@ -277,6 +278,20 @@ class PlayerFragment : Fragment() { } } + override fun onDestroy() { + super.onDestroy() + val currentNightMode = + requireContext().resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK + val window = requireActivity().window + when (currentNightMode) { + Configuration.UI_MODE_NIGHT_NO -> { + setStatusBarTint(window, true) + } // Night mode is not active, we're using the light theme + Configuration.UI_MODE_NIGHT_YES -> { + setStatusBarTint(window, false) + } // Night mode is active, we're using dark theme + } + } companion object { private const val TAG = "PlayerFragment"