commit 192037f48ac2a636414cbd768ed90c9d1e02ef69 Author: 小草林(田梓萱) Date: Mon Feb 5 21:09:07 2024 +0800 feat: init Signed-off-by: 小草林(田梓萱) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..7663bd4 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +AIChat \ No newline at end of file diff --git a/.idea/appInsightsSettings.xml b/.idea/appInsightsSettings.xml new file mode 100644 index 0000000..2f9271f --- /dev/null +++ b/.idea/appInsightsSettings.xml @@ -0,0 +1,45 @@ + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b589d56 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..0c0c338 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..0897082 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..8d81632 --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/ktfmt.xml b/.idea/ktfmt.xml new file mode 100644 index 0000000..f0d6dab --- /dev/null +++ b/.idea/ktfmt.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/migrations.xml b/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..0ad17cb --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..be85752 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,478 @@ +/* + * Copyright (c) 田梓萱[小草林] 2021-2024. + * All Rights Reserved. + * All codes are protected by China's regulations on the protection of computer software, and infringement must be investigated. + * 版权所有 (c) 田梓萱[小草林] 2021-2024. + * 所有代码均受中国《计算机软件保护条例》保护,侵权必究. + */ +@file:Suppress("UnstableApiUsage") + import java.time.LocalDate + import java.time.format.DateTimeFormatter.ofPattern + import java.util.Properties + + plugins { + id("com.android.application") + id("com.didiglobal.booster") + id("io.github.leavesczy.trace") + id("com.google.devtools.ksp") + id("androidx.room") + id("kotlin-android") + id("kotlin-parcelize") + id("kotlinx-serialization") + id("androidx.navigation.safeargs.kotlin") + id("com.google.gms.google-services") + id("com.google.firebase.firebase-perf") +// id("com.google.firebase.crashlytics") + id("version-catalog") + id("io.sentry.android.gradle") + id("io.sentry.kotlin.compiler.gradle") + id("com.mikepenz.aboutlibraries.plugin") + id("android.aop") + } + +val properties = Properties() +val isDebug = gradle.startParameter.taskNames.any { it.contains("debug", true) } + +properties.load(project.rootProject.file("gradle.properties").inputStream()) + +room { schemaDirectory("$projectDir/schemas") } + +android { + namespace = "ink.xcl.saitra" + compileSdk = 34 + ndkVersion = "26.1.10909125" + // compileSdkPreview = "UpsideDownCake" + // flavorDimensions += listOf("arch") + // productFlavors { + // create("arm64") { + // dimension = "arch" + // ndk { + // abiFilters += listOf("arm64-v8a") // 仅64位 + // } + // externalNativeBuild { + // cmake { + // cFlags += listOf("-Os -flto -ffunction-sections -fdata-sections -fvisibility=hidden") + // abiFilters += listOf("arm64-v8a") + // cppFlags += listOf("-Os -flto -ffunction-sections -fdata-sections + // -fvisibility=hidden") + // arguments += listOf("-Wl,--gc-sections", "-DANDROID_STL=c++_static") + // } + // } + // } + // create("arm32") { + // dimension = "arch" + // ndk { + // abiFilters += listOf("armeabi-v7a") // 仅32位 + // } + // externalNativeBuild { + // cmake { + // cFlags += listOf("-Os -flto -ffunction-sections -fdata-sections -fvisibility=hidden") + // abiFilters += listOf("armeabi-v7a") + // cppFlags += listOf("-Os -flto -ffunction-sections -fdata-sections + // -fvisibility=hidden") + // arguments += listOf("-Wl,--gc-sections", "-DANDROID_STL=c++_static") + // } + // } + // } + // } + lint { + quiet = true + ignoreWarnings = true + abortOnError = false + checkReleaseBuilds = true + } + experimentalProperties["android.experimental.art-profile-r8-rewriting"] = true + experimentalProperties["android.experimental.r8.dex-startup-optimization"] = true + defaultConfig { + applicationId = "ink.xcl.saitra" + multiDexEnabled = true + ndk { + abiFilters += + listOf( + "armeabi-v7a", // 兼容32位 + "arm64-v8a", // 兼容64位 + // "x86",//不兼容x86 + // "x86_64",//不兼容x86_64 + ) // 仅兼容64位 + } + minSdk = 22 + targetSdk = 34 + versionCode = LocalDate.now().format(ofPattern("yyyyMMdd")).toInt() + versionName = "0.0.1" + proguardFiles(getDefaultProguardFile("proguard-defaults.txt"), "proguard-rules.pro") + multiDexKeepProguard = file("multidex-config.pro") + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + vectorDrawables { useSupportLibrary = true } +// externalNativeBuild { +// cmake { +// cFlags += listOf("-Os -flto -ffunction-sections -fdata-sections -fvisibility=hidden") +// abiFilters += listOf("armeabi-v7a", "arm64-v8a") +// cppFlags += listOf("-Os -flto -ffunction-sections -fdata-sections -fvisibility=hidden") +// arguments += listOf("-Wl,--gc-sections", "-DANDROID_STL=c++_static") +// } +// } + } + bundle { + abi { + // This property is set to true by default. + enableSplit = true + } + } +// signingConfigs { +// // We use a bundled debug keystore, to allow debug builds from CI to be upgradable +// create("release") { +// storeFile = rootProject.file("./key/saitra.keystore") +// storePassword = "2025Tzx." +// keyAlias = "XCL_TZX_EI_AChatI" +// keyPassword = "2025Tzx." +// enableV1Signing = true +// enableV2Signing = true +// enableV3Signing = true +// enableV4Signing = true +// } +// } + composeOptions { kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() } + packaging { + // jniLibs { + // excludes += "**/libchat.so" + // }//动态加载-不合规-暂时移除 + resources { + excludes += "META-INF/DEPENDENCIES" + excludes += "META-INF/NOTICE" + excludes += "META-INF/LICENSE" + excludes += "META-INF/LICENSE.txt" + excludes += "META-INF/NOTICE.txt" + excludes += "META-INF/LICENSE.md" + excludes += "META-INF/LICENSE-notice.md" + excludes += "META-INF/{AL2.0,LGPL2.1,LICENSE,NOTICE,DEPENDENCIES}" + excludes += "DebugProbesKt.bin" + excludes += "META-INF/*.kotlin_module" + excludes += "**/*.kotlin_module" + excludes += "**/*.version" + } + } + buildTypes { + debug { + isDebuggable = true + isCrunchPngs = true + isJniDebuggable = true + isMinifyEnabled = false + isShrinkResources = false +// signingConfig = signingConfigs.getByName("release") + // versionNameSuffix = "-debug-${LocalDate.now().format(ofPattern("yyyy-MM-dd"))}" + } + + release { + isDebuggable = false + isCrunchPngs = true + isJniDebuggable = false + isMinifyEnabled = true + isShrinkResources = true +// signingConfig = signingConfigs.getByName("release") + // versionNameSuffix = "-release-${LocalDate.now().format(ofPattern("yyyy-MM-dd"))}" + } +// create("benchmark") { +// signingConfig = signingConfigs.getByName("release") +// matchingFallbacks += listOf("release") +// isDebuggable = false +// } + } + compileOptions { + isCoreLibraryDesugaringEnabled = true + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + kotlinOptions { + jvmTarget = "17" + val arguments = + listOf( + // https://kotlinlang.org/docs/compiler-reference.html#progressive + "-progressive", + // Enable Java default method generation. + "-Xjvm-default=all", + "-Xjsr305=strict", + // Generate smaller bytecode by not generating runtime not-null assertions. + "-Xno-call-assertions", + "-Xno-param-assertions", + "-Xno-receiver-assertions", + ) + freeCompilerArgs += arguments + } + splits { + abi { + isEnable = true + reset() + include("armeabi-v7a", "arm64-v8a") + isUniversalApk = true + } + } + buildFeatures { + compose = true + // dataBinding = false + viewBinding = true + buildConfig = true + aidl = true + } +// externalNativeBuild { +// cmake { +// path = file("CMakeLists.txt") +// version = "3.22.1" +// } +// } + // 屏蔽 task (uploadCrashlyticsMappingFileRelease)-仅限国内构建、使用Mini打包不需要 + // gradle.taskGraph.whenReady { + // tasks.find { it.name == "uploadCrashlyticsMappingFileRelease" }?.enabled = false + // } + + applicationVariants.all { + outputs.all { + if (this is com.android.build.gradle.internal.api.ApkVariantOutputImpl) { + val filterData = getFilter(com.android.build.OutputFile.ABI) + // println("EI_v${versionName}(${versionCode})_${filterData}_${buildType.name}.apk") + outputFileName = + if (filterData.isNullOrEmpty()) { + "Tra_v${versionName}(${versionCode})_${buildType.name}.apk" + } else { + "Tra_v${versionName}(${versionCode})_(${filterData}|${buildType.name}).apk" + } + } + } + } + sourceSets { getByName("main") { jniLibs.srcDir("libs") } } +} + +aboutLibraries { + // - `./gradlew app:exportLibraryDefinitions -PaboutLibraries.exportPath=src/main/res/raw` + registerAndroidTasks = false + outputFileName = "aboutlibraries.json" + configPath = "config" + offlineMode = false + fetchRemoteLicense = true + fetchRemoteFunding = true + excludeFields = arrayOf("developers", "funding") + includePlatform = true + strictMode = com.mikepenz.aboutlibraries.plugin.StrictMode.WARN + duplicationMode = com.mikepenz.aboutlibraries.plugin.DuplicateMode.MERGE + duplicationRule = com.mikepenz.aboutlibraries.plugin.DuplicateRule.GROUP + prettyPrint = true +} + +dependencies { + // implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) + implementation(libs.material) { + exclude(group = "org.jetbrains.kotlin", module = "kotlin-bom") + exclude(group = "androidx.activity", module = "activity") + exclude(group = "androidx.appcompat", module = "appcompat") + } + implementation(libs.material3) + implementation(libs.material3.adaptive) + implementation(libs.material3.adaptive.navigation.suite) + implementation(libs.material3.window.size) + implementation(libs.androidx.foundation) + implementation(libs.androidx.foundation.layout) + implementation(libs.androidx.ui) + implementation(libs.androidx.ui.util) + implementation(libs.androidx.ui.graphics) + debugImplementation(libs.androidx.ui.tooling) + debugImplementation(libs.androidx.ui.tooling.preview) + debugImplementation(libs.squareup.leakcanary) + implementation(libs.androidx.material) + implementation(libs.androidx.material.icons.core) + implementation(libs.androidx.material.icons.extended) + implementation(libs.androidx.runtime) + implementation(libs.androidx.animation) + implementation(libs.androidx.recyclerview) + implementation(libs.androidx.recyclerview.selection) + // androidTestImplementation(libs.androidx.runtime.tracing) + // androidTestImplementation(libs.androidx.ui.test.manifest) + // androidTestImplementation(libs.androidx.ui.test.junit4) + implementation(libs.androidx.glance) + implementation(libs.androidx.glance.appwidget) + // implementation(libs.androidx.glance.material) + implementation(libs.androidx.glance.material3) + debugImplementation(libs.glance.appwidget.viewer) + implementation(libs.glance.appwidget.host) + implementation(libs.glance.appwidget.configuration) + // implementation(libs.accompanist.permissions) + implementation(libs.accompanist.navigation.material) { + exclude(group = "androidx.navigation", module = "navigation-compose") + } + implementation(libs.accompanist.drawablepainter) + implementation(libs.accompanist.adaptive) + implementation(libs.androidx.navigation.ui.ktx) + implementation(libs.androidx.navigation.compose) + // androidTestImplementation(libs.androidx.navigation.testing) + implementation(libs.androidx.window) + implementation(libs.androidx.window.java) + // androidTestImplementation(libs.androidx.window.testing) + implementation(libs.androidx.lifecycle.viewmodel.ktx) + implementation(libs.androidx.lifecycle.viewmodel.compose) + implementation(libs.androidx.lifecycle.runtime.compose) + implementation(libs.androidx.lifecycle.viewmodel.savedstate) + implementation(libs.androidx.lifecycle.common.java8) + implementation(libs.androidx.lifecycle.service) + implementation(libs.androidx.lifecycle.process) + implementation(libs.androidx.lifecycle.reactivestreams.ktx) + implementation(libs.androidx.lifecycle.livedata.ktx) + // androidTestImplementation(libs.androidx.core.testing) + // androidTestImplementation(libs.androidx.lifecycle.runtime.testing) + // room数据库 + implementation(libs.androidx.room.runtime) + // annotationProcessor(libs.androidx.room.compiler) + ksp(libs.androidx.room.compiler) + implementation(libs.androidx.room.ktx) + implementation(libs.androidx.room.guava) + // testImplementation(libs.androidx.room.testing) + implementation(libs.sqlcipher.android) { exclude(group = "androidx.sqlite", module = "sqlite") } + implementation(libs.androidx.sqlite) + implementation(libs.androidx.sqlite.ktx) + implementation(libs.androidx.sqlite.framework) + // work + implementation(libs.androidx.work.runtime.ktx) + implementation(libs.androidx.work.gcm) + // androidTestImplementation(libs.androidx.work.testing) + implementation(libs.androidx.work.multiprocess) + // sentry + implementation(libs.sentry.android) + implementation(libs.sentry.compose.android) + implementation(libs.sentry.android.okhttp) { + exclude(group = "com.squareup.okhttp3", module = "okhttp") + } +// implementation(libs.firebase.perf.ktx) +// implementation(libs.firebase.crashlytics.ktx) +// implementation(libs.firebase.crashlytics.ndk) +// implementation(libs.firebase.config.ktx) +// implementation(libs.firebase.analytics.ktx) +// implementation(libs.firebase.messaging.ktx) + // Ktor + implementation(libs.ktor.client.core) + implementation(libs.ktor.client.okhttp) { + exclude(group = "com.squareup.okhttp3", module = "okhttp") + } + implementation(libs.ktor.client.logging) + implementation(libs.ktor.client.content.negotiation) + implementation(libs.ktor.client.encoding) + implementation(libs.ktor.serialization.kotlinx.protobuf) + // androidTestImplementation(libs.ktor.client.mock) + // Okhttp + implementation(libs.okhttp) + implementation(libs.okhttp.sse) + debugImplementation(libs.okhttp.monitor) + releaseImplementation(libs.okhttp.monitor.noop) + // Grpc + // runtimeOnly(libs.grpc.okhttp) + // api(libs.grpc.stub) + // api(libs.grpc.protobuf.lite) + // api(libs.grpc.kotlin.stub) + // implementation(libs.protobuf.kotlinlite) // protobuf-kotlin解析 + implementation(libs.kotlinx.serialization.protobuf) { + exclude(group = "com.google.protobuf", module = "protobuf-javalite") + } // protobuf-serialization解析 + implementation(libs.protobuf.javalite) // protobuf-java解析 + // 图片渲染-Coil + implementation(libs.coil3) + implementation(libs.coil3.compose) + implementation(libs.coil3.gif) + implementation(libs.coil3.svg) { exclude(group = "com.caverock", module = "androidsvg-aar") } + implementation(libs.coil3.video) + implementation(libs.coil3.network) { exclude(group = "com.squareup.okhttp3", module = "okhttp") } + implementation(libs.zoomimage.compose.coil) + implementation(libs.coil) + implementation(libs.coil.compose) + // Koin依赖注入 + implementation(libs.koin.core) + implementation(libs.koin.core.coroutines) + implementation(libs.koin.android) + implementation(libs.koin.android.compat) + // implementation(libs.koin.androidx.workmanager) + implementation(libs.koin.androidx.compose) + implementation(libs.koin.androidx.compose.navigation) + // androidTestImplementation(libs.koin.android.test) + // androidTestImplementation(libs.androidx.tracing.perfetto) + // androidTestImplementation(libs.androidx.tracing.perfetto.binary) + implementation(libs.androidx.core) + implementation(libs.androidx.core.google.shortcuts) + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.core.animation) + implementation(libs.androidx.core.performance) + implementation(libs.androidx.core.splashscreen) + implementation(libs.androidx.startup.runtime) + implementation(libs.androidx.appcompat) { + exclude(group = "androidx.fragment", module = "fragment") + } + implementation(libs.androidx.appcompat.resources) + implementation(libs.androidx.emoji2) + implementation(libs.androidx.emoji2.bundled) + // implementation(libs.androidx.emoji2.emojipicker) + // implementation(libs.androidx.gridlayout) + // implementation(libs.billing.ktx) + // implementation(libs.alipaysdk.android)//应用内支付-支付宝-暂时移除 + implementation(libs.androidx.activity.ktx) + implementation(libs.androidx.activity.compose) + implementation(libs.annotation) + implementation(libs.androidx.concurrent.futures.ktx) + implementation(libs.androidx.annotation.experimental) + implementation(libs.androidx.constraintlayout) + implementation(libs.androidx.constraintlayout.compose) + implementation(libs.androidx.asynclayoutinflater) + implementation(libs.androidx.collection.ktx) + // exoplayer + implementation(libs.media3.exoplayer) + // agora + implementation(libs.agora.rtc.basic) + // implementation(libs.material) + implementation(libs.androidx.multidex) + coreLibraryDesugaring(libs.desugar.jdk.libs) + implementation(libs.bcprov.jdk15on) + implementation(libs.relinker) + implementation(libs.guava) + // implementation(libs.lottie.compose) // AE动画 + implementation(libs.androidx.transition.ktx) + // 协程 + implementation(libs.kotlinx.coroutines.core) + implementation(libs.kotlinx.coroutines.play.services) + implementation(libs.kotlinx.coroutines.android) + implementation(libs.kotlin.reflect) + implementation(libs.kotlin.stdlib) + implementation(libs.kotlin.stdlib.jdk7) + implementation(libs.kotlin.stdlib.jdk8) + // androidTestImplementation(libs.kotlinx.coroutines.test) + // androidTestImplementation(libs.androidx.junit) + // androidTestImplementation(libs.androidx.espresso.core) + // testImplementation(libs.junit.jupiter.api) + // androidTestImplementation(libs.junit.jupiter.api) + // Acra 异常全局捕获 + implementation(libs.acra.core) + implementation(libs.acra.toast) + implementation(libs.acra.advanced.scheduler) + implementation(libs.auto.service.annotations) + ksp(libs.auto.service.ksp) + implementation(libs.androidx.fragment) + // GMS + implementation(libs.play.services.location) + // implementation(libs.integrity) + // TODO:暂时取消掉翻译的依赖 + // implementation(libs.playstore.dynamic.feature.support) + // { + // exclude(group = "com.google.android.play", module = "core") + // } + // implementation(libs.translate)//文本翻译 + // Play Core + implementation(libs.asset.delivery.ktx) + implementation(libs.feature.delivery.ktx) + // implementation(libs.review.ktx) + implementation(libs.app.update.ktx) + implementation(libs.android.aop.core) + implementation(libs.android.aop.annotation) + ksp(libs.android.aop.ksp) + implementation(libs.aboutlibraries.core) + implementation(libs.aboutlibraries.compose.m3) + // QrCode + // implementation(libs.qrose) + // 拼音 + // implementation(libs.pinyin4j) + // profile优化 + implementation(libs.androidx.profileinstaller) +} + +configurations.all { resolutionStrategy.cacheChangingModulesFor(10, TimeUnit.SECONDS) } diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..e10235f --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/ink/xcl/saitra/MainActivity.kt b/app/src/main/java/ink/xcl/saitra/MainActivity.kt new file mode 100644 index 0000000..13786a6 --- /dev/null +++ b/app/src/main/java/ink/xcl/saitra/MainActivity.kt @@ -0,0 +1,38 @@ +package ink.xcl.saitra + +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import ink.xcl.saitra.ui.theme.AiTraTheme + +class MainActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContent { + AiTraTheme { + // A surface container using the 'background' color from the theme + Surface( + modifier = Modifier.fillMaxSize(), + color = MaterialTheme.colorScheme.background + ) { + Greeting("Android") + } + } + } + } +} + +@Composable +fun Greeting(name: String, modifier: Modifier = Modifier) { + Text( + text = "Hello $name!", + modifier = modifier + ) +} diff --git a/app/src/main/java/ink/xcl/saitra/ui/theme/Color.kt b/app/src/main/java/ink/xcl/saitra/ui/theme/Color.kt new file mode 100644 index 0000000..55575e1 --- /dev/null +++ b/app/src/main/java/ink/xcl/saitra/ui/theme/Color.kt @@ -0,0 +1,11 @@ +package ink.xcl.saitra.ui.theme + +import androidx.compose.ui.graphics.Color + +val Purple80 = Color(0xFFD0BCFF) +val PurpleGrey80 = Color(0xFFCCC2DC) +val Pink80 = Color(0xFFEFB8C8) + +val Purple40 = Color(0xFF6650a4) +val PurpleGrey40 = Color(0xFF625b71) +val Pink40 = Color(0xFF7D5260) \ No newline at end of file diff --git a/app/src/main/java/ink/xcl/saitra/ui/theme/Theme.kt b/app/src/main/java/ink/xcl/saitra/ui/theme/Theme.kt new file mode 100644 index 0000000..d9fd174 --- /dev/null +++ b/app/src/main/java/ink/xcl/saitra/ui/theme/Theme.kt @@ -0,0 +1,70 @@ +package ink.xcl.saitra.ui.theme + +import android.app.Activity +import android.os.Build +import androidx.compose.foundation.isSystemInDarkTheme +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.toArgb +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalView +import androidx.core.view.WindowCompat + +private val DarkColorScheme = darkColorScheme( + primary = Purple80, + secondary = PurpleGrey80, + tertiary = Pink80 +) + +private val LightColorScheme = lightColorScheme( + primary = Purple40, + secondary = PurpleGrey40, + tertiary = Pink40 + + /* Other default colors to override + background = Color(0xFFFFFBFE), + surface = Color(0xFFFFFBFE), + onPrimary = Color.White, + onSecondary = Color.White, + onTertiary = Color.White, + onBackground = Color(0xFF1C1B1F), + onSurface = Color(0xFF1C1B1F), + */ +) + +@Composable +fun AiTraTheme( + darkTheme: Boolean = isSystemInDarkTheme(), + // Dynamic color is available on Android 12+ + dynamicColor: Boolean = true, + content: @Composable () -> Unit +) { + val colorScheme = when { + dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { + val context = LocalContext.current + if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) + } + + darkTheme -> DarkColorScheme + else -> LightColorScheme + } + val view = LocalView.current + if (!view.isInEditMode) { + SideEffect { + val window = (view.context as Activity).window + window.statusBarColor = colorScheme.primary.toArgb() + WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme + } + } + + MaterialTheme( + colorScheme = colorScheme, + typography = Typography, + content = content + ) +} \ No newline at end of file diff --git a/app/src/main/java/ink/xcl/saitra/ui/theme/Type.kt b/app/src/main/java/ink/xcl/saitra/ui/theme/Type.kt new file mode 100644 index 0000000..0e5ae0d --- /dev/null +++ b/app/src/main/java/ink/xcl/saitra/ui/theme/Type.kt @@ -0,0 +1,34 @@ +package ink.xcl.saitra.ui.theme + +import androidx.compose.material3.Typography +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.sp + +// Set of Material typography styles to start with +val Typography = Typography( + bodyLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 16.sp, + lineHeight = 24.sp, + letterSpacing = 0.5.sp + ) + /* Other default text styles to override + titleLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 22.sp, + lineHeight = 28.sp, + letterSpacing = 0.sp + ), + labelSmall = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Medium, + fontSize = 11.sp, + lineHeight = 16.sp, + letterSpacing = 0.5.sp + ) + */ +) \ No newline at end of file diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..aa7d642 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9126ae3 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..f8c6127 --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..4052a2c --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + AiTra + \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..5f4058a --- /dev/null +++ b/app/src/main/res/values/themes.xml @@ -0,0 +1,5 @@ + + + +