diff --git a/android-app/build.gradle.kts b/android-app/build.gradle.kts
index 557ae80..f941fba 100644
--- a/android-app/build.gradle.kts
+++ b/android-app/build.gradle.kts
@@ -12,16 +12,31 @@ plugins {
android {
buildFeatures.dataBinding = true
+ buildFeatures.compose = true
defaultConfig {
applicationId = "org.example.app"
-
+ minSdkVersion(21)
versionCode = 1
versionName = "0.1.0"
val url = "https://newsapi.org/v2/"
buildConfigField("String", "BASE_URL", "\"$url\"")
}
+
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+ }
+
+ kotlinOptions {
+ jvmTarget = "1.8"
+ }
+
+ composeOptions {
+ kotlinCompilerVersion = "1.5.21"
+ kotlinCompilerExtensionVersion = "1.0.1"
+ }
}
kapt {
@@ -40,6 +55,14 @@ dependencies {
implementation(libs.swipeRefreshLayout)
implementation(libs.mokoMvvmDataBinding)
+ // Compose
+ implementation(libs.composeActivity)
+ implementation(libs.composeMaterial)
+ implementation(libs.composeAnimation)
+ implementation(libs.composeUi)
+ implementation(libs.composeLifecycleViewmodel)
+ androidTestImplementation(libs.composeTest)
+
// Hilt
implementation(libs.hilt)
kapt(libs.hiltCompiler)
diff --git a/android-app/src/main/AndroidManifest.xml b/android-app/src/main/AndroidManifest.xml
index 8d847d8..26cf4f1 100755
--- a/android-app/src/main/AndroidManifest.xml
+++ b/android-app/src/main/AndroidManifest.xml
@@ -18,5 +18,6 @@
+
diff --git a/android-app/src/main/java/org/example/app/view/ConfigActivity.kt b/android-app/src/main/java/org/example/app/view/ConfigActivity.kt
index 9f1e71d..b8708a7 100644
--- a/android-app/src/main/java/org/example/app/view/ConfigActivity.kt
+++ b/android-app/src/main/java/org/example/app/view/ConfigActivity.kt
@@ -5,6 +5,18 @@
package org.example.app.view
import android.content.Intent
+import androidx.activity.compose.setContent
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.padding
+import androidx.compose.material.Button
+import androidx.compose.material.TextField
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.text.input.TextFieldValue
+import androidx.compose.ui.unit.dp
import androidx.lifecycle.ViewModelProvider
import dagger.hilt.android.AndroidEntryPoint
import dev.icerock.moko.mvvm.MvvmEventsActivity
@@ -40,6 +52,42 @@ class ConfigActivity :
// route called by EventsDispatcher from ViewModel (https://github.com/icerockdev/moko-mvvm)
override fun routeToNews() {
+ setContent{
+ testConfigActivity()
+ }
Intent(this, NewsActivity::class.java).also { startActivity(it) }
}
}
+
+@Composable
+fun testConfigActivity() {
+ Column(modifier = Modifier
+ .fillMaxWidth()
+ .padding(20.dp),
+ ) {
+ val textState1 = remember { mutableStateOf(TextFieldValue()) }
+ TextField(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(4.dp),
+ value = textState1.value,
+ onValueChange = { textState1.value = it }
+ )
+
+ val textState2 = remember { mutableStateOf(TextFieldValue()) }
+ TextField(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(4.dp),
+ value = textState2.value,
+ onValueChange = { textState2.value = it }
+ )
+
+ Button(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(4.dp),
+ onClick = { }) {
+ }
+ }
+}
diff --git a/android-app/src/main/java/org/example/app/view/ConfigActivityCompose.kt b/android-app/src/main/java/org/example/app/view/ConfigActivityCompose.kt
new file mode 100644
index 0000000..37556d8
--- /dev/null
+++ b/android-app/src/main/java/org/example/app/view/ConfigActivityCompose.kt
@@ -0,0 +1,15 @@
+package org.example.app.view
+
+import android.os.Bundle
+import androidx.activity.compose.setContent
+import androidx.appcompat.app.AppCompatActivity
+import androidx.compose.material.Text
+
+class ConfigActivityCompose : AppCompatActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContent {
+ Text("ConfigActivityCompose")
+ }
+ }
+}
\ No newline at end of file
diff --git a/android-app/src/main/java/org/example/app/view/NewsActivityCompose.kt b/android-app/src/main/java/org/example/app/view/NewsActivityCompose.kt
new file mode 100644
index 0000000..54e5e17
--- /dev/null
+++ b/android-app/src/main/java/org/example/app/view/NewsActivityCompose.kt
@@ -0,0 +1,15 @@
+package org.example.app.view
+
+import android.os.Bundle
+import androidx.activity.compose.setContent
+import androidx.appcompat.app.AppCompatActivity
+import androidx.compose.material.Text
+
+class NewsActivityCompose : AppCompatActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContent {
+ Text("NewsActivityCompose")
+ }
+ }
+}
\ No newline at end of file
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 6de040c..4bdb8c2 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -32,7 +32,9 @@ napierVersion = "1.5.0"
testCoreVersion = "1.3.0"
robolectricVersion = "4.6.1"
multidexVersion = "2.0.1"
-
+composeVersion = "1.0.1"
+composeActivityVersion = "1.3.1"
+composeLifecycleViewmodelVersion = "1.0.0-alpha07"
[libraries]
appCompat = { module = "androidx.appcompat:appcompat", version.ref = "androidAppCompatVersion" }
@@ -86,3 +88,9 @@ mokoUnitsTest = { module = "dev.icerock.moko:units-test", version.ref = "mokoUni
multiplatformSettingsTest = { module = "com.russhwolf:multiplatform-settings-test", version.ref = "multiplatformSettingsVersion" }
ktorClientMock = { module = "io.ktor:ktor-client-mock", version.ref = "ktorClientVersion" }
multidex = { module = "androidx.multidex:multidex", version.ref = "multidexVersion" }
+composeUi = { module = "androidx.compose.ui:ui", version.ref = "composeVersion" }
+composeAnimation = { module = "androidx.compose.animation:animation", version.ref = "composeVersion" }
+composeLifecycleViewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "composeLifecycleViewmodelVersion" }
+composeMaterial = { module = "androidx.compose.material:material", version.ref = "composeVersion" }
+composeActivity = { module = "androidx.activity:activity-compose", version.ref = "composeActivityVersion" }
+composeTest = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "composeVersion" }
\ No newline at end of file