Skip to content

Commit

Permalink
tts: do not re-initialize TTS on DCMD_TTS_PLAY if its already active
Browse files Browse the repository at this point in the history
  • Loading branch information
teleshoes committed Apr 8, 2022
1 parent c108b68 commit 5ebc197
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions android/src/org/coolreader/crengine/ReaderView.java
Original file line number Diff line number Diff line change
Expand Up @@ -2384,13 +2384,15 @@ public void onCommand(final ReaderCommand cmd, final int param, final Runnable o
showManual();
break;
case DCMD_TTS_PLAY: {
log.i("DCMD_TTS_PLAY: initializing TTS");
mActivity.initTTS(ttsacc -> BackgroundThread.instance().executeGUI(() -> {
log.i("TTS created: opening TTS toolbar");
ttsToolbar = TTSToolbarDlg.showDialog(mActivity, ReaderView.this, ttsacc);
ttsToolbar.setOnCloseListener(() -> ttsToolbar = null);
ttsToolbar.setAppSettings(mSettings, null);
}));
if(!isTTSActive()){
log.i("DCMD_TTS_PLAY: initializing TTS");
mActivity.initTTS(ttsacc -> BackgroundThread.instance().executeGUI(() -> {
log.i("TTS created: opening TTS toolbar");
ttsToolbar = TTSToolbarDlg.showDialog(mActivity, ReaderView.this, ttsacc);
ttsToolbar.setOnCloseListener(() -> ttsToolbar = null);
ttsToolbar.setAppSettings(mSettings, null);
}));
}
}
break;
case DCMD_TOGGLE_DOCUMENT_STYLES:
Expand Down

0 comments on commit 5ebc197

Please sign in to comment.