From 371628a6bbc53af001c63b303f5ecbd8d8db14a1 Mon Sep 17 00:00:00 2001 From: jinukeu Date: Wed, 4 Oct 2023 15:12:48 +0900 Subject: [PATCH 1/2] =?UTF-8?q?chore:=20presentation-compose=20=EB=AA=A8?= =?UTF-8?q?=EB=93=88=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 2 + presentation-compose/.gitignore | 1 + presentation-compose/build.gradle.kts | 101 ++++++++++++++++++ presentation-compose/consumer-rules.pro | 0 presentation-compose/proguard-rules.pro | 21 ++++ .../ExampleInstrumentedTest.kt | 24 +++++ .../src/main/AndroidManifest.xml | 12 +++ .../presentation_compose/ExampleUnitTest.kt | 17 +++ settings.gradle.kts | 1 + 9 files changed, 179 insertions(+) create mode 100644 presentation-compose/.gitignore create mode 100644 presentation-compose/build.gradle.kts create mode 100644 presentation-compose/consumer-rules.pro create mode 100644 presentation-compose/proguard-rules.pro create mode 100644 presentation-compose/src/androidTest/java/com/plub/presentation_compose/ExampleInstrumentedTest.kt create mode 100644 presentation-compose/src/main/AndroidManifest.xml create mode 100644 presentation-compose/src/test/java/com/plub/presentation_compose/ExampleUnitTest.kt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 9b905993d..b3d64af95 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -49,6 +49,8 @@ android { dependencies { implementation(project(":domain")) implementation(project(":data")) + implementation(project(":design-system")) + implementation(project(":presentation-compose")) implementation(AndroidX.CORE_KTX) implementation(AndroidX.APP_COMPAT) diff --git a/presentation-compose/.gitignore b/presentation-compose/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/presentation-compose/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/presentation-compose/build.gradle.kts b/presentation-compose/build.gradle.kts new file mode 100644 index 000000000..cdb150ca2 --- /dev/null +++ b/presentation-compose/build.gradle.kts @@ -0,0 +1,101 @@ +plugins { + id("com.android.library") + id("dagger.hilt.android.plugin") + kotlin("android") + kotlin("kapt") + id("androidx.navigation.safeargs.kotlin") + id("com.google.gms.google-services") + id("kotlin-parcelize") +} + +android { + namespace = "com.plub.presentation_compose" + compileSdk = 33 + + defaultConfig { + minSdk = 26 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + } + buildFeatures { + viewBinding = true + } +} + +dependencies { + implementation(project(":domain")) + implementation(project(":design-system")) + + implementation(Kotlin.KOTLIN_STDLIB) + implementation(Kotlin.COROUTINES_ANDROID) + implementation(Kotlin.COROUTINES_CORE) + + implementation(AndroidX.APP_COMPAT) + implementation(AndroidX.CORE_KTX) + implementation(AndroidX.LIFECYCLE_RUNTIME_KTX) + implementation(AndroidX.CONSTRAINT_LAYOUT) + implementation(AndroidX.LIFECYCLE_VIEW_MODEL_KTX) + implementation(AndroidX.ACTIVITY_KTX) + implementation(AndroidX.FRAGMENT_KTX) + implementation(AndroidX.NAVIGATION_FRAGMENT_KTX) + implementation(AndroidX.NAVIGATION_UI_KTX) + implementation(AndroidX.LEGACY_SUPPORT) + implementation(AndroidX.RECYCLER_VIEW) + implementation(AndroidX.PAGING3_RUNTIME) + implementation(AndroidX.PAGING3_COMMON_KTX) + + implementation(Libraries.CALENDAR_VIEW) + implementation(Libraries.COIL) + implementation(Libraries.TIMBER) + implementation(Libraries.LOTTIE) + implementation(Libraries.INDICATOR) + implementation(Libraries.KAKAO) + implementation(Libraries.TED_PERMISSION) + implementation(Libraries.THREE_TEN_ABP) + implementation(Libraries.IMAGE_CROPPER) + implementation(Libraries.POWER_MENU) + + implementation(Google.MATERIAL) + implementation(Google.HILT_ANDROID) + implementation(Google.GOOGLE_PLAY_SERVICE) + implementation(Google.FLEX_BOX) + implementation(Google.FIREBASE_BOM) + implementation(Google.FCM) + implementation(Google.FCM_KTX) + + implementation(Glide.GLIDE) + implementation("com.google.android.material:material:1.9.0") + implementation("androidx.appcompat:appcompat:1.6.1") + implementation("androidx.constraintlayout:constraintlayout:2.1.4") + implementation("androidx.navigation:navigation-fragment-ktx:2.7.3") + implementation("androidx.navigation:navigation-ui-ktx:2.7.3") + annotationProcessor(Glide.GLIDE_COMPILER) + + implementation(Compose.COMPOSE_ACTIVITY) + implementation(Compose.COMPOSE_MATERIAL) + implementation(Compose.COMPOSE_PREVIEW) + implementation(Compose.COMPOSE_UI) + implementation(Compose.COMPOSE_NAV) + implementation(Compose.COMPOSE_ANI_NAV) + implementation(Compose.COMPOSE_UI_TOOL) + + kapt(Google.HILT_ANDROID_COMPILER) +} \ No newline at end of file diff --git a/presentation-compose/consumer-rules.pro b/presentation-compose/consumer-rules.pro new file mode 100644 index 000000000..e69de29bb diff --git a/presentation-compose/proguard-rules.pro b/presentation-compose/proguard-rules.pro new file mode 100644 index 000000000..481bb4348 --- /dev/null +++ b/presentation-compose/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/presentation-compose/src/androidTest/java/com/plub/presentation_compose/ExampleInstrumentedTest.kt b/presentation-compose/src/androidTest/java/com/plub/presentation_compose/ExampleInstrumentedTest.kt new file mode 100644 index 000000000..bf229951d --- /dev/null +++ b/presentation-compose/src/androidTest/java/com/plub/presentation_compose/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.plub.presentation_compose + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.plub.presentation_compose.test", appContext.packageName) + } +} \ No newline at end of file diff --git a/presentation-compose/src/main/AndroidManifest.xml b/presentation-compose/src/main/AndroidManifest.xml new file mode 100644 index 000000000..745d27581 --- /dev/null +++ b/presentation-compose/src/main/AndroidManifest.xml @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git a/presentation-compose/src/test/java/com/plub/presentation_compose/ExampleUnitTest.kt b/presentation-compose/src/test/java/com/plub/presentation_compose/ExampleUnitTest.kt new file mode 100644 index 000000000..db727e0cd --- /dev/null +++ b/presentation-compose/src/test/java/com/plub/presentation_compose/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package com.plub.presentation_compose + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index f490af8de..2972e5139 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -3,3 +3,4 @@ include (":app") include (":domain") include (":data") include(":design-system") +include(":presentation-compose") From b7d7d8ef7c02cda162d0f182836be864d9aa39e8 Mon Sep 17 00:00:00 2001 From: jinukeu Date: Wed, 4 Oct 2023 16:38:43 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=EB=B9=8C=EB=93=9C=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 7 +- build.gradle.kts | 4 ++ buildSrc/src/main/java/Configs.kt | 4 +- buildSrc/src/main/java/Versions.kt | 6 +- data/build.gradle.kts | 15 ++-- .../java/com/plub/data/dao/RecentSearchDao.kt | 16 ++--- .../KakaoLocationInfoResponse.kt | 8 +++ design-system/build.gradle.kts | 12 ++-- domain/build.gradle.kts | 4 +- gradle/wrapper/gradle-wrapper.properties | 6 +- presentation-compose/build.gradle.kts | 33 ++++++++- .../ExampleInstrumentedTest.kt | 24 ------- .../src/main/AndroidManifest.xml | 13 +++- .../plub/presentation_compose/MainActivity.kt | 46 ++++++++++++ .../presentation_compose/ui/theme/Color.kt | 11 +++ .../presentation_compose/ui/theme/Theme.kt | 70 +++++++++++++++++++ .../presentation_compose/ui/theme/Type.kt | 34 +++++++++ .../src/main/res/values/strings.xml | 3 + .../src/main/res/values/themes.xml | 5 ++ .../presentation_compose/ExampleUnitTest.kt | 17 ----- presentation/build.gradle.kts | 6 +- 21 files changed, 259 insertions(+), 85 deletions(-) delete mode 100644 presentation-compose/src/androidTest/java/com/plub/presentation_compose/ExampleInstrumentedTest.kt create mode 100644 presentation-compose/src/main/java/com/plub/presentation_compose/MainActivity.kt create mode 100644 presentation-compose/src/main/java/com/plub/presentation_compose/ui/theme/Color.kt create mode 100644 presentation-compose/src/main/java/com/plub/presentation_compose/ui/theme/Theme.kt create mode 100644 presentation-compose/src/main/java/com/plub/presentation_compose/ui/theme/Type.kt create mode 100644 presentation-compose/src/main/res/values/strings.xml create mode 100644 presentation-compose/src/main/res/values/themes.xml delete mode 100644 presentation-compose/src/test/java/com/plub/presentation_compose/ExampleUnitTest.kt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index b3d64af95..13d7908f0 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -8,6 +8,7 @@ plugins { android { compileSdk = Configs.COMPILE_SDK + namespace = "com.plub.plubandroid" defaultConfig { applicationId = "com.plub.plubandroid" @@ -29,11 +30,11 @@ android { } } compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = "1.8" + jvmTarget = JavaVersion.VERSION_17.toString() } composeOptions { diff --git a/build.gradle.kts b/build.gradle.kts index f6745d701..561ce3d7c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,8 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id("com.google.devtools.ksp") version "1.9.10-1.0.13" apply false +} + buildscript { repositories { google() diff --git a/buildSrc/src/main/java/Configs.kt b/buildSrc/src/main/java/Configs.kt index 9d2b63ecf..95b52d87b 100644 --- a/buildSrc/src/main/java/Configs.kt +++ b/buildSrc/src/main/java/Configs.kt @@ -4,10 +4,10 @@ object Configs { const val KOTLIN_KAPT = "kotlin-kapt" //Android Config - const val COMPILE_SDK = 33 + const val COMPILE_SDK = 34 //Android Default Config - const val MIN_SDK = 23 + const val MIN_SDK = 26 const val TARGET_SDK = 33 const val VERSION_CODE = 1 const val VERSION_NAME = "1.0.0" diff --git a/buildSrc/src/main/java/Versions.kt b/buildSrc/src/main/java/Versions.kt index aff8d6735..8f62aeaf7 100644 --- a/buildSrc/src/main/java/Versions.kt +++ b/buildSrc/src/main/java/Versions.kt @@ -1,8 +1,8 @@ object Versions { - const val GRADLE = "7.3.1" + const val GRADLE = "8.1.1" /* [ Kotlin ] */ - const val KOTLIN_VERSION = "1.7.10" + const val KOTLIN_VERSION = "1.9.10" const val KOTLIN_COROUTINE = "1.6.4" const val KOTLIN_SERIALIZATION = "1.7.0" const val KOTLIN_SERIALIZATION_JSON = "1.3.2" @@ -25,7 +25,7 @@ object Versions { /* [ Google ] */ const val GOOGLE_PLAY_SERVICE = "20.3.0" - const val HILT = "2.42" + const val HILT = "2.48" const val MATERIAL = "1.6.1" const val TINK = "1.7.0" const val PROTOBUF = "3.21.7" diff --git a/data/build.gradle.kts b/data/build.gradle.kts index 1ff6a2011..338f4774e 100644 --- a/data/build.gradle.kts +++ b/data/build.gradle.kts @@ -4,13 +4,15 @@ plugins { id("com.android.library") id("dagger.hilt.android.plugin") id("org.jetbrains.kotlin.plugin.serialization") - id("com.google.protobuf") version "0.8.19" + id("com.google.protobuf") version "0.9.1" kotlin("android") kotlin("kapt") + id("com.google.devtools.ksp") } android { compileSdk = Configs.COMPILE_SDK + namespace = "com.plub.data" defaultConfig { minSdk = Configs.MIN_SDK @@ -19,11 +21,11 @@ android { testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = "1.8" + jvmTarget = JavaVersion.VERSION_17.toString() } } @@ -41,7 +43,7 @@ dependencies { implementation(AndroidX.PAGING3_COMMON_KTX) implementation(AndroidX.ROOM) implementation(AndroidX.ROOM_KTX) - kapt(AndroidX.ROOM_COMPILER) + ksp(AndroidX.ROOM_COMPILER) implementation(Libraries.RETROFIT) implementation(Libraries.RETROFIT_CONVERTER_GSON) @@ -63,12 +65,11 @@ protobuf { } generateProtoTasks { all().forEach { task -> - task.plugins { + task.builtins { create("java") { option("lite") } } - } } } \ No newline at end of file diff --git a/data/src/main/java/com/plub/data/dao/RecentSearchDao.kt b/data/src/main/java/com/plub/data/dao/RecentSearchDao.kt index 8b864bd74..59c777bc6 100644 --- a/data/src/main/java/com/plub/data/dao/RecentSearchDao.kt +++ b/data/src/main/java/com/plub/data/dao/RecentSearchDao.kt @@ -10,21 +10,21 @@ import kotlinx.coroutines.flow.Flow @Dao interface RecentSearchDao { - @Query("SELECT * FROM ${EntityTable.RECENT_SEARCH} ORDER BY saveTime DESC LIMIT :count") + @Query("SELECT * FROM ${EntityTable.RECENT_SEARCH} ORDER BY saveTime DESC LIMIT :arg0") fun getSearches(count: Int): Flow> @Query("SELECT COUNT(*) FROM ${EntityTable.RECENT_SEARCH}") - suspend fun getSearchesCount(): Int + fun getSearchesCount(): Int - @Query("DELETE FROM ${EntityTable.RECENT_SEARCH} WHERE search = :search") - suspend fun deleteBySearch(search: String) + @Query("DELETE FROM ${EntityTable.RECENT_SEARCH} WHERE search = :arg0") + fun deleteBySearch(search: String): Int @Insert(onConflict = REPLACE) - suspend fun insert(recentSearchEntity: RecentSearchEntity) + fun insert(recentSearchEntity: RecentSearchEntity) - @Query("DELETE FROM ${EntityTable.RECENT_SEARCH} WHERE saveTime IN (SELECT saveTime FROM ${EntityTable.RECENT_SEARCH} ORDER BY saveTime ASC LIMIT :count )") - suspend fun deleteOldestSearch(count: Int) + @Query("DELETE FROM ${EntityTable.RECENT_SEARCH} WHERE saveTime IN (SELECT saveTime FROM ${EntityTable.RECENT_SEARCH} ORDER BY saveTime ASC LIMIT :arg0 )") + fun deleteOldestSearch(count: Int): Int @Query("DELETE FROM ${EntityTable.RECENT_SEARCH}") - suspend fun deleteAll() + fun deleteAll() } \ No newline at end of file diff --git a/data/src/main/java/com/plub/data/dto/kakaoLocation/KakaoLocationInfoResponse.kt b/data/src/main/java/com/plub/data/dto/kakaoLocation/KakaoLocationInfoResponse.kt index 83020d482..ee927918f 100644 --- a/data/src/main/java/com/plub/data/dto/kakaoLocation/KakaoLocationInfoResponse.kt +++ b/data/src/main/java/com/plub/data/dto/kakaoLocation/KakaoLocationInfoResponse.kt @@ -14,6 +14,14 @@ data class KakaoLocationInfoResponse( data class KakaoLocationInfoDocument( @SerialName("place_name") val placeName: String = "", + @SerialName("x") + val placePositionX: String = "", + @SerialName("y") + val placePositionY: String = "", + @SerialName("address_name") + val addressName: String = "", + @SerialName("road_address_name") + val roadAddressName: String = "" ) data class Meta( diff --git a/design-system/build.gradle.kts b/design-system/build.gradle.kts index 341e8db79..5d5fb73fe 100644 --- a/design-system/build.gradle.kts +++ b/design-system/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("com.android.application") + id("com.android.library") id("org.jetbrains.kotlin.android") } @@ -8,11 +8,7 @@ android { compileSdk = 33 defaultConfig { - applicationId = "com.plub.design_system" minSdk = 26 - targetSdk = 33 - versionCode = 1 - versionName = "1.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } @@ -27,8 +23,8 @@ android { } } compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } buildFeatures { @@ -40,7 +36,7 @@ android { } kotlinOptions { - jvmTarget = "1.8" + jvmTarget = JavaVersion.VERSION_17.toString() } } diff --git a/domain/build.gradle.kts b/domain/build.gradle.kts index 3f45b04e2..a99cb8fca 100644 --- a/domain/build.gradle.kts +++ b/domain/build.gradle.kts @@ -4,8 +4,8 @@ plugins { } java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } dependencies { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7cfa3c3fe..dbe32e6b4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sat Sep 10 10:41:11 KST 2022 +#Wed Oct 04 15:15:31 KST 2023 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/presentation-compose/build.gradle.kts b/presentation-compose/build.gradle.kts index cdb150ca2..bf58bcc53 100644 --- a/presentation-compose/build.gradle.kts +++ b/presentation-compose/build.gradle.kts @@ -17,6 +17,9 @@ android { testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles("consumer-rules.pro") + vectorDrawables { + useSupportLibrary = true + } } buildTypes { @@ -29,14 +32,27 @@ android { } } compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } + kotlinOptions { - jvmTarget = "1.8" + jvmTarget = JavaVersion.VERSION_17.toString() + } + + composeOptions { + kotlinCompilerExtensionVersion = Versions.COMPOSE_COMPLIER } + + buildFeatures { viewBinding = true + compose = true + } + packaging { + resources { + excludes += "/META-INF/{AL2.0,LGPL2.1}" + } } } @@ -87,6 +103,15 @@ dependencies { implementation("androidx.constraintlayout:constraintlayout:2.1.4") implementation("androidx.navigation:navigation-fragment-ktx:2.7.3") implementation("androidx.navigation:navigation-ui-ktx:2.7.3") + implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2") + implementation("androidx.activity:activity-compose:1.7.2") + implementation(platform("androidx.compose:compose-bom:2023.03.00")) + implementation("androidx.compose.ui:ui") + implementation("androidx.compose.ui:ui-graphics") + implementation("androidx.compose.ui:ui-tooling-preview") + implementation("androidx.compose.material3:material3") + androidTestImplementation(platform("androidx.compose:compose-bom:2023.03.00")) + androidTestImplementation("androidx.compose.ui:ui-test-junit4") annotationProcessor(Glide.GLIDE_COMPILER) implementation(Compose.COMPOSE_ACTIVITY) @@ -96,6 +121,8 @@ dependencies { implementation(Compose.COMPOSE_NAV) implementation(Compose.COMPOSE_ANI_NAV) implementation(Compose.COMPOSE_UI_TOOL) + debugImplementation("androidx.compose.ui:ui-tooling") + debugImplementation("androidx.compose.ui:ui-test-manifest") kapt(Google.HILT_ANDROID_COMPILER) } \ No newline at end of file diff --git a/presentation-compose/src/androidTest/java/com/plub/presentation_compose/ExampleInstrumentedTest.kt b/presentation-compose/src/androidTest/java/com/plub/presentation_compose/ExampleInstrumentedTest.kt deleted file mode 100644 index bf229951d..000000000 --- a/presentation-compose/src/androidTest/java/com/plub/presentation_compose/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.plub.presentation_compose - -import androidx.test.platform.app.InstrumentationRegistry -import androidx.test.ext.junit.runners.AndroidJUnit4 - -import org.junit.Test -import org.junit.runner.RunWith - -import org.junit.Assert.* - -/** - * Instrumented test, which will execute on an Android device. - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -@RunWith(AndroidJUnit4::class) -class ExampleInstrumentedTest { - @Test - fun useAppContext() { - // Context of the app under test. - val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("com.plub.presentation_compose.test", appContext.packageName) - } -} \ No newline at end of file diff --git a/presentation-compose/src/main/AndroidManifest.xml b/presentation-compose/src/main/AndroidManifest.xml index 745d27581..fa5f6e257 100644 --- a/presentation-compose/src/main/AndroidManifest.xml +++ b/presentation-compose/src/main/AndroidManifest.xml @@ -1,12 +1,21 @@ - + + android:theme="@style/Theme.PlubAndroid"> + + + + + + + + + \ No newline at end of file diff --git a/presentation-compose/src/main/java/com/plub/presentation_compose/MainActivity.kt b/presentation-compose/src/main/java/com/plub/presentation_compose/MainActivity.kt new file mode 100644 index 000000000..b6f861682 --- /dev/null +++ b/presentation-compose/src/main/java/com/plub/presentation_compose/MainActivity.kt @@ -0,0 +1,46 @@ +package com.plub.presentation_compose + +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 com.plub.presentation_compose.ui.theme.PlubAndroidTheme + +class MainActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContent { + PlubAndroidTheme { + // 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 + ) +} + +@Preview(showBackground = true) +@Composable +fun GreetingPreview() { + PlubAndroidTheme { + Greeting("Android") + } +} \ No newline at end of file diff --git a/presentation-compose/src/main/java/com/plub/presentation_compose/ui/theme/Color.kt b/presentation-compose/src/main/java/com/plub/presentation_compose/ui/theme/Color.kt new file mode 100644 index 000000000..ab93b5025 --- /dev/null +++ b/presentation-compose/src/main/java/com/plub/presentation_compose/ui/theme/Color.kt @@ -0,0 +1,11 @@ +package com.plub.presentation_compose.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/presentation-compose/src/main/java/com/plub/presentation_compose/ui/theme/Theme.kt b/presentation-compose/src/main/java/com/plub/presentation_compose/ui/theme/Theme.kt new file mode 100644 index 000000000..4eaabc120 --- /dev/null +++ b/presentation-compose/src/main/java/com/plub/presentation_compose/ui/theme/Theme.kt @@ -0,0 +1,70 @@ +package com.plub.presentation_compose.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 PlubAndroidTheme( + 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/presentation-compose/src/main/java/com/plub/presentation_compose/ui/theme/Type.kt b/presentation-compose/src/main/java/com/plub/presentation_compose/ui/theme/Type.kt new file mode 100644 index 000000000..5bbcc3a08 --- /dev/null +++ b/presentation-compose/src/main/java/com/plub/presentation_compose/ui/theme/Type.kt @@ -0,0 +1,34 @@ +package com.plub.presentation_compose.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/presentation-compose/src/main/res/values/strings.xml b/presentation-compose/src/main/res/values/strings.xml new file mode 100644 index 000000000..2ca737562 --- /dev/null +++ b/presentation-compose/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + MainActivity + \ No newline at end of file diff --git a/presentation-compose/src/main/res/values/themes.xml b/presentation-compose/src/main/res/values/themes.xml new file mode 100644 index 000000000..064908c0c --- /dev/null +++ b/presentation-compose/src/main/res/values/themes.xml @@ -0,0 +1,5 @@ + + + +