This repository was archived by the owner on Dec 27, 2024. It is now read-only.
File tree 3 files changed +21
-9
lines changed
demoProjects/ComposeGraph3d
src/main/java/android/support/composegraph3d
3 files changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -19,11 +19,22 @@ android {
19
19
useSupportLibrary true
20
20
}
21
21
}
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
+ }
23
33
buildTypes {
24
34
release {
25
35
minifyEnabled false
26
36
proguardFiles getDefaultProguardFile(' proguard-android-optimize.txt' ), ' proguard-rules.pro'
37
+ signingConfig signingConfigs. debug
27
38
}
28
39
}
29
40
compileOptions {
@@ -37,7 +48,7 @@ android {
37
48
compose true
38
49
}
39
50
composeOptions {
40
- kotlinCompilerExtensionVersion ' 1.2.0 '
51
+ kotlinCompilerExtensionVersion ' 1.4.7 '
41
52
}
42
53
packagingOptions {
43
54
resources {
@@ -53,6 +64,7 @@ dependencies {
53
64
implementation ' androidx.activity:activity-compose:1.3.1'
54
65
implementation " androidx.compose.ui:ui:$compose_ui_version "
55
66
implementation " androidx.compose.ui:ui-tooling-preview:$compose_ui_version "
67
+ implementation " androidx.compose.runtime:runtime-android:1.5.0-beta02"
56
68
implementation ' androidx.compose.material:material:1.2.0'
57
69
testImplementation ' junit:junit:4.13.2'
58
70
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) {
62
62
63
63
@Composable
64
64
fun 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()) }
67
67
68
68
LaunchedEffect (Unit ) {
69
69
while (isActive) {
70
70
withFrameNanos {
71
- time.value = System .nanoTime()
71
+ time.longValue = System .nanoTime()
72
+ graph.getImageForTime(time.longValue)
72
73
}
73
74
}
74
75
}
75
76
76
- var bitmap = graph.getImageForTime(time.value)
77
-
78
77
Canvas (modifier = modifier
79
78
.onPlaced {
80
79
graph.setSize(it.size.width, it.size.width)
@@ -95,8 +94,9 @@ fun Graph3D(modifier: Modifier) {
95
94
}
96
95
)
97
96
}) {
97
+ time.longValue
98
98
scale(2.0f , pivot = Offset (0f ,0f )) {
99
- drawImage(bitmap)
99
+ drawImage(graph. bitmap)
100
100
}
101
101
}
102
102
Original file line number Diff line number Diff line change @@ -6,5 +6,5 @@ buildscript {
6
6
plugins {
7
7
id ' com.android.application' version ' 7.4.2' apply false
8
8
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
10
10
}
You can’t perform that action at this time.
0 commit comments