diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-06-30 18:45:07 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-06-30 18:45:07 +0000 |
| commit | 32c98f8ae06f2ceb8fc020d5a63662a07c2d63fb (patch) | |
| tree | 806d827f52e538ab0ef67d4aa7ede062554cdaff /android-app/app/src/main/kotlin/org | |
| parent | 23163f67deb71f4cc4e53d670254a45b59fd4f6b (diff) | |
feat(fishing): FishingModeManager with target zone computation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'android-app/app/src/main/kotlin/org')
| -rw-r--r-- | android-app/app/src/main/kotlin/org/terst/nav/ui/fishing/FishingModeManager.kt | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/android-app/app/src/main/kotlin/org/terst/nav/ui/fishing/FishingModeManager.kt b/android-app/app/src/main/kotlin/org/terst/nav/ui/fishing/FishingModeManager.kt new file mode 100644 index 0000000..7ab1089 --- /dev/null +++ b/android-app/app/src/main/kotlin/org/terst/nav/ui/fishing/FishingModeManager.kt @@ -0,0 +1,32 @@ +package org.terst.nav.ui.fishing + +import android.content.Context + +class FishingModeManager(private val context: Context? = null) { + + private val prefs get() = context?.getSharedPreferences("fishing_mode", Context.MODE_PRIVATE) + + var isActive: Boolean + get() = prefs?.getBoolean("active", false) ?: false + set(v) { prefs?.edit()?.putBoolean("active", v)?.apply() } + + fun computeTarget( + boatLat: Double, boatLon: Double, boatCogDeg: Double, + tempC: Double, currentKt: Double, currentDirDeg: Double + ): FishingTarget? { + if (currentKt < 0.1) return null + + val crossCurrentBearing = (currentDirDeg + 90.0) % 360.0 + val estimatedDistNm = (3.0 + currentKt * 2.5).coerceIn(3.0, 8.0) + val rig = RigAdvisor.recommend(tempC, currentKt, windKt = 0.0) + val tempF = tempC * 9.0 / 5.0 + 32.0 + val zoneDesc = "%.0f°F water, %.1f kt current — steer to color edge".format(tempF, currentKt) + + return FishingTarget( + bearingDeg = crossCurrentBearing, + distanceNm = estimatedDistNm, + zoneDescription = zoneDesc, + rig = rig + ) + } +} |
