Skip to content

Commit

Permalink
Merge pull request #5 from whatrushki/egor
Browse files Browse the repository at this point in the history
graph
  • Loading branch information
EgorVorOK authored Nov 23, 2024
2 parents 16eeb4a + 65d8464 commit f77834b
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 7 deletions.
4 changes: 4 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ dependencies {
implementation(project(":features:main"))
implementation(project(":features:auth"))
implementation(project(":features:splash"))
implementation ("io.github.ehsannarmani:compose-charts:0.0.18")

implementation(libs.bundles.koin)
implementation(libs.bundles.ktor)
Expand All @@ -64,6 +65,9 @@ dependencies {
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
implementation(libs.material)
implementation(libs.material)
implementation(libs.material)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
Expand Down
61 changes: 55 additions & 6 deletions app/src/main/java/com/chillrate/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,70 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import com.chillrate.foundation.services.ProvideGlobalSheet
import com.chillrate.navigation.AppNavHost
import androidx.compose.animation.core.tween
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.unit.dp
import com.chillrate.ui.theme.AppTheme
import ir.ehsannarmani.compose_charts.LineChart
import ir.ehsannarmani.compose_charts.models.DrawStyle
import ir.ehsannarmani.compose_charts.models.Line
import kotlinx.coroutines.delay


class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
AppTheme {
ProvideGlobalSheet {
AppNavHost()
// val splash = remember { SplashFeature(SplashProvider) }
// splash.content(Modifier)
var liveinfo by remember {
mutableStateOf(listOf(28.0, 41.0, 5.0, 10.0, 35.0))
}

val data = remember(liveinfo) {
listOf(
Line(
label = "Windows",
values = liveinfo.subList((liveinfo.size - 10).coerceAtLeast(0), liveinfo.lastIndex),
color = SolidColor(Color(0xFF23af92)),
firstGradientFillColor = Color.Transparent,
secondGradientFillColor = Color.Transparent,
drawStyle = DrawStyle.Stroke(width = 2.dp),
curvedEdges = false,
gradientAnimationDelay = 0L,
gradientAnimationSpec = tween(0),
strokeAnimationSpec = tween(0)
)
)
}

LineChart(
modifier = Modifier
.padding(horizontal = 40.dp)
.height(200.dp),
data = data,
maxValue = 200.0,
minValue = 0.0
)


LaunchedEffect(Unit) {
while (true) {
liveinfo += liveinfo.random()
delay(1000L)
}
}

}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fun RoomView(
val sheetProvider = LocalSheetProvider.current

val sensorConnected by callibriRepository.controller.sensorConnected.collectAsState()

val data by callibriRepository.data.collectAsState()
sheetProvider.setContent(SensorConnect)

LaunchedEffect(sensorConnected) {
Expand Down

0 comments on commit f77834b

Please sign in to comment.