Skip to content

Commit a9a80af

Browse files
committed
Improved JavaScript TTS initialization process
Fixed a problem that null may be passed as an argument when initializing JavaScriptTTS. Changed to refer to context from within the class instead of the argument when initializing JavaScriptTTS.
1 parent bbc78fa commit a9a80af

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ public abstract class AbstractFlashcardViewer extends NavigationDrawerActivity i
393393
private boolean mFocusTypeAnswer;
394394

395395
/** Text to speech */
396-
private JavaScriptTTS mTalker = new JavaScriptTTS(AbstractFlashcardViewer.this);
396+
private JavaScriptTTS mTalker = new JavaScriptTTS();
397397

398398
// ----------------------------------------------------------------------------
399399
// LISTENERS

AnkiDroid/src/main/java/com/ichi2/anki/JavaScriptTTS.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public class JavaScriptTTS implements TextToSpeech.OnInitListener {
3838
private static boolean mTtsOk;
3939
private static final Bundle mTtsParams = new Bundle();
4040

41-
JavaScriptTTS(Context context) {
41+
JavaScriptTTS() {
42+
Context mContext = AnkiDroidApp.getInstance().getApplicationContext();
4243
mTts = new TextToSpeech(context, this);
4344
}
4445

0 commit comments

Comments
 (0)