Преглед изворни кода

Merge branch 'master' of github.com:gedoor/legado

Xwite пре 3 година
родитељ
комит
a777c4781e

+ 5 - 8
app/build.gradle

@@ -71,8 +71,8 @@ android {
             }
             applicationIdSuffix '.release'
 
-            minifyEnabled false
-            //shrinkResources true
+            minifyEnabled true
+            shrinkResources true
             proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
         }
         debug {
@@ -149,7 +149,7 @@ dependencies {
     //noinspection GradleDependency,DifferentStdlibGradleVersion
     implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version")
     //协程
-    def coroutines_version = '1.7.0'
+    def coroutines_version = '1.7.1'
     implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
     implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version")
 
@@ -157,7 +157,7 @@ dependencies {
     implementation('com.github.android:renderscript-intrinsics-replacement-toolkit:b6363490c3')
 
     //androidX
-    implementation('androidx.core:core-ktx:1.10.0')
+    implementation('androidx.core:core-ktx:1.10.1')
     implementation('androidx.appcompat:appcompat:1.6.1')
     implementation('androidx.activity:activity-ktx:1.7.1')
     implementation('androidx.fragment:fragment-ktx:1.5.7')
@@ -186,9 +186,6 @@ dependencies {
     // For exposing and controlling media sessions
     //implementation "androidx.media3:media3-session:$media3_version"
 
-//    implementation("com.google.android.exoplayer:exoplayer-core:$exoplayer_version")
-//    implementation("com.google.android.exoplayer:extension-okhttp:$exoplayer_version")
-
     //Splitties
     implementation("com.louiscad.splitties:splitties-appctx:$splitties_version")
     implementation("com.louiscad.splitties:splitties-systemservices:$splitties_version")
@@ -217,7 +214,7 @@ dependencies {
     //网络
     implementation('com.squareup.okhttp3:okhttp:4.11.0')
     appImplementation(fileTree(dir: 'cronetlib', include: ['*.jar', '*.aar']))
-    appImplementation 'com.google.protobuf:protobuf-javalite:3.22.4'
+    appImplementation 'com.google.protobuf:protobuf-javalite:3.23.0'
 
     //Glide
     def glideVersion = "4.15.1"

+ 4 - 6
app/src/main/java/io/legado/app/help/exoplayer/ExoPlayerHelper.kt

@@ -20,9 +20,9 @@ import androidx.media3.exoplayer.offline.DefaultDownloaderFactory
 import androidx.media3.exoplayer.offline.DownloadRequest
 import androidx.media3.exoplayer.offline.DownloaderFactory
 import androidx.media3.exoplayer.source.DefaultMediaSourceFactory
-import com.google.gson.GsonBuilder
 import com.google.gson.reflect.TypeToken
 import io.legado.app.help.http.okHttpClient
+import io.legado.app.utils.GSON
 import okhttp3.CacheControl
 import splitties.init.appCtx
 import java.io.File
@@ -30,21 +30,19 @@ import java.lang.reflect.Type
 import java.util.concurrent.TimeUnit
 
 
+@Suppress("unused")
 @SuppressLint("UnsafeOptInUsageError")
 object ExoPlayerHelper {
 
     private const val SPLIT_TAG = "\uD83D\uDEA7"
 
-    private val gson by lazy {
-        GsonBuilder().create()
-    }
     private val mapType by lazy {
         val type: Type = object : TypeToken<Map<String?, String?>?>() {}.type
         type
     }
 
     fun createMediaItem(url: String, headers: Map<String, String>): MediaItem {
-        val formatUrl = url + SPLIT_TAG + gson.toJson(headers, mapType)
+        val formatUrl = url + SPLIT_TAG + GSON.toJson(headers, mapType)
         return MediaItem.Builder().setUri(formatUrl).build()
     }
 
@@ -103,7 +101,7 @@ object ExoPlayerHelper {
                 val url = urls[0]
                 res = res.withUri(Uri.parse(url))
                 try {
-                    val headers: Map<String, String> = gson.fromJson(urls[1], mapType)
+                    val headers: Map<String, String> = GSON.fromJson(urls[1], mapType)
                     res = res.withAdditionalHeaders(headers)
                 } catch (_: Exception) {
                 }

+ 1 - 1
app/src/main/java/io/legado/app/service/BaseReadAloudService.kt

@@ -311,7 +311,7 @@ abstract class BaseReadAloudService : BaseService(),
     }
 
     /**
-     * 断开耳机监听
+     * 注册多媒体按钮监听
      */
     private fun initBroadcastReceiver() {
         val intentFilter = IntentFilter(AudioManager.ACTION_AUDIO_BECOMING_NOISY)

+ 3 - 1
gradle.properties

@@ -6,7 +6,9 @@
 # http://www.gradle.org/docs/current/userguide/build_environment.html
 # Specifies the JVM arguments used for the daemon process.
 # The setting is particularly useful for tweaking memory settings.
-org.gradle.jvmargs=-Xmx6000m
+# Default value: -Xmx512m -Xms256m -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError
+# Bugs: This will override important JVM argument defaults. Include all important JVM arguments if you wan to change arguments. See https://github.com/gradle/gradle/issues/19750
+org.gradle.jvmargs=-XX:+UseParallelGC -Xmx6g -Xms256m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
 # When configured, Gradle will run in incubating parallel mode.
 # This option should only be used with decoupled projects. More details, visit
 # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects