Skip to content

Commit

Permalink
Improved JavaScript TTS initialization process
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mikunimaru committed Jul 7, 2021
1 parent bbc78fa commit a9a80af
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ public abstract class AbstractFlashcardViewer extends NavigationDrawerActivity i
private boolean mFocusTypeAnswer;

/** Text to speech */
private JavaScriptTTS mTalker = new JavaScriptTTS(AbstractFlashcardViewer.this);
private JavaScriptTTS mTalker = new JavaScriptTTS();

// ----------------------------------------------------------------------------
// LISTENERS
Expand Down
3 changes: 2 additions & 1 deletion AnkiDroid/src/main/java/com/ichi2/anki/JavaScriptTTS.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public class JavaScriptTTS implements TextToSpeech.OnInitListener {
private static boolean mTtsOk;
private static final Bundle mTtsParams = new Bundle();

JavaScriptTTS(Context context) {
JavaScriptTTS() {
Context mContext = AnkiDroidApp.getInstance().getApplicationContext();
mTts = new TextToSpeech(context, this);
}

Expand Down

0 comments on commit a9a80af

Please sign in to comment.