diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7a3e24cc6f175b1fcafa7451689c7ad70d1fe91d..0277ac3b2d29c4592ce93d51fb61218218455d92 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,47 +1,34 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + plugins { id("com.android.application") id("kotlin-android") + id("kotlin-kapt") id("de.kuschku.justcode") } android { defaultConfig { - setMinSdkVersion(21) - setTargetSdkVersion(30) - applicationId = "com.iskrembilen.quasseldroid" - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + setMinSdkVersion(21) + setTargetSdkVersion(30) } - buildTypes { - release { - setMinifyEnabled(false) - setProguardFiles( - listOf( - getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro" - ) - ) - } - } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = "1.8" - useIR = true - } buildFeatures { compose = true } + composeOptions { val androidxComposeVersion: String by project.extra kotlinCompilerExtensionVersion = androidxComposeVersion } } +kapt { + correctErrorTypes = true +} + dependencies { val androidxCoreVersion: String by project.extra implementation("androidx.core", "core-ktx", androidxCoreVersion) @@ -60,6 +47,17 @@ dependencies { val androidxLifecycleVersion: String by project.extra implementation("androidx.lifecycle", "lifecycle-runtime-ktx", androidxLifecycleVersion) + val androidxMultidexVersion: String by project.extra + implementation("androidx.multidex", "multidex", androidxMultidexVersion) + + val daggerHiltVersion: String by project.extra + implementation("com.google.dagger", "hilt-android", daggerHiltVersion) + annotationProcessor("com.google.dagger", "hilt-android-compiler", daggerHiltVersion) + testImplementation("com.google.dagger", "hilt-android-testing", daggerHiltVersion) + testAnnotationProcessor("com.google.dagger", "hilt-android-compiler", daggerHiltVersion) + androidTestImplementation("com.google.dagger", "hilt-android-testing", daggerHiltVersion) + androidTestAnnotationProcessor("com.google.dagger", "hilt-android-compiler", daggerHiltVersion) + implementation("org.threeten", "threetenbp", "1.4.0") implementation("io.coil-kt", "coil", "1.1.1") diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f7c7b93643bcc89fe5e430da9ba734f093e0eaae..598de7f6ce745c23f6f7916a2e7f57d043040283 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,6 +13,7 @@ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <application + android:name="de.kuschku.quasseldroid.QuasseldroidApplication" android:allowBackup="true" android:fullBackupContent="@xml/backup_descriptor" android:icon="@mipmap/ic_launcher" diff --git a/app/src/main/java/de/kuschku/quasseldroid/MainActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/MainActivity.kt index b3b573a1ffcf51ada37cf570f624c8d0ef9d70d9..25f2221c3e565cff46679fbaa53dfa44c7f655da 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/MainActivity.kt +++ b/app/src/main/java/de/kuschku/quasseldroid/MainActivity.kt @@ -19,26 +19,34 @@ import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import androidx.lifecycle.LifecycleObserver +import androidx.lifecycle.lifecycleScope +import dagger.hilt.android.AndroidEntryPoint import de.kuschku.quasseldroid.ui.theme.QuasseldroidTheme import de.kuschku.quasseldroid.ui.theme.shapes import de.kuschku.quasseldroid.ui.theme.typography import dev.chrisbanes.accompanist.coil.CoilImage import kotlinx.coroutines.Job import kotlinx.coroutines.delay +import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flow import org.threeten.bp.ZonedDateTime import org.threeten.bp.format.DateTimeFormatter import kotlin.random.Random -val time = flow<ZonedDateTime> { - emit(ZonedDateTime.now()) - delay(1000) -} +val time = MutableStateFlow(ZonedDateTime.now()) + +inline class Password1(private val s: String) class MainActivity : AppCompatActivity() { - var timer: Job? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + lifecycleScope.launchWhenResumed { + while (true) { + time.value = ZonedDateTime.now() + delay(1000) + } + } setContent { JetChat() } @@ -79,7 +87,7 @@ fun parseString(text: String): AnnotatedString { if (monospace) builder.addStyle( SpanStyle( fontFamily = FontFamily.Monospace, - background = Color.Gray, + background = Color(0xFFDEDEDE), ), before, after @@ -114,7 +122,7 @@ fun ChatBubble( content: @Composable () -> Unit ) { Surface( - color = Color.LightGray, + color = Color(0xFFF5F5F5), shape = shapes.medium, modifier = Modifier .padding(2.dp) diff --git a/app/src/main/java/de/kuschku/quasseldroid/QuasseldroidApplication.kt b/app/src/main/java/de/kuschku/quasseldroid/QuasseldroidApplication.kt new file mode 100644 index 0000000000000000000000000000000000000000..d998491e4086dbb431d93fc3c7a0b32084e57c6f --- /dev/null +++ b/app/src/main/java/de/kuschku/quasseldroid/QuasseldroidApplication.kt @@ -0,0 +1,27 @@ +/* + * Quasseldroid - Quassel client for Android + * + * Copyright (c) 2021 Janne Mareike Koschinski + * Copyright (c) 2021 The Quassel Project + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package de.kuschku.quasseldroid + +import androidx.multidex.MultiDexApplication +import dagger.hilt.android.HiltAndroidApp + +@HiltAndroidApp +class QuasseldroidApplication : MultiDexApplication() { +} diff --git a/build.gradle.kts b/build.gradle.kts index a366db222b3e34b37495c322343e187861e4f1dc..2fca41512861f9638291852a00ccf9477b92f4a6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,6 +17,8 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + buildscript { repositories { google() @@ -24,8 +26,9 @@ buildscript { jcenter() } dependencies { - classpath("com.android.tools.build:gradle:7.0.0-alpha05") - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21-2") + classpath("com.android.tools.build", "gradle", "7.0.0-alpha05") + classpath("org.jetbrains.kotlin", "kotlin-gradle-plugin", "1.4.21-2") + classpath("com.google.dagger", "hilt-android-gradle-plugin", "2.31.2-alpha") } } @@ -34,6 +37,8 @@ allprojects { extra["androidxCoreVersion"] = "1.2.0" extra["androidxComposeVersion"] = "1.0.0-alpha11" extra["androidxLifecycleVersion"] = "2.3.0-rc01" + extra["androidxMultidexVersion"] = "2.0.1" + extra["daggerHiltVersion"] = "2.31.2-alpha" extra["mdcVersion"] = "1.2.1" repositories { @@ -41,4 +46,15 @@ allprojects { mavenCentral() jcenter() } + + tasks.withType<KotlinCompile>().configureEach { + kotlinOptions { + freeCompilerArgs = listOf( + "-Xinline-classes", + "-Xuse-experimental=kotlin.ExperimentalUnsignedTypes" + ) + jvmTarget = "1.8" + useIR = true + } + } } diff --git a/buildSrc/src/main/kotlin/de/kuschku/justcode/JustCodePlugin.kt b/buildSrc/src/main/kotlin/de/kuschku/justcode/JustCodePlugin.kt index b0581bcc16d94aa9206f2ab100b7caf964a0cd62..697ef1ead17599eab027afd4f1003edbe11b1204 100644 --- a/buildSrc/src/main/kotlin/de/kuschku/justcode/JustCodePlugin.kt +++ b/buildSrc/src/main/kotlin/de/kuschku/justcode/JustCodePlugin.kt @@ -44,7 +44,38 @@ class JustCodePlugin : Plugin<Project> { gitCommitDate() ) + setProperty("archivesBaseName", "${rootProject.name}-$versionName") + signingConfig = signingConfigs.findByName("default") + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + // Disable test runner analytics + testInstrumentationRunnerArguments(mapOf( + "disableAnalytics" to "true" + )) + } + + buildTypes { + getByName("release") { + isMinifyEnabled = true + isShrinkResources = true + multiDexEnabled = true + + proguardFiles( + getDefaultProguardFile("proguard-android.txt"), + "proguard-rules.pro" + ) + } + + getByName("debug") { + applicationIdSuffix = ".debug" + multiDexEnabled = true + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } } } diff --git a/settings.gradle.kts b/settings.gradle.kts index c6507812c436445bbb9a03855774751d10d04ef3..ef0ce5d149e88a7acfca3b415198efa5a4f8a1e7 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -17,16 +17,9 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +rootProject.name = "Quasseldroid" rootProject.buildFileName = "build.gradle.kts" include( - ":app"//, - //":invokerannotations", - //":invokergenerator", - //":lib", - //":lifecycle-ktx", - //":malheur", - //":persistence", - //":viewmodel", - //":ui_spinner" + ":app" )