# liquid compass **Repository Path**: han-xudsdsas/liquid-compass ## Basic Information - **Project Name**: liquid compass - **Description**: 液态指南针,显示方向,速度,经纬度 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-08-28 - **Last Updated**: 2026-08-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Liquid Compass 液态玻璃测速指南针 > A liquid-glass styled speedometer & compass app for Android, built with pure Kotlin + Jetpack Compose. > 一款液态玻璃风格的实时测速指南针安卓应用,原生 Kotlin + Jetpack Compose 打造。 --- ## Overview / 项目简介 **Liquid Compass** is a real-time speedometer and compass application with a unique "liquid glass" (Glassmorphism) design. It shows your live driving speed, heading direction, coordinates and altitude in a smooth, animated glass UI. The accent color smoothly transitions from tech-blue to warning-red based on your speed. **液态玻璃测速指南针** 是一款结合实时测速与电子指南针的应用,采用独特的"液态玻璃"(Glassmorphism)设计语言。界面实时显示车速、朝向、经纬度与海拔,主题色会随速度在科技蓝与警示红之间平滑过渡。 --- ## Features / 功能特性 | Feature | 功能 | Description 说明 | |---|---|---| | Real-time speed | 实时速度 | GPS-based speed in km/h with 1 decimal, refreshed every second | | | | 基于 GPS 的速度(km/h,1 位小数),每秒刷新 | | Compass | 电子指南针 | Accelerometer + magnetometer fusion, 8-direction text, smooth dial rotation | | | | 加速度计 + 磁力计融合方位角,8 方位文字,表盘平滑旋转 | | Coordinates | 坐标信息 | Latitude / longitude (6 decimals) + altitude + accuracy | | | | 经纬度(6 位小数)+ 海拔 + 定位精度 | | Speed color | 速度配色 | 0 km/h → `#165DFF` tech blue, 120 km/h → `#FF2D2D` warning red, RGB linear interpolation | | | | 0 km/h → `#165DFF` 科技蓝,120 km/h → `#FF2D2D` 警示红,RGB 线性插值 | | Liquid glass UI | 液态玻璃 UI | Semi-transparent glass cards, glow shadows, gradient highlights, animated blobs | | | | 半透明玻璃卡片、外发光阴影、高光渐变、流动光斑动画 | | Simulation mode | 模拟模式 | No GPS signal indoors? Inject a virtual 0~120 km/h track to preview effects | | | | 室内无 GPS 信号?注入 0~120 km/h 虚拟轨迹预览全部效果 | --- ## Tech Stack / 技术栈 - **Language**: Kotlin 2.0 - **UI**: Jetpack Compose (BOM 2024.06.00) + Material 3 - **Build**: Android Gradle Plugin 8.5.2, Gradle 8.9 - **Location**: Google FusedLocationProvider (with system `LocationManager` fallback for devices without GMS) - **Sensors**: `SensorManager` (accelerometer + magnetic field), low-pass filtered - **Min SDK**: 29 (Android 10) / **Target SDK**: 34 (Android 14) - **Testing**: Robolectric local JVM tests (no emulator needed) - **语言**: Kotlin 2.0 - **界面**: Jetpack Compose(BOM 2024.06.00)+ Material 3 - **构建**: Android Gradle Plugin 8.5.2、Gradle 8.9 - **定位**: Google FusedLocation(无 GMS 机型自动降级系统 `LocationManager`) - **传感器**: `SensorManager`(加速度计 + 磁力计),低通滤波去抖 - **最低系统**: Android 10(minSdk 29)/ **目标系统**: Android 14(targetSdk 34) - **测试**: Robolectric 本地 JVM 测试(无需模拟器) --- ## Build / 构建 Requirements / 环境要求: JDK 17, Android SDK (compileSdk 34) ```bash # 使用 Gradle 直接构建 debug APK gradle assembleDebug --no-daemon # 产物位于 app/build/outputs/apk/debug/app-debug.apk ``` If you have Android Studio, open the project root and run the app directly. 如有 Android Studio,可直接打开项目根目录运行。 --- ## How to Use / 使用说明 1. **Grant location permission** when the app asks — needed for speed & coordinates. **授予定位权限**——用于显示速度与坐标。 2. **Enable the system location switch** (Settings → Location). **开启系统定位开关**(设置 → 定位)。 3. Go outside with a clear sky view — GPS needs to "see" satellites. Indoors you will see "signal lost", which is normal physics. 到室外开阔处使用——GPS 需要"看见"卫星。室内显示"信号丢失"属正常物理现象。 4. **No GPS indoors?** Scroll to the bottom and tap the **Simulation Mode** button: a virtual track (0~120 km/h) is injected every second, letting you preview speed changes and the blue→red color transition anywhere. **室内没 GPS?** 滑到底部点击**模拟模式**按钮:每秒注入虚拟轨迹(0~120 km/h),随时随地预览速度跳动与蓝→红颜色渐变。 --- ## Project Structure / 项目结构 ``` app/src/main/java/com/example/glasscompass/ ├── MainActivity.kt # 入口 Activity / Entry activity ├── location/ │ └── LocationRepository.kt # 定位封装:Fused + 系统降级 + 看门狗 / Location wrapper ├── sensor/ │ └── CompassManager.kt # 指南针:传感器融合 / Compass sensor fusion ├── ui/ │ ├── GlassCompassScreen.kt # 主界面组合 / Main screen composition │ ├── components/ # 玻璃卡片、表盘、速度面板、坐标面板 / Glass UI components │ └── theme/ # 主题与配色 / Theme & colors └── util/ ├── SpeedColor.kt # 速度→颜色映射 / Speed-to-color mapping └── CrashGuard.kt # 全局崩溃捕获 + 日志 / Global crash catcher + log ``` --- ## License / 许可 This project is provided for learning and personal use. 本项目仅供学习与个人使用。