Skip to content

Commit ddf12a5

Browse files
committed
add
1 parent 87fcfaa commit ddf12a5

File tree

6 files changed

+21
-17
lines changed

6 files changed

+21
-17
lines changed

CHANGELOG.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2022/05/20
1+
2022/05/26
22

3-
1. 重新使用DNS over Https,解决一些地区DNS污染。
4-
2. 优化重连逻辑,出错时尽快恢复连接。
5-
3. 其它优化
3+
添加预览版语音,需要打开预览语音开关,当选择预览版语音时,如果卡住了,杀掉应用重进!!!

app/src/main/java/me/ag2s/tts/MainActivity.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package me.ag2s.tts;
22

33
import static me.ag2s.tts.services.Constants.CUSTOM_VOICE;
4+
import static me.ag2s.tts.services.Constants.USE_PREVIEW;
45

56
import android.annotation.SuppressLint;
67
import android.app.Activity;
@@ -109,8 +110,8 @@ protected void onCreate(Bundle savedInstanceState) {
109110
binding.switchUseDict.setChecked(APP.getBoolean(Constants.USE_DICT, false));
110111
binding.switchUseDict.setOnCheckedChangeListener((buttonView, isChecked) -> APP.putBoolean(Constants.USE_DICT, isChecked));
111112

112-
// binding.switchUsePreview.setChecked(APP.getBoolean(Constants.USE_PREVIEW,false));
113-
// binding.switchUsePreview.setOnCheckedChangeListener(((buttonView, isChecked) -> APP.putBoolean(CUSTOM_VOICE,isChecked)));
113+
binding.switchUsePreview.setChecked(APP.getBoolean(Constants.USE_PREVIEW, false));
114+
binding.switchUsePreview.setOnCheckedChangeListener(((buttonView, isChecked) -> APP.putBoolean(USE_PREVIEW, isChecked)));
114115

115116

116117
TtsActorAdapter actorAdapter = new TtsActorAdapter(TtsActorManger.getInstance().getActors());
@@ -151,6 +152,8 @@ protected void onCreate(Bundle savedInstanceState) {
151152

152153
});
153154

155+
Toast.makeText(this, "选择预览版语音时,如果卡住了,杀掉应用重进!!!", Toast.LENGTH_LONG).show();
156+
154157

155158
if (APP.getBoolean(Constants.USE_AUTO_UPDATE, true)) {
156159
checkUpdate();

app/src/main/java/me/ag2s/tts/services/TTSService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ public WebSocket getOrCreateWs() {
566566

567567
String url;
568568
String origin = Constants.EDGE_ORIGIN;
569-
if (TokenHolder.token != null) {
569+
if (TokenHolder.token != null && APP.getBoolean(Constants.USE_PREVIEW, false)) {
570570
url = "wss://eastus.tts.speech.microsoft.com/cognitiveservices/websocket/v1?Authorization=bearer " + TokenHolder.token + "&X-ConnectionId=" + CommonTool.getMD5String(new Date().toString());
571571
origin = "https://azure.microsoft.com";
572572
} else {

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

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,26 @@
3939

4040
<Switch
4141
style="?android:attr/buttonBarButtonStyle"
42-
android:id="@+id/switch_use_split_sentence"
42+
android:id="@+id/switch_use_dict"
4343
android:layout_width="wrap_content"
4444
android:layout_height="wrap_content"
45-
android:text="@string/split_sentence" />
45+
android:text="@string/use_dict" />
4646

4747
<Switch
48+
android:id="@+id/switch_use_preview"
4849
style="?android:attr/buttonBarButtonStyle"
49-
android:id="@+id/switch_use_dict"
5050
android:layout_width="wrap_content"
5151
android:layout_height="wrap_content"
52-
android:text="@string/use_dict" />
53-
<!-- <Switch-->
54-
<!-- style="?android:attr/buttonBarButtonStyle"-->
55-
<!-- android:id="@+id/switch_use_preview"-->
56-
<!-- android:layout_width="wrap_content"-->
57-
<!-- android:layout_height="wrap_content"-->
58-
<!-- android:text="@string/use_preview" />-->
52+
android:text="@string/use_preview" />
53+
54+
<Switch
55+
style="?android:attr/buttonBarButtonStyle"
56+
android:id="@+id/switch_use_split_sentence"
57+
android:layout_width="wrap_content"
58+
android:layout_height="wrap_content"
59+
android:text="@string/split_sentence" />
60+
61+
5962
</LinearLayout>
6063
</HorizontalScrollView>
6164

430 KB
Binary file not shown.
5.49 KB
Binary file not shown.

0 commit comments

Comments
 (0)