Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for sdk21, updated some versions #1253

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ if (isFullBuild && System.getenv("PULL_REQUEST") == null) {

android {
namespace = "com.zionhuang.music"
compileSdk = 33
compileSdk = 34
buildToolsVersion = "30.0.3"
defaultConfig {
applicationId = "com.zionhuang.music"
minSdk = 24
targetSdk = 33
minSdk = 21
targetSdk = 34
versionCode = 19
versionName = "0.5.3"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -65,15 +65,15 @@ android {
}
compileOptions {
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlin {
jvmToolchain(11)
jvmToolchain(17)
}
kotlinOptions {
freeCompilerArgs = freeCompilerArgs + "-Xcontext-receivers"
jvmTarget = "11"
jvmTarget = "17"
}
testOptions {
unitTests.isIncludeAndroidResources = true
Expand Down Expand Up @@ -149,4 +149,6 @@ dependencies {
"fullImplementation"(libs.opencc4j)

implementation(libs.timber)


}
1 change: 1 addition & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,4 @@
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
-dontwarn org.openjsse.net.ssl.OpenJSSE
-dontwarn org.slf4j.impl.StaticLoggerBinder
5 changes: 4 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/>

<queries>
<intent>
Expand Down Expand Up @@ -133,7 +135,8 @@

<service
android:name=".playback.ExoDownloadService"
android:exported="false">
android:exported="false"
android:foregroundServiceType="dataSync">
<intent-filter>
<action android:name="androidx.media3.exoplayer.downloadService.action.RESTART" />
<category android:name="android.intent.category.DEFAULT" />
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/java/com/zionhuang/music/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.zionhuang.music

import android.app.Application
import android.os.Build
import android.util.Log
import android.widget.Toast
import android.widget.Toast.LENGTH_SHORT
import androidx.datastore.preferences.core.edit
Expand Down Expand Up @@ -44,10 +45,13 @@ class App : Application(), ImageLoaderFactory {
?: languageTag.takeIf { it in LanguageCodeToName }
?: "en"
)
if (languageTag == "zh-TW") {
if (languageTag == "zh-TW" ) {
KuGou.useTraditionalChinese = true
}


KuGou.APILEVEL = Build.VERSION.SDK_INT.also { Log.d("KuGou", "APILEVEL: $it") }

if (dataStore[ProxyEnabledKey] == true) {
try {
YouTube.proxy = Proxy(
Expand Down
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id("com.google.dagger.hilt.android").version("2.44").apply(false)
id("com.google.devtools.ksp").version("1.8.0-1.0.9").apply(false)
id("com.google.dagger.hilt.android").version("2.51").apply(false)
id("com.google.devtools.ksp").version("1.9.23-1.0.19").apply(false)
}

buildscript {
Expand Down Expand Up @@ -40,4 +40,4 @@ subprojects {
}
}
}
}
}
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M"
android.useAndroidX=true
android.enableJetifier=true
org.gradle.unsafe.configuration-cache=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
18 changes: 10 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[versions]
androidGradlePlugin = "7.4.2"
kotlin = "1.8.0"
compose-compiler = "1.4.0"
androidGradlePlugin = "8.3.1"
kotlin = "1.9.23"
compose-compiler = "1.5.11"
compose = "1.3.3"
lifecycle = "2.6.1"
material3 = "1.1.0-alpha05"
media3 = "1.1.1"
room = "2.5.2"
hilt = "2.46.1"
hilt = "2.51"
ktor = "2.2.2"
annotationJvm = "1.7.1"

[libraries]
guava = { group = "com.google.guava", name = "guava", version = "31.0.1-android" }
Expand All @@ -18,7 +19,7 @@ concurrent-futures = { group = "androidx.concurrent", name = "concurrent-futures
gradle = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" }
activity = { group = "androidx.activity", name = "activity-compose", version = "1.7.2" }
navigation = { group = "androidx.navigation", name = "navigation-compose", version = "2.5.3" }
hilt-navigation = { group = "androidx.hilt", name = "hilt-navigation-compose", version = "1.0.0" }
hilt-navigation = { group = "androidx.hilt", name = "hilt-navigation-compose", version = "1.2.0" }
datastore = { group = "androidx.datastore", name = "datastore-preferences", version = "1.0.0" }

compose-runtime = { group = "androidx.compose.runtime", name = "runtime", version.ref = "compose" }
Expand Down Expand Up @@ -69,7 +70,7 @@ brotli = { group = "org.brotli", name = "dec", version = "0.1.2" }

opencc4j = { group = "com.github.houbb", name = "opencc4j", version = "1.7.2" }

desugaring = { group = "com.android.tools", name = "desugar_jdk_libs", version = "1.1.5" }
desugaring = { group = "com.android.tools", name = "desugar_jdk_libs", version = "2.0.4" }

junit = { group = "junit", name = "junit", version = "4.13.2" }

Expand All @@ -84,8 +85,9 @@ firebase-config = { group = "com.google.firebase", name = "firebase-config-ktx"
firebase-perf = { group = "com.google.firebase", name = "firebase-perf-ktx" }
firebase-perf-plugin = { module = "com.google.firebase:perf-plugin", version = "1.4.2" }

mlkit-language-id = { group = "com.google.mlkit", name = "language-id", version = "17.0.4" }
mlkit-translate = { group = "com.google.mlkit", name = "translate", version = "17.0.1" }
mlkit-language-id = { group = "com.google.mlkit", name = "language-id", version = "17.0.5" }
mlkit-translate = { group = "com.google.mlkit", name = "translate", version = "17.0.2" }
annotation-jvm = { group = "androidx.annotation", name = "annotation-jvm", version.ref = "annotationJvm" }

[plugins]
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Oct 04 14:57:57 CST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
2 changes: 1 addition & 1 deletion innertube/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

kotlin {
jvmToolchain(11)
jvmToolchain(17)
}

dependencies {
Expand Down
3 changes: 2 additions & 1 deletion kugou/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

kotlin {
jvmToolchain(11)
jvmToolchain(17)
}

dependencies {
Expand All @@ -15,5 +15,6 @@ dependencies {
implementation(libs.ktor.serialization.json)
implementation(libs.ktor.client.encoding)
implementation(libs.opencc4j)
implementation(libs.annotation.jvm)
testImplementation(libs.junit)
}
12 changes: 10 additions & 2 deletions kugou/src/main/java/com/zionhuang/kugou/KuGou.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.zionhuang.kugou

import androidx.annotation.RequiresApi
import com.github.houbb.opencc4j.util.ZhConverterUtil
import com.zionhuang.kugou.models.DownloadLyricsResponse
import com.zionhuang.kugou.models.SearchLyricsResponse
Expand All @@ -16,16 +17,22 @@ import io.ktor.serialization.kotlinx.json.*
import io.ktor.util.*
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.json.Json
import org.apiguardian.api.API
import java.lang.Character.UnicodeScript
import java.lang.Character.UnicodeScript.of
import java.lang.Integer.min
import kotlin.math.abs
import kotlin.properties.Delegates

/**
* KuGou Lyrics Library
* Modified from [ViMusic](https://github.com/vfsfitvnm/ViMusic)
*/
object KuGou {
var useTraditionalChinese: Boolean = false
var APILEVEL: Int = 21



@OptIn(ExperimentalSerializationApi::class)
private val client = HttpClient {
Expand Down Expand Up @@ -193,10 +200,11 @@ object KuGou {
private val ACCEPTED_REGEX = "\\[(\\d\\d):(\\d\\d)\\.(\\d{2,3})\\].*".toRegex()
private val BANNED_REGEX = ".+].+[::].+".toRegex()

private val JapaneseUnicodeScript = hashSetOf(
private val JapaneseUnicodeScript =
if (APILEVEL >= 24) {hashSetOf(
UnicodeScript.HIRAGANA,
UnicodeScript.KATAKANA,
)
)} else hashSetOf()

private const val DURATION_TOLERANCE = 8
}
4 changes: 2 additions & 2 deletions material-color-utilities/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ plugins {
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

dependencies {
Expand Down