Skip to content

Commit 694a941

Browse files
committed
release
1 parent e3da978 commit 694a941

File tree

6 files changed

+62
-23
lines changed

6 files changed

+62
-23
lines changed

CHANGELOG.md

+8-13
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
- 可设置备用配置,请求失败指定次数后使用备用配置。
2-
- 支持单独为某一配置设置内置播放器的语速和音高。
3-
- 长按配置可切换 旁白/对话。
4-
- 替换管理界面的搜索过滤支持选择 [名称/替换规则/替换为]
5-
- 本地TTS 可设置音频采样率。
6-
- 本地TTS 编辑附加参数界面优化。
7-
- 优化 微软TTS创建Websocket连接时的 取消和超时。
8-
- 优化 自定义TTS资源复用和懒加载。
9-
- 优化 分组展开流畅度。
10-
- 优化 无障碍。
11-
- 修复 导入配置界面URL编辑框过高时无法点击导入按钮。
12-
13-
PS:经酷安老哥提醒以及我的测试,音频格式 webm-24khz-16bit-24kbps-mono-opus 的实际所耗流量是其音频大小的3倍由于,请谨慎使用。
1+
- 修复内置播放器的参数无法保存以及播放异常。
2+
- 设置中可切换语言并增加繁体中文。
3+
- 替换规则管理界面可分组。
4+
- 替换规则编辑 插入拼音声调优化。
5+
- 替换规则保存后自动更新到TTS。
6+
- 将Server重命名为 微软TTS转发器
7+
- 新增 系统TTS转发器:
8+
启动服务后即可通过网页url形式获取到安卓系统TTS合成的音频,支持一键导入阅读,因阅读网络TTS可预先缓存,所以通过此方式调用能一定程度上解决网络延迟导致的段落间隔过长问题。

app/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ android {
1313
applicationId 'com.github.jing332.tts_server_android'
1414
minSdk 21
1515
targetSdk 33
16-
versionCode 5
17-
versionName "0.4"
16+
versionCode 6
17+
versionName "0.5"
1818

1919
javaCompileOptions {
2020
annotationProcessorOptions {
@@ -131,7 +131,7 @@ dependencies {
131131
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
132132

133133
//RecyclerView
134-
implementation 'com.github.liangjingkanji:BRV:1.3.85'
134+
implementation 'com.github.liangjingkanji:BRV:1.3.90'
135135

136136
//Room
137137
implementation("androidx.room:room-runtime:$room_version")

app/src/main/java/com/github/jing332/tts_server_android/ui/MainActivity.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
112112
val handled = NavigationUI.onNavDestinationSelected(menuItem, navController)
113113
if (handled) {
114114
AppConfig.fragmentIndex = when (menuItem.itemId) {
115-
R.id.nav_systts -> 0
116-
R.id.nav_server -> 1
117-
R.id.nav_systts_forwarder -> 2
115+
R.id.nav_systts -> INDEX_SYS_TTS
116+
R.id.nav_systts_forwarder -> INDEX_FORWARDER_SYS
117+
R.id.nav_server -> INDEX_FORWARDER_MS
118118
else -> 0
119119
}
120120
} else {

app/src/main/java/com/github/jing332/tts_server_android/ui/systts/replace/ReplaceManagerActivity.kt

+45-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.os.Bundle
66
import android.view.Menu
77
import android.view.MenuItem
88
import android.view.View
9+
import android.view.accessibility.AccessibilityNodeInfo
910
import androidx.activity.result.contract.ActivityResultContracts.*
1011
import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult.*
1112
import androidx.activity.viewModels
@@ -73,7 +74,31 @@ class ReplaceManagerActivity : AppCompatActivity() {
7374
getBindingOrNull<SysttsListCustomGroupItemBinding>()?.apply {
7475
itemView.clickWithThrottle {
7576
val data = getModel<ReplaceRuleGroupModel>().data
76-
appDb.replaceRuleDao.insertGroup(data.copy(isExpanded = !data.isExpanded))
77+
val isExpanded = !data.isExpanded
78+
appDb.replaceRuleDao.insertGroup(data.copy(isExpanded = isExpanded))
79+
getModel<ReplaceRuleGroupModel>().let { model ->
80+
val enabledCount =
81+
model.itemSublist?.filter { (it as ReplaceRuleModel).data.isEnabled }?.size
82+
val speakText =
83+
if (isExpanded) R.string.group_expanded else R.string.group_collapsed
84+
itemView.announceForAccessibility(
85+
getString(speakText) + ", ${
86+
getString(
87+
R.string.systts_desc_list_count_info,
88+
model.itemSublist?.size,
89+
enabledCount
90+
)
91+
}"
92+
)
93+
94+
if (model.itemExpand && model.itemSublist.isNullOrEmpty()) {
95+
collapse(modelPosition)
96+
MaterialAlertDialogBuilder(this@ReplaceManagerActivity)
97+
.setTitle(R.string.msg_group_is_empty)
98+
.setMessage(getString(R.string.systts_group_empty_msg))
99+
.show()
100+
}
101+
}
77102
}
78103
btnMore.clickWithThrottle {
79104
displayGroupMenu(
@@ -88,6 +113,22 @@ class ReplaceManagerActivity : AppCompatActivity() {
88113
}
89114
}
90115
}
116+
117+
checkBox.accessibilityDelegate = object : View.AccessibilityDelegate() {
118+
override fun onInitializeAccessibilityNodeInfo(
119+
host: View,
120+
info: AccessibilityNodeInfo
121+
) {
122+
super.onInitializeAccessibilityNodeInfo(host, info)
123+
val str = when (checkBox.checkedState) {
124+
MaterialCheckBox.STATE_CHECKED -> getString(R.string.md_checkbox_checked)
125+
MaterialCheckBox.STATE_UNCHECKED -> getString(R.string.md_checkbox_unchecked)
126+
MaterialCheckBox.STATE_INDETERMINATE -> getString(R.string.md_checkbox_indeterminate)
127+
else -> ""
128+
}
129+
info.text = ", $str, "
130+
}
131+
}
91132
}
92133

93134
getBindingOrNull<SysttsReplaceRuleItemBinding>()?.apply {
@@ -345,7 +386,9 @@ class ReplaceManagerActivity : AppCompatActivity() {
345386
getString(R.string.edit_group_name),
346387
getString(R.string.name)
347388
) { text ->
348-
appDb.replaceRuleDao.insertGroup(ReplaceRuleGroup(name = text))
389+
appDb.replaceRuleDao.insertGroup(ReplaceRuleGroup(name = text.ifEmpty {
390+
getString(R.string.unnamed)
391+
}))
349392
}
350393
}
351394

app/src/main/res/layout/systts_replace_activity.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@
2626
<ImageButton
2727
android:id="@+id/btn_target"
2828
android:layout_width="wrap_content"
29-
android:layout_height="wrap_content"
29+
android:layout_height="match_parent"
3030
android:layout_gravity="center_vertical"
3131
android:layout_marginStart="4dp"
3232
android:background="?attr/selectableItemBackgroundBorderless"
3333
android:contentDescription="@string/search_filter"
34+
android:scaleType="centerInside"
3435
app:srcCompat="@drawable/ic_filter" />
3536

3637
<EditText

app/src/main/res/navigation/mobile_navigation.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<fragment
1515
android:id="@+id/nav_server"
1616
android:name="com.github.jing332.tts_server_android.ui.forwarder.ms.MsTtsForwarderFragment"
17-
android:label="Server"
17+
android:label="@string/forwarder_ms"
1818
tools:layout="@layout/ms_tts_forwarder_fragment" />
1919

2020
<fragment

0 commit comments

Comments
 (0)