Skip to content

Commit

Permalink
refactor: 重构构建系统并删除过时的依赖
Browse files Browse the repository at this point in the history
  • Loading branch information
xfqwdsj committed Jul 26, 2024
1 parent 055b476 commit 410d8cb
Show file tree
Hide file tree
Showing 21 changed files with 164 additions and 108 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
.externalNativeBuild
.cxx
local.properties
/.kotlin/
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 0 additions & 80 deletions app/build.gradle

This file was deleted.

78 changes: 78 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.kotlin)
alias(libs.plugins.androidApplication)
alias(libs.plugins.composeCompiler)
}

kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
}
}

android {
namespace = "xyz.xfqlittlefan.notdeveloper"
compileSdk = libs.versions.compileSdk.get().toInt()

signingConfigs {
create("config") {
storeFile = file("key.jks")
storePassword = "keykey"
keyAlias = "keykey"
keyPassword = "keykey"
}
}

defaultConfig {
applicationId = "xyz.xfqlittlefan.notdeveloper"
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.targetSdk.get().toInt()
versionName = libs.versions.app.versionName.get()
versionCode = libs.versions.app.versionCode.get().toInt()
signingConfig = signingConfigs.getByName("config")
}

buildTypes {
release {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
)
}
}

buildFeatures {
buildConfig = true
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

buildFeatures {
compose = true
}

packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

dependencies {
implementation(libs.lifecycle.runtime)
implementation(libs.lifecycle.viewmodel)
implementation(libs.activity.compose)
implementation(libs.compose.runtime)
implementation(libs.compose.foundation)
implementation(libs.compose.ui)
implementation(libs.compose.animation)
implementation(libs.compose.material3)
implementation(libs.preference)
compileOnly(libs.xposed.api)
}
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.os.Bundle
import android.provider.Settings
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState
Expand Down Expand Up @@ -34,8 +35,9 @@ class MainActivity : ComponentActivity() {
@SuppressLint("WorldReadableFiles")
@OptIn(ExperimentalMaterial3Api::class)
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
WindowCompat.setDecorFitsSystemWindows(window, false)
// WindowCompat.setDecorFitsSystemWindows(window, false)

setContent {
IAmNotADeveloperTheme {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,29 @@ package xyz.xfqlittlefan.notdeveloper.ui.theme

import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.*
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import com.google.accompanist.systemuicontroller.rememberSystemUiController

@Composable
fun IAmNotADeveloperTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
content: @Composable () -> Unit
darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit
) {
val systemUiController = rememberSystemUiController()
val colorScheme = when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
val context = LocalContext.current
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
}

darkTheme -> darkColorScheme()
else -> lightColorScheme()
}

SideEffect {
systemUiController.setSystemBarsColor(color = Color.Transparent, darkIcons = !darkTheme)
}

MaterialTheme(
colorScheme = colorScheme,
content = content
colorScheme = colorScheme, content = content
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ val isModuleActive
@SuppressLint("WorldReadableFiles")
fun Context.isPreferencesReady(): Boolean {
return try {
@Suppress("DEPRECATION")
getSharedPreferences("testPreferences", Context.MODE_WORLD_READABLE)
true
} catch (e: Throwable) {
Expand Down
6 changes: 0 additions & 6 deletions build.gradle

This file was deleted.

7 changes: 7 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.kotlin) apply false
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.composeCompiler) apply false
}
32 changes: 32 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[versions]
app-versionName = "1.3.1"
app-versionCode = "7"
kotlin = "2.0.0"
agp = "8.7.0-alpha02"
compileSdk = "34"
targetSdk = "34"
minSdk = "27"
compose = "1.6.8"
compose-material3 = "1.2.1"
lifecycle = "2.8.4"
activity = "1.9.1"
preference = "1.2.1"
xposed-api = "82"

[libraries]
lifecycle-runtime = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycle" }
lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycle" }
activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activity" }
compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "compose" }
compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" }
compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" }
compose-animation = { module = "androidx.compose.animation:animation", version.ref = "compose" }
compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "compose-material3" }
preference = { module = "androidx.preference:preference-ktx", version.ref = "preference" }
xposed-api = { module = "de.robv.android.xposed:api", version.ref = "xposed-api" }

[plugins]
kotlin = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
androidApplication = { id = "com.android.application", version.ref = "agp" }
androidLibrary = { id = "com.android.library", version.ref = "agp" }
composeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", 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 @@
#Sun Sep 24 13:04:41 CST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
8 changes: 5 additions & 3 deletions settings.gradle → settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
rootProject.name = "IAmNotADeveloper"

pluginManagement {
repositories {
google()
Expand All @@ -10,8 +12,8 @@ dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url "https://api.xposed.info/" }
maven("https://api.xposed.info/")
}
}
rootProject.name = "IAmNotADeveloper"
include ':app'

include(":app")

0 comments on commit 410d8cb

Please sign in to comment.