3 Commits
Author SHA1 Message Date
smayzy d78b2d0d58 demo values at start 2025-05-25 17:15:25 +02:00
smayzy 5a8279c683 chart translation 2025-05-25 17:07:53 +02:00
smayzy 60831c9fa0 correct light mode 2025-05-21 11:44:12 +02:00
11 changed files with 49 additions and 10 deletions
@@ -93,6 +93,7 @@ class MainActivity : AppCompatActivity() {
listenForData()
}.start()
}
loadInitialReadings()
}
private fun connectToHC05() {
@@ -220,7 +221,7 @@ class MainActivity : AppCompatActivity() {
humEntries.add(Entry(reading.secSinceStart.toFloat(), reading.humidity))
}
val tempSet = LineDataSet(tempEntries, "Temperature (°C)").apply {
val tempSet = LineDataSet(tempEntries, getString(R.string.temp_tx)).apply {
color = Color.RED
lineWidth = 2f
setDrawCircles(false)
@@ -229,7 +230,7 @@ class MainActivity : AppCompatActivity() {
fillDrawable = ContextCompat.getDrawable(this@MainActivity, R.drawable.gradiant_temp)
}
val humSet = LineDataSet(humEntries, "Humidity (%)").apply {
val humSet = LineDataSet(humEntries, getString(R.string.hum_tx)).apply {
color = Color.BLUE
lineWidth = 2f
setDrawCircles(false)
@@ -274,4 +275,21 @@ class MainActivity : AppCompatActivity() {
return pipedInput
}
private fun loadInitialReadings() {
val initialReadings = listOf(
SensorReading(0, 22.8f, 67.4f),
SensorReading(10, 9.0f, 70.2f),
SensorReading(20, 5.8f, 58.2f),
SensorReading(30, 12.8f, 32.1f),
SensorReading(40, 25.8f, 25.7f),
SensorReading(50, 5.8f, 72.7f)
)
sensorHistory.addAll(initialReadings)
updateChartData()
val last = initialReadings.last()
tempCircle.text = getString(R.string.temp_format, last.temperature)
humCircle.text = getString(R.string.hum_format, last.humidity)
}
}
+2
View File
@@ -7,4 +7,6 @@
<string name="is_testing_mode">Die Anwendung läuft im Testmodus, die Werte sind zufällig</string>
<string name="hc05_not_found">HC-05 nicht gefunden, versuchen Sie, es über Bluetooth mit Ihrem Telefon zu koppeln</string>
<string name="connection_failed">Verbindung fehlgeschlagen</string>
<string name="temp_tx">Temperatur (°C)</string>
<string name="hum_tx">Luftfeuchtigkeit (%)</string>
</resources>
+2
View File
@@ -7,4 +7,6 @@
<string name="is_testing_mode">La aplicación se está ejecutando en modo de prueba los valores son aleatorios</string>
<string name="hc05_not_found">HC-05 no encontrado, intente emparejarlo a su teléfono a través de bluetooth</string>
<string name="connection_failed">Error de conexión</string>
<string name="temp_tx">Temperatura (°C)</string>
<string name="hum_tx">Humedad (%)</string>
</resources>
+2
View File
@@ -7,4 +7,6 @@
<string name="is_testing_mode">L\'application est en mode de test les valeurs sont aléatoires</string>
<string name="hc05_not_found">HC-05 introuvable, essayez de l\'apparailler a votre téléphone en bluetooth</string>
<string name="connection_failed">Connexion impossible</string>
<string name="temp_tx">Température (°C)</string>
<string name="hum_tx">Humidité (%)</string>
</resources>
+2
View File
@@ -7,4 +7,6 @@
<string name="is_testing_mode">アプリはテストモードで動作しており、値はランダムです。</string>
<string name="hc05_not_found">HC-05が見つかりません。ブルートゥースで携帯電話とペアリングしてみてください。</string>
<string name="connection_failed">接続に失敗</string>
<string name="temp_tx">温度 (°C)</string>
<string name="hum_tx">湿度(%)</string>
</resources>
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary_light">#3D2F71</color>
<color name="colorPrimary_dark">#141118</color>
<color name="colorAccent">#343434</color>
<color name="colorBackground">#141118</color>
</resources>
+6 -3
View File
@@ -1,7 +1,10 @@
<resources>
<!-- Base application theme. -->
<style name="Base.Theme.I2D_Project_15_app" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your dark theme here. -->
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
<item name="colorPrimary">@color/colorPrimary_light</item>
<item name="colorPrimaryDark">@color/colorPrimary_dark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:background">@color/colorBackground</item>
</style>
<style name="Theme.I2D_Project_15_app" parent="Base.Theme.I2D_Project_15_app" />
</resources>
+2
View File
@@ -7,4 +7,6 @@
<string name="is_testing_mode">应用程序在测试模式下运行,数值是随机的</string>
<string name="hc05_not_found">HC-05 未找到,请尝试通过蓝牙将其与手机配对</string>
<string name="connection_failed">连接失败</string>
<string name="temp_tx">温度(°C</string>
<string name="hum_tx">湿度 (%)</string>
</resources>
+4 -4
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary_light">#3D2F71</color>
<color name="colorPrimary_dark">#141118</color>
<color name="colorAccent">#343434</color>
<color name="colorBackground">#141118</color>
<color name="colorPrimary_light">#7C6AE6</color>
<color name="colorPrimary_dark">#1A1147</color>
<color name="colorAccent">#676767</color>
<color name="colorBackground">#FFFFFF</color>
</resources>
+2
View File
@@ -8,6 +8,8 @@
<string name="is_testing_mode">The app is running in testing mode the values are random</string>
<string name="hc05_not_found">HC-05 not found, try pairing it to your phone via bluetooth</string>
<string name="connection_failed">Connection failed</string>
<string name="temp_tx">Temperature (°C)</string>
<string name="hum_tx">Humidity (%)</string>
<string name="temp_format" translatable="false">%.1f°C</string>
-1
View File
@@ -1,5 +1,4 @@
<resources>
<!-- Base application theme. -->
<style name="Base.Theme.I2D_Project_15_app" parent="Theme.Material3.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary_light</item>
<item name="colorPrimaryDark">@color/colorPrimary_dark</item>