From ac2fa45381a8d7d410eb85e62c6dd1ba59161461 Mon Sep 17 00:00:00 2001 From: Claudomator Agent Date: Fri, 13 Mar 2026 19:58:00 +0000 Subject: Implement basic instrument display --- .../kotlin/com/example/androidapp/MainActivity.kt | 77 +++++++ .../app/src/main/res/layout/activity_main.xml | 226 +++++++++++++++++++++ android-app/app/src/main/res/values/colors.xml | 8 + android-app/app/src/main/res/values/dimens.xml | 9 + android-app/app/src/main/res/values/strings.xml | 25 +++ android-app/app/src/main/res/values/themes.xml | 29 +++ 6 files changed, 374 insertions(+) create mode 100644 android-app/app/src/main/res/values/dimens.xml (limited to 'android-app') diff --git a/android-app/app/src/main/kotlin/com/example/androidapp/MainActivity.kt b/android-app/app/src/main/kotlin/com/example/androidapp/MainActivity.kt index 3128ee3..d4c6998 100644 --- a/android-app/app/src/main/kotlin/com/example/androidapp/MainActivity.kt +++ b/android-app/app/src/main/kotlin/com/example/androidapp/MainActivity.kt @@ -1,7 +1,11 @@ package com.example.androidapp import android.os.Bundle +import android.view.View +import android.widget.TextView import androidx.appcompat.app.AppCompatActivity +import androidx.constraintlayout.widget.ConstraintLayout +import com.google.android.material.floatingactionbutton.FloatingActionButton import org.maplibre.android.MapLibre import org.maplibre.android.maps.MapView import org.maplibre.android.maps.Style @@ -9,6 +13,20 @@ import org.maplibre.android.maps.Style class MainActivity : AppCompatActivity() { private var mapView: MapView? = null + private lateinit var instrumentDisplayContainer: ConstraintLayout + private lateinit var fabToggleInstruments: FloatingActionButton + + // Instrument TextViews + private lateinit var valueAws: TextView + private lateinit var valueTws: TextView + private lateinit var valueHdg: TextView + private lateinit var valueCog: TextView + private lateinit var valueBsp: TextView + private lateinit var valueSog: TextView + private lateinit var valueVmg: TextView + private lateinit var valueDepth: TextView + private lateinit var valuePolarPct: TextView + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -21,6 +39,65 @@ class MainActivity : AppCompatActivity() { mapView?.getMapAsync { maplibreMap -> maplibreMap.setStyle(Style.Builder().fromUri("https://tiles.openseamap.org/seamark/osm-bright/style.json")) } + + instrumentDisplayContainer = findViewById(R.id.instrument_display_container) + fabToggleInstruments = findViewById(R.id.fab_toggle_instruments) + + // Initialize instrument TextViews + valueAws = findViewById(R.id.value_aws) + valueTws = findViewById(R.id.value_tws) + valueHdg = findViewById(R.id.value_hdg) + valueCog = findViewById(R.id.value_cog) + valueBsp = findViewById(R.id.value_bsp) + valueSog = findViewById(R.id.value_sog) + valueVmg = findViewById(R.id.value_vmg) + valueDepth = findViewById(R.id.value_depth) + valuePolarPct = findViewById(R.id.value_polar_pct) + + // Set initial placeholder values + updateInstrumentDisplay( + aws = getString(R.string.placeholder_aws_value), + tws = getString(R.string.placeholder_tws_value), + hdg = getString(R.string.placeholder_hdg_value), + cog = getString(R.string.placeholder_cog_value), + bsp = getString(R.string.placeholder_bsp_value), + sog = getString(R.string.placeholder_sog_value), + vmg = getString(R.string.placeholder_vmg_value), + depth = getString(R.string.placeholder_depth_value), + polarPct = getString(R.string.placeholder_polar_value) + ) + + fabToggleInstruments.setOnClickListener { + if (instrumentDisplayContainer.visibility == View.VISIBLE) { + instrumentDisplayContainer.visibility = View.GONE + mapView?.visibility = View.VISIBLE + } else { + instrumentDisplayContainer.visibility = View.VISIBLE + mapView?.visibility = View.GONE + } + } + } + + private fun updateInstrumentDisplay( + aws: String, + tws: String, + hdg: String, + cog: String, + bsp: String, + sog: String, + vmg: String, + depth: String, + polarPct: String + ) { + valueAws.text = aws + valueTws.text = tws + valueHdg.text = hdg + valueCog.text = cog + valueBsp.text = bsp + valueSog.text = sog + valueVmg.text = vmg + valueDepth.text = depth + valuePolarPct.text = polarPct } override fun onStart() { diff --git a/android-app/app/src/main/res/layout/activity_main.xml b/android-app/app/src/main/res/layout/activity_main.xml index a618e78..2801f23 100644 --- a/android-app/app/src/main/res/layout/activity_main.xml +++ b/android-app/app/src/main/res/layout/activity_main.xml @@ -15,4 +15,230 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android-app/app/src/main/res/values/colors.xml b/android-app/app/src/main/res/values/colors.xml index aa37791..a66628b 100644 --- a/android-app/app/src/main/res/values/colors.xml +++ b/android-app/app/src/main/res/values/colors.xml @@ -1,7 +1,15 @@ #FFBB86FC + #FF6200EE #FF3700B3 #FF03DAC5 + #FF018786 #FF000000 #FFFFFFFF + + + #FFFFFFFF + #FFFF0000 + #FFFFFF00 + #E61E1E1E \ No newline at end of file diff --git a/android-app/app/src/main/res/values/dimens.xml b/android-app/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..1b65ea9 --- /dev/null +++ b/android-app/app/src/main/res/values/dimens.xml @@ -0,0 +1,9 @@ + + + + 24sp + 18sp + 14sp + 8dp + 4dp + diff --git a/android-app/app/src/main/res/values/strings.xml b/android-app/app/src/main/res/values/strings.xml index a22fe8c..d7793de 100644 --- a/android-app/app/src/main/res/values/strings.xml +++ b/android-app/app/src/main/res/values/strings.xml @@ -1,3 +1,28 @@ AndroidApp + + + WIND + AWS + TWS + COMPASS + HDG + COG + BOAT SPEED + BSP + SOG + VMG + DEPTH + POLAR % + + + --.- + --.- + --- + --- + --.- + --.- + --.- + --.- + --- \ No newline at end of file diff --git a/android-app/app/src/main/res/values/themes.xml b/android-app/app/src/main/res/values/themes.xml index 50ce36e..c23c0ab 100644 --- a/android-app/app/src/main/res/values/themes.xml +++ b/android-app/app/src/main/res/values/themes.xml @@ -13,4 +13,33 @@ ?attr/colorPrimaryVariant + + + + + + + \ No newline at end of file -- cgit v1.2.3