新批次的夜间模式适配代码
This commit is contained in:
@@ -6,7 +6,7 @@ plugins {
|
||||
|
||||
android {
|
||||
namespace = "com.lxh.battery_health"
|
||||
compileSdk = 34
|
||||
compileSdk = 36
|
||||
ndkVersion = flutter.ndkVersion
|
||||
|
||||
compileOptions {
|
||||
|
||||
@@ -12,6 +12,7 @@ import android.os.Bundle
|
||||
import android.provider.DocumentsContract
|
||||
import android.provider.OpenableColumns
|
||||
import android.view.Window // 🟢 必须包含
|
||||
import android.app.Activity
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.annotation.NonNull
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
@@ -135,7 +136,7 @@ class MainActivity : FlutterActivity() {
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (requestCode == FOLDER_PICKER_REQUEST && resultCode == ComponentActivity.RESULT_OK) {
|
||||
if (requestCode == FOLDER_PICKER_REQUEST && resultCode == Activity.RESULT_OK) {
|
||||
val uri = data?.data
|
||||
if (uri != null) {
|
||||
try {
|
||||
|
||||
+10
-19
@@ -1,33 +1,24 @@
|
||||
allprojects {
|
||||
repositories {
|
||||
maven {
|
||||
url = uri("https://maven.aliyun.com/repository/public")
|
||||
}
|
||||
maven {
|
||||
url = uri("https://maven.aliyun.com/repository/google")
|
||||
}
|
||||
maven {
|
||||
url = uri("https://maven.aliyun.com/repository/gradle-plugin")
|
||||
}
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
// 根项目构建脚本
|
||||
plugins {
|
||||
id("com.android.application") version "8.13.0" apply false
|
||||
id("org.jetbrains.kotlin.android") version "2.2.21" apply false
|
||||
}
|
||||
|
||||
val newBuildDir: Directory =
|
||||
rootProject.layout.buildDirectory
|
||||
.dir("../../build")
|
||||
.get()
|
||||
// 统一重定向构建输出目录
|
||||
val newBuildDir: Directory = rootProject.layout.buildDirectory
|
||||
.dir("../../build")
|
||||
.get()
|
||||
rootProject.layout.buildDirectory.value(newBuildDir)
|
||||
|
||||
subprojects {
|
||||
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
|
||||
project.layout.buildDirectory.value(newSubprojectBuildDir)
|
||||
}
|
||||
|
||||
subprojects {
|
||||
project.evaluationDependsOn(":app")
|
||||
}
|
||||
|
||||
tasks.register<Delete>("clean") {
|
||||
delete(rootProject.layout.buildDirectory)
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
org.gradle.daemon=true
|
||||
org.gradle.parallel=true
|
||||
# This builtInKotlin flag was added automatically by Flutter migrator
|
||||
android.builtInKotlin=false
|
||||
android.builtInKotlin=true
|
||||
# This newDsl flag was added automatically by Flutter migrator
|
||||
android.newDsl=false
|
||||
android.newDsl=true
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-8.14-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.12-all.zip
|
||||
zipStorePath=wrapper/dists
|
||||
+31
-13
@@ -1,26 +1,44 @@
|
||||
pluginManagement {
|
||||
val flutterSdkPath =
|
||||
run {
|
||||
val properties = java.util.Properties()
|
||||
file("local.properties").inputStream().use { properties.load(it) }
|
||||
val flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
|
||||
flutterSdkPath
|
||||
}
|
||||
val flutterSdkPath = run {
|
||||
val properties = java.util.Properties()
|
||||
file("local.properties").inputStream().use { properties.load(it) }
|
||||
val sdkPath = properties.getProperty("flutter.sdk")
|
||||
require(sdkPath != null) { "flutter.sdk not set in local.properties" }
|
||||
sdkPath
|
||||
}
|
||||
|
||||
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
|
||||
|
||||
repositories {
|
||||
// 🟢 阿里云 gradle-plugin 镜像(专用)
|
||||
maven {
|
||||
url = uri("https://maven.aliyun.com/repository/gradle-plugin")
|
||||
}
|
||||
// 🟢 阿里云 public 聚合仓库(兜底)
|
||||
maven {
|
||||
url = uri("https://maven.aliyun.com/repository/public")
|
||||
}
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
|
||||
id("com.android.application") version "8.9.1" apply false
|
||||
id("org.jetbrains.kotlin.android") version "2.1.0" apply false
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
||||
repositories {
|
||||
// 🟢 阿里云镜像放在最前面
|
||||
maven { url = uri("https://maven.aliyun.com/repository/public") }
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
include(":app")
|
||||
plugins {
|
||||
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
|
||||
id("com.android.application") version "8.13.0" apply false
|
||||
id("org.jetbrains.kotlin.android") version "2.2.21" apply false
|
||||
}
|
||||
|
||||
rootProject.name = "android"
|
||||
include(":app")
|
||||
Reference in New Issue
Block a user