添加实时距离计算功能

This commit is contained in:
ZhanGSKen
2025-09-30 02:39:01 +08:00
parent dee9586748
commit 94054c39e8
6 changed files with 506 additions and 257 deletions

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 编辑视图:按钮顺序改为【删除(左)→取消→确定(右)】,新增取消按钮 -->
<!-- 编辑视图:新增实时距离开关(单选框组),位于备注输入框与按钮区之间 -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -32,7 +32,7 @@
</LinearLayout>
<!-- 2. 备注输入框(不变) -->
<!-- 2. 备注输入框(不变调整下方间距为8dp与新增单选框区过渡更自然 -->
<EditText
android:id="@+id/et_edit_memo"
android:layout_width="match_parent"
@@ -44,9 +44,56 @@
android:maxLines="4"
android:padding="10dp"
android:background="@drawable/edittext_bg"
android:layout_marginBottom="12dp"/>
android:layout_marginBottom="8dp"/> <!-- 原12dp→8dp优化与单选框的间距 -->
<!-- 3. 按钮区(核心修改:顺序→删除(左)→取消→确定(右),新增取消按钮) -->
<!-- 新增3实时距离开关单选框组- 控制isEnableRealPositionDistance属性 -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginBottom="12dp"> <!-- 与下方按钮区保持12dp间距符合原有布局规范 -->
<!-- 单选框标题(说明用途,文字颜色与经纬度一致,保持风格统一) -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="实时距离计算:"
android:textSize="14sp"
android:textColor="#666666"
android:layout_marginRight="12dp"/> <!-- 与单选框保持12dp间距避免拥挤 -->
<!-- 单选框组RadioGroup确保“启用/禁用”二选一 -->
<RadioGroup
android:id="@+id/rg_real_distance_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:checkedButton="@+id/rb_disable"> <!-- 默认选中“禁用”匹配isEnable默认值false -->
<!-- 单选框1禁用实时距离对应isEnableRealPositionDistance=false -->
<RadioButton
android:id="@+id/rb_disable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="禁用"
android:textSize="13sp"
android:textColor="#333333"
android:layout_marginRight="16dp"/> <!-- 与“启用”单选框保持16dp间距 -->
<!-- 单选框2启用实时距离对应isEnableRealPositionDistance=true -->
<RadioButton
android:id="@+id/rb_enable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="启用"
android:textSize="13sp"
android:textColor="#333333"/>
</RadioGroup>
</LinearLayout>
<!-- 4. 按钮区(不变:顺序→删除(左)→取消→确定(右)) -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -70,7 +117,7 @@
android:layout_width="10dp"
android:layout_height="match_parent"/>
<!--新增:取消按钮(中间,灰色,不保存返回简单视图) -->
<!-- ② 取消按钮(中间,灰色,不保存返回简单视图) -->
<Button
android:id="@+id/btn_edit_cancel"
android:layout_width="wrap_content"

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 简单视图:仅显示经纬度+备注,无任何按钮 -->
<!-- 简单视图:新增实时距离显示控件(备注下方) -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -35,5 +35,15 @@
android:textStyle="bold"
android:layout_marginTop="8dp"/>
<!-- 新增:实时距离显示(距离计算结果/未启用提示) -->
<TextView
android:id="@+id/tv_simple_real_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="#2196F3"
android:layout_marginTop="6dp"
android:text="实时距离未启用"/> <!-- 默认提示isEnable=false时显示 -->
</LinearLayout>