Commit 7da9acc9 by pye52

Merge branch 'develop'

parents 93204fde 9e49e89c
...@@ -101,7 +101,6 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe ...@@ -101,7 +101,6 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
super.attachBaseContext(newBase); super.attachBaseContext(newBase);
deviceSN = SmartCanteenUtils.getDeviceSN(newBase.getApplicationContext()); deviceSN = SmartCanteenUtils.getDeviceSN(newBase.getApplicationContext());
audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
TTSHelper.initialize(newBase.getApplicationContext());
if (deviceSN.isEmpty()) { if (deviceSN.isEmpty()) {
LogUtils.file(TAG, "设备SN号为空"); LogUtils.file(TAG, "设备SN号为空");
...@@ -125,6 +124,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe ...@@ -125,6 +124,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
TTSHelper.initialize(this);
workManager = WorkManager.getInstance(this); workManager = WorkManager.getInstance(this);
ViewModelFactory factory = Injection.injectFactory(deviceSN); ViewModelFactory factory = Injection.injectFactory(deviceSN);
ViewModelProvider provider = new ViewModelProvider(this, factory); ViewModelProvider provider = new ViewModelProvider(this, factory);
......
...@@ -60,13 +60,16 @@ public class TTSHelper { ...@@ -60,13 +60,16 @@ public class TTSHelper {
} }
public static void release() { public static void release() {
mSoundIdMap.clear();
if (mTTS != null) { if (mTTS != null) {
mTTS.stop(); mTTS.stop();
} }
if (mSoundPool != null) { if (mSoundPool != null) {
for (int soundId : mSoundIdMap.values()) {
mSoundPool.unload(soundId);
}
mSoundPool.release(); mSoundPool.release();
} }
mSoundIdMap.clear();
} }
private static void playSound(String msg) { private static void playSound(String msg) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment