- 将布局文件中的 Button 替换为 AppCompatButton 组件 - 更新环境切换对话框中的 URL 映射关系 - 添加 LOCAL_BASE_URL 和修改 TEST_BASE_URL 的常量定义 - 启用并实现环境切换功能的时间点击事件处理 - 在 API 接口定义中使用 @Url 注解实现动态 URL 设置 - 创建 DynamicBaseUrlInterceptor 拦截器实现实时域名替换 - 更新依赖注入模块以使用新的拦截器和全局基础 URL - 修改仓库层调用以使用具名参数传递
107 lines
3.4 KiB
XML
107 lines
3.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
android:layout_width="600dp"
|
|
android:layout_height="wrap_content"
|
|
android:background="@drawable/bg_white_radius12"
|
|
android:orientation="vertical"
|
|
android:paddingHorizontal="40dp"
|
|
android:paddingVertical="36dp">
|
|
|
|
<!-- 标题 -->
|
|
<TextView
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:gravity="center"
|
|
android:text="环境切换"
|
|
android:textColor="#ff141428"
|
|
android:textSize="36sp"
|
|
android:textStyle="bold" />
|
|
|
|
<!-- 分割线 -->
|
|
<View
|
|
android:layout_width="match_parent"
|
|
android:layout_height="2dp"
|
|
android:layout_marginTop="24dp"
|
|
android:background="#FFDCDCF0" />
|
|
|
|
<!-- 环境选项 -->
|
|
<RadioGroup
|
|
android:id="@+id/rgEnv"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginTop="32dp"
|
|
android:orientation="vertical">
|
|
|
|
<RadioButton
|
|
android:id="@+id/rbTest"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="72dp"
|
|
android:gravity="center_vertical"
|
|
android:paddingStart="16dp"
|
|
android:text="本地环境"
|
|
android:textColor="#ff141428"
|
|
android:textSize="28sp" />
|
|
|
|
<RadioButton
|
|
android:id="@+id/rbUat"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="72dp"
|
|
android:gravity="center_vertical"
|
|
android:paddingStart="16dp"
|
|
android:text="测试环境"
|
|
android:textColor="#ff141428"
|
|
android:textSize="28sp" />
|
|
|
|
<RadioButton
|
|
android:id="@+id/rbProd"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="72dp"
|
|
android:gravity="center_vertical"
|
|
android:paddingStart="16dp"
|
|
android:text="生产环境"
|
|
android:textColor="#ff141428"
|
|
android:textSize="28sp" />
|
|
|
|
</RadioGroup>
|
|
|
|
<!-- 分割线 -->
|
|
<View
|
|
android:layout_width="match_parent"
|
|
android:layout_height="2dp"
|
|
android:layout_marginTop="24dp"
|
|
android:background="#FFDCDCF0" />
|
|
|
|
<!-- 底部按钮 -->
|
|
<LinearLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="88dp"
|
|
android:layout_marginTop="24dp"
|
|
android:gravity="center"
|
|
android:orientation="horizontal">
|
|
|
|
<androidx.appcompat.widget.AppCompatButton
|
|
android:id="@+id/btnCancel"
|
|
android:layout_width="0dp"
|
|
android:layout_height="match_parent"
|
|
android:layout_marginEnd="20dp"
|
|
android:layout_weight="1"
|
|
android:background="@drawable/bg_white_radius10_stroke2"
|
|
android:text="取消"
|
|
android:textColor="#ff141428"
|
|
android:textSize="28sp" />
|
|
|
|
<androidx.appcompat.widget.AppCompatButton
|
|
android:id="@+id/btnConfirm"
|
|
android:layout_width="0dp"
|
|
android:layout_height="match_parent"
|
|
android:layout_marginStart="20dp"
|
|
android:layout_weight="1"
|
|
android:background="@drawable/bg_blue_radius10"
|
|
android:text="确认"
|
|
android:textColor="#ffffff"
|
|
android:textSize="28sp" />
|
|
|
|
</LinearLayout>
|
|
|
|
</LinearLayout>
|