-
-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
1,148 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[versions] | ||
agp = "8.7.0" | ||
kotlin = "2.0.0" | ||
coreKtx = "1.10.1" | ||
junit = "4.14-SNAPSHOT" | ||
junitVersion = "1.1.5" | ||
espressoCore = "3.5.1" | ||
lifecycleRuntimeKtx = "2.6.1" | ||
activityCompose = "1.8.0" | ||
composeBom = "2024.04.01" | ||
coilCompose = "2.4.0" | ||
composeRuntimeLiveData="1.7.0" | ||
accompanistPager = "0.24.7-alpha" | ||
lifecycleViewmodelCompose = "2.8.5" | ||
|
||
|
||
[libraries] | ||
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } | ||
junit = { group = "junit", name = "junit", version.ref = "junit" } | ||
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } | ||
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } | ||
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" } | ||
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" } | ||
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" } | ||
androidx-ui = { group = "androidx.compose.ui", name = "ui" } | ||
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" } | ||
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" } | ||
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } | ||
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } | ||
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" } | ||
androidx-material3 = { group = "androidx.compose.material3", name = "material3" } | ||
coil-compose = {group="io.coil-kt", name="coil-compose",version.ref = "coilCompose"} | ||
accompanist-pager = {group = "com.google.accompanist",name="accompanist-pager",version.ref = "accompanistPager"} | ||
accompanist-pager-indicator = {group = "com.google.accompanist",name="accompanist-pager-indicators",version.ref = "accompanistPager"} | ||
androidx-compose-runtime = {group = "androidx.compose.runtime",name="runtime-livedata",version.ref = "composeRuntimeLiveData"} | ||
androidx-lifecycle-viewmodel-compose = {group = "androidx.lifecycle",name="lifecycle-viewmodel-compose",version.ref = "lifecycleViewmodelCompose"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
imitate/src/main/java/com/engineer/imitate/ui/fragments/ComposeFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package com.engineer.compose.ui | ||
|
||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.material3.Button | ||
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.platform.ComposeView | ||
import androidx.compose.ui.platform.ViewCompositionStrategy | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.fragment.app.Fragment | ||
import com.alibaba.android.arouter.facade.annotation.Route | ||
import com.engineer.compose.ui.ui.theme.MiniAppTheme | ||
import com.engineer.imitate.R | ||
|
||
/** | ||
* A simple [Fragment] subclass. | ||
* | ||
*/ | ||
@Route(path = "/anim/compose") | ||
class ComposeFragment : Fragment() { | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? | ||
): View? { | ||
// Inflate the layout for this fragment | ||
val view = inflater.inflate(R.layout.fragment_compose, container, false) | ||
val composeView = view.findViewById<ComposeView>(R.id.compose_view) | ||
composeView.apply { | ||
// Dispose of the Composition when the view's LifecycleOwner | ||
// is destroyed | ||
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed) | ||
setContent { | ||
// SimpleScreen() | ||
MiniAppTheme { | ||
// A surface container using the 'background' color from the theme | ||
Surface(color = MaterialTheme.colorScheme.background) { | ||
MessageCard(Message("lucy", "hello world")) | ||
} | ||
} | ||
} | ||
} | ||
return view | ||
} | ||
} | ||
|
||
//@Composable | ||
//private fun SimpleScreen() { | ||
// Column(Modifier.fillMaxSize()) { | ||
// Text( | ||
// text = stringResource(R.string.content), | ||
// style = MaterialTheme.typography.headlineMedium | ||
// ) | ||
// Text( | ||
// text = stringResource(R.string.content), | ||
// style = MaterialTheme.typography.headlineSmall | ||
// ) | ||
// Text( | ||
// text = stringResource(R.string.content), | ||
// style = MaterialTheme.typography.bodyMedium | ||
// ) | ||
// Spacer(modifier = Modifier.weight(1f)) | ||
// Button(onClick = { /* Handle click */ }, Modifier.fillMaxWidth()) { | ||
// Text(text = stringResource(R.string.content)) | ||
// } | ||
// } | ||
//} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<androidx.compose.ui.platform.ComposeView | ||
android:id="@+id/compose_view" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" /> | ||
|
||
</FrameLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,5 @@ include ':app', | |
':subs:gif-revert', | ||
':subs:game', | ||
':subs:cpp_native', | ||
':subs:ai' | ||
':subs:ai', | ||
':subs:compose' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
plugins { | ||
id 'com.android.library' | ||
id 'org.jetbrains.kotlin.android' | ||
id 'org.jetbrains.kotlin.plugin.compose' | ||
} | ||
android { | ||
namespace 'com.engineer.compose' | ||
compileSdk 34 | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled 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 { | ||
compose true | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation libs.androidx.core.ktx | ||
implementation libs.androidx.lifecycle.runtime.ktx | ||
api libs.androidx.activity.compose | ||
api platform(libs.androidx.compose.bom) | ||
api libs.androidx.ui | ||
api libs.androidx.ui.graphics | ||
api libs.androidx.ui.tooling.preview | ||
api libs.androidx.material3 | ||
api libs.coil.compose | ||
api "io.coil-kt:coil-gif:2.6.0" | ||
|
||
api libs.androidx.compose.runtime | ||
api libs.androidx.lifecycle.viewmodel.compose | ||
|
||
api libs.accompanist.pager | ||
api libs.accompanist.pager.indicator | ||
|
||
|
||
testImplementation libs.junit | ||
androidTestImplementation libs.androidx.junit | ||
androidTestImplementation libs.androidx.espresso.core | ||
androidTestImplementation platform(libs.androidx.compose.bom) | ||
androidTestImplementation libs.androidx.ui.test.junit4 | ||
debugApi libs.androidx.ui.tooling | ||
debugImplementation libs.androidx.ui.test.manifest | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
24 changes: 24 additions & 0 deletions
24
subs/compose/src/androidTest/java/com/engineer/compose/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.engineer.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.engineer.compose.test", appContext.packageName) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<uses-permission android:name="android.permission.RECORD_AUDIO" /> | ||
|
||
<application> | ||
<activity | ||
android:name=".ui.GalleryActivity" | ||
android:exported="false" | ||
android:label="@string/title_activity_gallery" | ||
android:theme="@style/Theme.MiniApp" /> | ||
<activity | ||
android:name=".ui.MainComposeActivity" | ||
android:exported="true" | ||
android:label="@string/title_activity_main_compose" | ||
android:theme="@style/ComposeApp.Theme" /> | ||
<activity | ||
android:name=".ui.ChatActivity" | ||
android:exported="true" | ||
android:theme="@style/ComposeApp.Theme" | ||
android:windowSoftInputMode="adjustResize" /> | ||
</application> | ||
|
||
</manifest> |
Oops, something went wrong.