diff --git a/app/src/main/java/com/ooolab/whatiswhat/MainActivity.java b/app/src/main/java/com/ooolab/whatiswhat/MainActivity.java index c01f5ab..aa2a0cc 100644 --- a/app/src/main/java/com/ooolab/whatiswhat/MainActivity.java +++ b/app/src/main/java/com/ooolab/whatiswhat/MainActivity.java @@ -92,6 +92,8 @@ public void afterTextChanged(Editable s) { } }); + // 默认启动识别 + findViewById(R.id.input_btn).callOnClick(); } @Override @@ -144,7 +146,7 @@ public void onInputBtnClick(View v) { mWebView.onPause(); // 隐藏报错信息 hideInfo(); - // 如果 + // 直接使用成员变量,避免初始化开销,待优化s if (mSpeechSynthesizer != null) { mSpeechSynthesizer.stop(); } @@ -319,6 +321,7 @@ public void onSpeechFinish(String arg0) { @Override public void run() { hideInfo(); + mWebView.onResume(); } }); } @@ -332,6 +335,12 @@ public void onSpeechProgressChanged(String arg0, int arg1) { public void onSpeechStart(String arg0) { // 监听到合成并播放开始,在此添加相关操作 Log.d(TAG, "onSpeechStart: "); + runOnUiThread(new Runnable() { + @Override + public void run() { + mWebView.onPause(); + } + }); } @Override diff --git a/app/src/main/res/layout/fragment_main.xml b/app/src/main/res/layout/fragment_main.xml index 8dda400..4573291 100644 --- a/app/src/main/res/layout/fragment_main.xml +++ b/app/src/main/res/layout/fragment_main.xml @@ -23,7 +23,6 @@ android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_toLeftOf="@+id/input_btn" - android:layout_toStartOf="@+id/input_btn" android:gravity="center_vertical" android:text="@string/app_name" android:textColor="@color/textColorPrimary" diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png index cde69bc..8d1be6a 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png index c133a0c..25e4c0a 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png index bfa42f0..55e153d 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index 324e72c..2e410e6 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index aee44e1..95da0fa 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ