Horis vor 2 Jahren
Ursprung
Commit
c8a140d956

+ 1 - 1
app/build.gradle

@@ -49,7 +49,7 @@ android {
     defaultConfig {
     defaultConfig {
         applicationId "io.legado.app"
         applicationId "io.legado.app"
         minSdk 21
         minSdk 21
-        targetSdk 34
+        targetSdk 35
         versionCode 10000 + gitCommits
         versionCode 10000 + gitCommits
         versionName version
         versionName version
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

+ 2 - 2
app/src/main/java/io/legado/app/constant/AppConst.kt

@@ -64,7 +64,7 @@ object AppConst {
         @Suppress("DEPRECATION")
         @Suppress("DEPRECATION")
         appCtx.packageManager.getPackageInfo(appCtx.packageName, PackageManager.GET_ACTIVITIES)
         appCtx.packageManager.getPackageInfo(appCtx.packageName, PackageManager.GET_ACTIVITIES)
             ?.let {
             ?.let {
-                appInfo.versionName = it.versionName
+                appInfo.versionName = it.versionName!!
                 appInfo.appVariant = when {
                 appInfo.appVariant = when {
                     it.packageName.contains("releaseA") -> AppVariant.BETA_RELEASEA
                     it.packageName.contains("releaseA") -> AppVariant.BETA_RELEASEA
                     isBeta -> AppVariant.BETA_RELEASE
                     isBeta -> AppVariant.BETA_RELEASE
@@ -86,7 +86,7 @@ object AppConst {
     private val sha256Signature: String by lazy {
     private val sha256Signature: String by lazy {
         val packageInfo =
         val packageInfo =
             appCtx.packageManager.getPackageInfo(appCtx.packageName, PackageManager.GET_SIGNATURES)
             appCtx.packageManager.getPackageInfo(appCtx.packageName, PackageManager.GET_SIGNATURES)
-        DigestUtil.sha256Hex(packageInfo.signatures[0].toByteArray()).uppercase()
+        DigestUtil.sha256Hex(packageInfo.signatures!![0].toByteArray()).uppercase()
     }
     }
 
 
     private val isOfficial = sha256Signature == OFFICIAL_SIGNATURE
     private val isOfficial = sha256Signature == OFFICIAL_SIGNATURE

+ 1 - 0
app/src/main/java/io/legado/app/constant/IntentAction.kt

@@ -21,4 +21,5 @@ object IntentAction {
     const val moveTo = "moveTo"
     const val moveTo = "moveTo"
     const val init = "init"
     const val init = "init"
     const val remove = "remove"
     const val remove = "remove"
+    const val stopPlay = "stopPlay"
 }
 }

+ 11 - 3
app/src/main/java/io/legado/app/model/AudioPlay.kt

@@ -233,7 +233,7 @@ object AudioPlay : CoroutineScope by MainScope() {
 
 
     fun skipTo(index: Int) {
     fun skipTo(index: Int) {
         Coroutine.async {
         Coroutine.async {
-            stop()
+            stopPlay()
             durChapterIndex = index
             durChapterIndex = index
             durChapterPos = 0
             durChapterPos = 0
             durPlayUrl = ""
             durPlayUrl = ""
@@ -244,7 +244,7 @@ object AudioPlay : CoroutineScope by MainScope() {
 
 
     fun prev() {
     fun prev() {
         Coroutine.async {
         Coroutine.async {
-            stop()
+            stopPlay()
             if (durChapterIndex > 0) {
             if (durChapterIndex > 0) {
                 durChapterIndex -= 1
                 durChapterIndex -= 1
                 durChapterPos = 0
                 durChapterPos = 0
@@ -256,7 +256,7 @@ object AudioPlay : CoroutineScope by MainScope() {
     }
     }
 
 
     fun next() {
     fun next() {
-        stop()
+        stopPlay()
         if (durChapterIndex + 1 < simulatedChapterSize) {
         if (durChapterIndex + 1 < simulatedChapterSize) {
             durChapterIndex += 1
             durChapterIndex += 1
             durChapterPos = 0
             durChapterPos = 0
@@ -284,6 +284,14 @@ object AudioPlay : CoroutineScope by MainScope() {
         context.startService(intent)
         context.startService(intent)
     }
     }
 
 
+    fun stopPlay() {
+        if (AudioPlayService.isRun) {
+            context.startService<AudioPlayService> {
+                action = IntentAction.stopPlay
+            }
+        }
+    }
+
     fun saveRead() {
     fun saveRead() {
         val book = book ?: return
         val book = book ?: return
         Coroutine.async {
         Coroutine.async {

+ 7 - 0
app/src/main/java/io/legado/app/service/AudioPlayService.kt

@@ -157,6 +157,13 @@ class AudioPlayService : BaseService(),
                     play()
                     play()
                 }
                 }
 
 
+                IntentAction.stopPlay -> {
+                    exoPlayer.stop()
+                    upPlayProgressJob?.cancel()
+                    AudioPlay.status = Status.STOP
+                    postEvent(EventBus.AUDIO_STATE, Status.STOP)
+                }
+
                 IntentAction.pause -> pause()
                 IntentAction.pause -> pause()
                 IntentAction.resume -> resume()
                 IntentAction.resume -> resume()
                 IntentAction.prev -> AudioPlay.prev()
                 IntentAction.prev -> AudioPlay.prev()

+ 1 - 1
app/src/main/java/io/legado/app/ui/association/VerificationCodeDialog.kt

@@ -103,7 +103,7 @@ class VerificationCodeDialog() : BaseDialogFragment(R.layout.dialog_verification
                     transition: Transition<in Bitmap>?
                     transition: Transition<in Bitmap>?
                 ) {
                 ) {
                     view ?: return
                     view ?: return
-                    val bitmap = resource.copy(resource.config, true)
+                    val bitmap = resource.copy(resource.config ?: Bitmap.Config.ARGB_8888, true)
                     ImageProvider.bitmapLruCache.put(url, bitmap)
                     ImageProvider.bitmapLruCache.put(url, bitmap)
                     binding.verificationCodeImageView.setImageBitmap(bitmap)
                     binding.verificationCodeImageView.setImageBitmap(bitmap)
                 }
                 }

+ 10 - 3
app/src/main/java/io/legado/app/utils/ActivityExtensions.kt

@@ -6,7 +6,13 @@ import android.graphics.Color
 import android.os.Build
 import android.os.Build
 import android.os.Bundle
 import android.os.Bundle
 import android.util.DisplayMetrics
 import android.util.DisplayMetrics
-import android.view.*
+import android.view.Gravity
+import android.view.View
+import android.view.ViewGroup
+import android.view.WindowInsets
+import android.view.WindowInsetsController
+import android.view.WindowManager
+import android.view.WindowMetrics
 import android.widget.FrameLayout
 import android.widget.FrameLayout
 import androidx.annotation.ColorInt
 import androidx.annotation.ColorInt
 import androidx.appcompat.app.AppCompatActivity
 import androidx.appcompat.app.AppCompatActivity
@@ -54,14 +60,13 @@ val WindowManager.windowSize: DisplayMetrics
         return displayMetrics
         return displayMetrics
     }
     }
 
 
+@Suppress("DEPRECATION")
 fun Activity.fullScreen() {
 fun Activity.fullScreen() {
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
         window.setDecorFitsSystemWindows(true)
         window.setDecorFitsSystemWindows(true)
     }
     }
-    @Suppress("DEPRECATION")
     window.decorView.systemUiVisibility =
     window.decorView.systemUiVisibility =
         View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
         View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
-    @Suppress("DEPRECATION")
     window.clearFlags(
     window.clearFlags(
         WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
         WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                 or WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
                 or WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
@@ -72,6 +77,7 @@ fun Activity.fullScreen() {
 /**
 /**
  * 设置状态栏颜色
  * 设置状态栏颜色
  */
  */
+@Suppress("DEPRECATION")
 fun Activity.setStatusBarColorAuto(
 fun Activity.setStatusBarColorAuto(
     @ColorInt color: Int,
     @ColorInt color: Int,
     isTransparent: Boolean,
     isTransparent: Boolean,
@@ -124,6 +130,7 @@ fun Activity.setLightStatusBar(isLightBar: Boolean) {
 /**
 /**
  * 设置导航栏颜色
  * 设置导航栏颜色
  */
  */
+@Suppress("DEPRECATION")
 fun Activity.setNavigationBarColorAuto(@ColorInt color: Int) {
 fun Activity.setNavigationBarColorAuto(@ColorInt color: Int) {
     val isLightBor = ColorUtils.isColorLight(color)
     val isLightBor = ColorUtils.isColorLight(color)
     window.navigationBarColor = color
     window.navigationBarColor = color

+ 1 - 1
app/src/main/java/io/legado/app/utils/canvasrecorder/pools/BitmapPool.kt

@@ -82,7 +82,7 @@ object BitmapPool {
     /**
     /**
      * A helper function to return the byte usage per pixel of a bitmap based on its configuration.
      * A helper function to return the byte usage per pixel of a bitmap based on its configuration.
      */
      */
-    private fun getBytesPerPixel(config: Bitmap.Config): Int {
+    private fun getBytesPerPixel(config: Bitmap.Config?): Int {
         return when (config) {
         return when (config) {
             Bitmap.Config.ARGB_8888 -> 4
             Bitmap.Config.ARGB_8888 -> 4
             Bitmap.Config.RGB_565, Bitmap.Config.ARGB_4444 -> 2
             Bitmap.Config.RGB_565, Bitmap.Config.ARGB_4444 -> 2

+ 1 - 1
build.gradle

@@ -2,7 +2,7 @@
 
 
 buildscript {
 buildscript {
     ext{
     ext{
-        compile_sdk_version = 34
+        compile_sdk_version = 35
         build_tool_version = '34.0.0'
         build_tool_version = '34.0.0'
 //        kotlin_version = '1.9.22'
 //        kotlin_version = '1.9.22'
 //        ksp_version = "1.0.17"
 //        ksp_version = "1.0.17"

+ 1 - 1
gradle/libs.versions.toml

@@ -2,7 +2,7 @@
 
 
 kotlin = "2.0.20"
 kotlin = "2.0.20"
 ksp = "2.0.20-1.0.24"
 ksp = "2.0.20-1.0.24"
-agp = "8.5.2"
+agp = "8.6.0"
 appcompat = "1.7.0"
 appcompat = "1.7.0"
 colorpicker = "1.1.0"
 colorpicker = "1.1.0"
 commonsText = "1.12.0"
 commonsText = "1.12.0"

+ 1 - 1
gradle/wrapper/gradle-wrapper.properties

@@ -1,6 +1,6 @@
 #Tue Aug 27 18:19:17 CST 2024
 #Tue Aug 27 18:19:17 CST 2024
 distributionBase=GRADLE_USER_HOME
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
 zipStoreBase=GRADLE_USER_HOME
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
 zipStorePath=wrapper/dists

+ 1 - 1
modules/book/build.gradle

@@ -13,7 +13,7 @@ android {
     }
     }
     defaultConfig {
     defaultConfig {
         minSdk 21
         minSdk 21
-        targetSdk 34
+        targetSdk 35
 
 
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         consumerProguardFiles "consumer-rules.pro"
         consumerProguardFiles "consumer-rules.pro"

+ 1 - 1
modules/rhino/build.gradle

@@ -15,7 +15,7 @@ android {
     }
     }
     defaultConfig {
     defaultConfig {
         minSdk 21
         minSdk 21
-        targetSdk 34
+        targetSdk 35
 
 
         consumerProguardFiles "consumer-rules.pro"
         consumerProguardFiles "consumer-rules.pro"
     }
     }