This repository was archived by the owner on Dec 27, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +21
-9
lines changed
demoProjects/ComposeGraph3d
src/main/java/android/support/composegraph3d Expand file tree Collapse file tree 3 files changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -19,11 +19,22 @@ android {
1919 useSupportLibrary true
2020 }
2121 }
22-
22+ signingConfigs {
23+ debug {
24+ // For Linux & mac:
25+ storeFile file(System . getenv(" HOME" ) + ' /.android/debug.keystore' )
26+ // For Windows:
27+ // storeFile file('/Users/USERNAME/.android/debug.keystore')
28+ storePassword ' android'
29+ keyAlias ' androiddebugkey'
30+ keyPassword ' android'
31+ }
32+ }
2333 buildTypes {
2434 release {
2535 minifyEnabled false
2636 proguardFiles getDefaultProguardFile(' proguard-android-optimize.txt' ), ' proguard-rules.pro'
37+ signingConfig signingConfigs. debug
2738 }
2839 }
2940 compileOptions {
@@ -37,7 +48,7 @@ android {
3748 compose true
3849 }
3950 composeOptions {
40- kotlinCompilerExtensionVersion ' 1.2.0 '
51+ kotlinCompilerExtensionVersion ' 1.4.7 '
4152 }
4253 packagingOptions {
4354 resources {
@@ -53,6 +64,7 @@ dependencies {
5364 implementation ' androidx.activity:activity-compose:1.3.1'
5465 implementation " androidx.compose.ui:ui:$compose_ui_version "
5566 implementation " androidx.compose.ui:ui-tooling-preview:$compose_ui_version "
67+ implementation " androidx.compose.runtime:runtime-android:1.5.0-beta02"
5668 implementation ' androidx.compose.material:material:1.2.0'
5769 testImplementation ' junit:junit:4.13.2'
5870 androidTestImplementation ' androidx.test.ext:junit:1.1.5'
Original file line number Diff line number Diff line change @@ -62,19 +62,18 @@ fun Greeting(name: String) {
6262
6363@Composable
6464fun Graph3D (modifier : Modifier ) {
65- var graph = remember { Graph () }
66- val time = remember { mutableStateOf (System .nanoTime()) }
65+ val graph = remember { Graph () }
66+ val time = remember { mutableLongStateOf (System .nanoTime()) }
6767
6868 LaunchedEffect (Unit ) {
6969 while (isActive) {
7070 withFrameNanos {
71- time.value = System .nanoTime()
71+ time.longValue = System .nanoTime()
72+ graph.getImageForTime(time.longValue)
7273 }
7374 }
7475 }
7576
76- var bitmap = graph.getImageForTime(time.value)
77-
7877 Canvas (modifier = modifier
7978 .onPlaced {
8079 graph.setSize(it.size.width, it.size.width)
@@ -95,8 +94,9 @@ fun Graph3D(modifier: Modifier) {
9594 }
9695 )
9796 }) {
97+ time.longValue
9898 scale(2.0f , pivot = Offset (0f ,0f )) {
99- drawImage(bitmap)
99+ drawImage(graph. bitmap)
100100 }
101101 }
102102
Original file line number Diff line number Diff line change @@ -6,5 +6,5 @@ buildscript {
66plugins {
77 id ' com.android.application' version ' 7.4.2' apply false
88 id ' com.android.library' version ' 7.4.2' apply false
9- id ' org.jetbrains.kotlin.android' version ' 1.7.0 ' apply false
9+ id ' org.jetbrains.kotlin.android' version ' 1.8.21 ' apply false
1010}
You can’t perform that action at this time.
0 commit comments