Add Dropdown (Select) Support for HTTP TTS Configuration / 为 HTTP TTS 配置添加下拉框(select)支持#5782
Open
dallion wants to merge 1 commit into
Open
Add Dropdown (Select) Support for HTTP TTS Configuration / 为 HTTP TTS 配置添加下拉框(select)支持#5782dallion wants to merge 1 commit into
dallion wants to merge 1 commit into
Conversation
- 扩展 RowUi 数据类: 添加 options 字段和 select 类型常量
- 创建 item_source_spinner.xml 布局文件: 使用 Android Spinner 控件实现下拉框UI
- 修改 SourceLoginDialog.kt:
* 添加 ItemSourceSpinnerBinding 导入
* 实现 select 类型的渲染逻辑,支持 ArrayAdapter 和默认值设置
* 添加 select 类型的数据获取逻辑,从 Spinner 读取选中值
- 优化 httpTTS.json 配置:
* 清理 18 个重复的 Qwen3-TTS 独立配置(id: -30 至 -47)
* 新增通用配置(id: -48),通过下拉框选择音色(18种选项)
* 简化 loginUrl 为纯参数验证,不进行 HTTP 请求
* 修复 loginCheckJs 避免消费响应流导致 closed 错误
技术要点:
- loginCheckJs 直接返回 result,不调用 response.body().string() 消费流
- Spinner 使用 index + 1000 作为 view ID,便于数据获取时查找
- 动态音色通过 {{source.getLoginInfoMap().get('Voice')}} 引用
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary / 概述
This PR adds dropdown (select) UI component support to the HTTP TTS login configuration system in Legado application, allowing users to select parameters through dropdown selectors in TTS service configuration, improving configuration convenience and user experience.
本 PR 为 Legado 应用的 HTTP TTS 登录配置系统新增了下拉框(select)UI 组件支持,允许用户在 TTS 服务配置中使用下拉选择器进行参数选择,提升了配置的便捷性和用户体验。
Features / 功能变更
Extended RowUi data model with options field and select type constant
Created dedicated dropdown layout file item_source_spinner.xml
Implemented dynamic rendering, option binding, and data collection logic for dropdowns in SourceLoginDialog
Supports reading option lists from JSON configuration, automatic default value matching, and persisting user selections
Fully backward compatible, does not affect existing text, password, and button types
扩展 RowUi 数据模型,新增 options 字段和 select 类型常量
创建专用下拉框布局文件 item_source_spinner.xml
在 SourceLoginDialog 中实现下拉框的动态渲染、选项绑定和数据收集逻辑
支持从 JSON 配置读取选项列表、自动匹配默认值、持久化用户选择
完全向后兼容,不影响现有的 text、password、button 类型
Main files / 主要涉及文件
app/src/main/java/io/legado/app/data/entities/rule/RowUi.kt- Data model extension / 数据模型扩展app/src/main/java/io/legado/app/ui/login/SourceLoginDialog.kt- Dialog logic enhancement / 对话框逻辑增强app/src/main/res/layout/item_source_spinner.xml- New layout file / 新增布局文件app/src/main/assets/defaultData/httpTTS.json- Configuration example / 配置示例Testing / 测试