diff --git a/app/build.gradle b/app/build.gradle index 2756a90d8..20e43e999 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -49,7 +49,7 @@ android { defaultConfig { applicationId "io.legado.app" minSdk 21 - targetSdk 34 + targetSdk 35 versionCode 10000 + gitCommits versionName version testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/app/src/main/java/io/legado/app/constant/AppConst.kt b/app/src/main/java/io/legado/app/constant/AppConst.kt index 431d867a0..2b8cbf395 100644 --- a/app/src/main/java/io/legado/app/constant/AppConst.kt +++ b/app/src/main/java/io/legado/app/constant/AppConst.kt @@ -64,7 +64,7 @@ object AppConst { @Suppress("DEPRECATION") appCtx.packageManager.getPackageInfo(appCtx.packageName, PackageManager.GET_ACTIVITIES) ?.let { - appInfo.versionName = it.versionName + appInfo.versionName = it.versionName!! appInfo.appVariant = when { it.packageName.contains("releaseA") -> AppVariant.BETA_RELEASEA isBeta -> AppVariant.BETA_RELEASE @@ -86,7 +86,7 @@ object AppConst { private val sha256Signature: String by lazy { val packageInfo = 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 diff --git a/app/src/main/java/io/legado/app/constant/IntentAction.kt b/app/src/main/java/io/legado/app/constant/IntentAction.kt index 3659eda6b..5a603fa1d 100644 --- a/app/src/main/java/io/legado/app/constant/IntentAction.kt +++ b/app/src/main/java/io/legado/app/constant/IntentAction.kt @@ -21,4 +21,5 @@ object IntentAction { const val moveTo = "moveTo" const val init = "init" const val remove = "remove" + const val stopPlay = "stopPlay" } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/model/AudioPlay.kt b/app/src/main/java/io/legado/app/model/AudioPlay.kt index d28a5ecbb..e920dd211 100644 --- a/app/src/main/java/io/legado/app/model/AudioPlay.kt +++ b/app/src/main/java/io/legado/app/model/AudioPlay.kt @@ -233,7 +233,7 @@ object AudioPlay : CoroutineScope by MainScope() { fun skipTo(index: Int) { Coroutine.async { - stop() + stopPlay() durChapterIndex = index durChapterPos = 0 durPlayUrl = "" @@ -244,7 +244,7 @@ object AudioPlay : CoroutineScope by MainScope() { fun prev() { Coroutine.async { - stop() + stopPlay() if (durChapterIndex > 0) { durChapterIndex -= 1 durChapterPos = 0 @@ -256,7 +256,7 @@ object AudioPlay : CoroutineScope by MainScope() { } fun next() { - stop() + stopPlay() if (durChapterIndex + 1 < simulatedChapterSize) { durChapterIndex += 1 durChapterPos = 0 @@ -284,6 +284,14 @@ object AudioPlay : CoroutineScope by MainScope() { context.startService(intent) } + fun stopPlay() { + if (AudioPlayService.isRun) { + context.startService { + action = IntentAction.stopPlay + } + } + } + fun saveRead() { val book = book ?: return Coroutine.async { diff --git a/app/src/main/java/io/legado/app/service/AudioPlayService.kt b/app/src/main/java/io/legado/app/service/AudioPlayService.kt index ee0f3c361..5cbac5d2b 100644 --- a/app/src/main/java/io/legado/app/service/AudioPlayService.kt +++ b/app/src/main/java/io/legado/app/service/AudioPlayService.kt @@ -157,6 +157,13 @@ class AudioPlayService : BaseService(), play() } + IntentAction.stopPlay -> { + exoPlayer.stop() + upPlayProgressJob?.cancel() + AudioPlay.status = Status.STOP + postEvent(EventBus.AUDIO_STATE, Status.STOP) + } + IntentAction.pause -> pause() IntentAction.resume -> resume() IntentAction.prev -> AudioPlay.prev() diff --git a/app/src/main/java/io/legado/app/ui/association/VerificationCodeDialog.kt b/app/src/main/java/io/legado/app/ui/association/VerificationCodeDialog.kt index 335d18a14..8190841e9 100644 --- a/app/src/main/java/io/legado/app/ui/association/VerificationCodeDialog.kt +++ b/app/src/main/java/io/legado/app/ui/association/VerificationCodeDialog.kt @@ -103,7 +103,7 @@ class VerificationCodeDialog() : BaseDialogFragment(R.layout.dialog_verification transition: Transition? ) { 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) binding.verificationCodeImageView.setImageBitmap(bitmap) } diff --git a/app/src/main/java/io/legado/app/utils/ActivityExtensions.kt b/app/src/main/java/io/legado/app/utils/ActivityExtensions.kt index f5c722697..412b92416 100644 --- a/app/src/main/java/io/legado/app/utils/ActivityExtensions.kt +++ b/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.Bundle 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 androidx.annotation.ColorInt import androidx.appcompat.app.AppCompatActivity @@ -54,14 +60,13 @@ val WindowManager.windowSize: DisplayMetrics return displayMetrics } +@Suppress("DEPRECATION") fun Activity.fullScreen() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { window.setDecorFitsSystemWindows(true) } - @Suppress("DEPRECATION") window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_STABLE - @Suppress("DEPRECATION") window.clearFlags( WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS or WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION @@ -72,6 +77,7 @@ fun Activity.fullScreen() { /** * 设置状态栏颜色 */ +@Suppress("DEPRECATION") fun Activity.setStatusBarColorAuto( @ColorInt color: Int, isTransparent: Boolean, @@ -124,6 +130,7 @@ fun Activity.setLightStatusBar(isLightBar: Boolean) { /** * 设置导航栏颜色 */ +@Suppress("DEPRECATION") fun Activity.setNavigationBarColorAuto(@ColorInt color: Int) { val isLightBor = ColorUtils.isColorLight(color) window.navigationBarColor = color diff --git a/app/src/main/java/io/legado/app/utils/canvasrecorder/pools/BitmapPool.kt b/app/src/main/java/io/legado/app/utils/canvasrecorder/pools/BitmapPool.kt index a9539035e..33d6e3be5 100644 --- a/app/src/main/java/io/legado/app/utils/canvasrecorder/pools/BitmapPool.kt +++ b/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. */ - private fun getBytesPerPixel(config: Bitmap.Config): Int { + private fun getBytesPerPixel(config: Bitmap.Config?): Int { return when (config) { Bitmap.Config.ARGB_8888 -> 4 Bitmap.Config.RGB_565, Bitmap.Config.ARGB_4444 -> 2 diff --git a/build.gradle b/build.gradle index b9dd69223..8b2ec01bf 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ buildscript { ext{ - compile_sdk_version = 34 + compile_sdk_version = 35 build_tool_version = '34.0.0' // kotlin_version = '1.9.22' // ksp_version = "1.0.17" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cff31bbcb..204a349de 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,7 @@ kotlin = "2.0.20" ksp = "2.0.20-1.0.24" -agp = "8.5.2" +agp = "8.6.0" appcompat = "1.7.0" colorpicker = "1.1.0" commonsText = "1.12.0" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 81842b0ae..a8721e2ec 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Tue Aug 27 18:19:17 CST 2024 distributionBase=GRADLE_USER_HOME 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 zipStorePath=wrapper/dists diff --git a/modules/book/build.gradle b/modules/book/build.gradle index 6f2d95dc5..f57f58995 100644 --- a/modules/book/build.gradle +++ b/modules/book/build.gradle @@ -13,7 +13,7 @@ android { } defaultConfig { minSdk 21 - targetSdk 34 + targetSdk 35 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" diff --git a/modules/rhino/build.gradle b/modules/rhino/build.gradle index 8ae10e567..1b2c7998e 100644 --- a/modules/rhino/build.gradle +++ b/modules/rhino/build.gradle @@ -15,7 +15,7 @@ android { } defaultConfig { minSdk 21 - targetSdk 34 + targetSdk 35 consumerProguardFiles "consumer-rules.pro" }