From 58313edae6181a3c60c36fdf14310fe7e961e00c Mon Sep 17 00:00:00 2001 From: nour-soufani Date: Thu, 21 Mar 2024 12:34:36 -0400 Subject: [PATCH 1/8] Comments about the implemented code : Attempt to understanding --- .../services/announcement/TTSManager.java | 50 ++++++++++++------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java b/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java index 2b3dc406d..7f22106ef 100644 --- a/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java +++ b/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java @@ -16,43 +16,59 @@ package de.dennisguse.opentracks.services.announcement; -import android.content.Context; -import android.media.AudioAttributes; -import android.media.AudioManager; -import android.media.MediaPlayer; -import android.speech.tts.TextToSpeech; -import android.speech.tts.UtteranceProgressListener; -import android.text.Spannable; -import android.util.Log; +import android.content.Context; // Base class for interacting with the Android system +import android.media.AudioAttributes; // Encapsulates the audio attributes of an audio stream +import android.media.AudioManager; // Provides access to the system volume controls +import android.media.MediaPlayer; // Provides a way to control playback of audio files/streams +import android.speech.tts.TextToSpeech; // Convert text to speech +import android.speech.tts.UtteranceProgressListener; // Used to receive callbacks when the synthesis of an utterance starts/end or at an error +import android.text.Spannable; //Mark up text with style information +import android.util.Log; // Provides methods to log messages (debugging purposes) -import androidx.annotation.NonNull; +import androidx.annotation.NonNull; // Provides helper classes -import java.util.List; -import java.util.Locale; +import java.util.List; //Ordered collection of elements +import java.util.Locale; // Represents a locale, which is a specific geographic, political, or cultural region -import de.dennisguse.opentracks.R; -import de.dennisguse.opentracks.settings.PreferencesUtils; +import de.dennisguse.opentracks.R; // Generated by the Android build system. It contains references to all the resources in the application +import de.dennisguse.opentracks.settings.PreferencesUtils; // A custom class that provides helper methods for working with user preferences public class TTSManager { public final static int AUDIO_STREAM = TextToSpeech.Engine.DEFAULT_STREAM; + // TextToSpeech: class part of the Android SDK used to convert tts + // Engine is an inner class of TextToSpeech + // DEFAULT_STREAM : static field of the 'Engine' class => specifies default stream of audio + // Adding log messages related to the TTSManager class private static final String TAG = TTSManager.class.getSimpleName(); private final Context context; - + //AudioManager Class : Manage audio focus on the device (audio playback & recording) private final AudioManager audioManager; + //AudioManager.OnAudioFocusChangeListener : Interface in Android SDK + // Monitors audio focus change and returns a LOG of the change private final AudioManager.OnAudioFocusChangeListener audioFocusChangeListener = new AudioManager.OnAudioFocusChangeListener() { + @Override - public void onAudioFocusChange(int focusChange) { - Log.d(TAG, "Audio focus changed to " + focusChange); + public void onAudioFocusChange(int focusChange) { // Method implementation of interface AudioManager.OnAudioFocusChangeListener + + Log.d(TAG, "Audio focus changed to " + focusChange); // Logging a message to the class + + //Constants that can be returned by the AudioManager Class + //AUDIOFOCUS_LOSS : system lost audio focus and can no longer be used + //AUDIOFOCUS_LOSS_TRANSIENT : Temporary loss of audio focus + // ''_CAN_DUCK : Lowers the volume of the media player (if another app is playing for example) boolean stop = List.of(AudioManager.AUDIOFOCUS_LOSS, AudioManager.AUDIOFOCUS_LOSS_TRANSIENT, AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK) - .contains(focusChange); + .contains(focusChange); // checking the state of 'focusChange' parameter if (stop && tts != null && tts.isSpeaking()) { + + // Interrupts the current utterance (whether played or rendered to file) and discards other utterances in the queue. + // Returns ERROR or SUCCESS. tts.stop(); Log.i(TAG, "Aborting current tts due to focus change " + focusChange); } From cd697f2f8fd7075b24ba1edbe9ea64a5e6d8aec9 Mon Sep 17 00:00:00 2001 From: nour-soufani Date: Thu, 21 Mar 2024 13:53:06 -0400 Subject: [PATCH 2/8] More Comments --- .../services/announcement/TTSManager.java | 36 +++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java b/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java index 7f22106ef..86acbf1cd 100644 --- a/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java +++ b/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java @@ -44,7 +44,9 @@ public class TTSManager { // Adding log messages related to the TTSManager class private static final String TAG = TTSManager.class.getSimpleName(); + //Super important : Context class provides access to system services & application resources private final Context context; + //AudioManager Class : Manage audio focus on the device (audio playback & recording) private final AudioManager audioManager; @@ -58,8 +60,8 @@ public void onAudioFocusChange(int focusChange) { // Method implementation of in Log.d(TAG, "Audio focus changed to " + focusChange); // Logging a message to the class //Constants that can be returned by the AudioManager Class - //AUDIOFOCUS_LOSS : system lost audio focus and can no longer be used - //AUDIOFOCUS_LOSS_TRANSIENT : Temporary loss of audio focus + // _LOSS : system lost audio focus and can no longer be used + // _LOSS_TRANSIENT : Temporary loss of audio focus // ''_CAN_DUCK : Lowers the volume of the media player (if another app is playing for example) boolean stop = List.of(AudioManager.AUDIOFOCUS_LOSS, AudioManager.AUDIOFOCUS_LOSS_TRANSIENT, AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK) @@ -74,10 +76,11 @@ public void onAudioFocusChange(int focusChange) { // Method implementation of in } } }; - + // 'UtteranceProgressListener' : interface & defines methods that can be called to monitor the progress of TTS utterance private final UtteranceProgressListener utteranceListener = new UtteranceProgressListener() { + // These methods can be really good for BackEnd to UI implementation @Override - public void onStart(String utteranceId) { + public void onStart(String utteranceId) { //when utterance begins int result = audioManager.requestAudioFocus(audioFocusChangeListener, AUDIO_STREAM, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK); if (result == AudioManager.AUDIOFOCUS_REQUEST_FAILED) { Log.w(TAG, "Failed to request audio focus."); @@ -85,7 +88,7 @@ public void onStart(String utteranceId) { } @Override - public void onDone(String utteranceId) { + public void onDone(String utteranceId) { // when utterance has been successfully spoken int result = audioManager.abandonAudioFocus(audioFocusChangeListener); if (result == AudioManager.AUDIOFOCUS_REQUEST_FAILED) { Log.w(TAG, "Failed to relinquish audio focus."); @@ -93,25 +96,33 @@ public void onDone(String utteranceId) { } @Override - public void onError(String utteranceId) { + public void onError(String utteranceId) { // Called if an error occurs during the utterance Log.e(TAG, "An error occurred for utteranceId " + utteranceId); } }; - private TextToSpeech tts; + private TextToSpeech tts; //Conversion // Response from TTS after its initialization - private int ttsInitStatus = TextToSpeech.ERROR; + private int ttsInitStatus = TextToSpeech.ERROR; //Stores initialization status => + // Can/will change to .SUCCESS or .FAILED_SYNTHESIS +// A boolean field that indicates whether the text-to-speech engine has been properly initialized +// and is ready to perform text-to-speech conversion. private boolean ttsReady = false; private MediaPlayer ttsFallback; +// MediaPlayer class: used to play a pre-recorded audio file as a fallback mechanism when +// the TTS engine is unable to perform the TTS conversion. - TTSManager(Context context) { + TTSManager(Context context) { // Constructor of the TTSManager class this.context = context; audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); +// TTSManager constructor initializes audioManager by calling +// getSystemService(Context.AUDIO_SERVICE) on the Context object, which returns an +// AudioManager object. } - public void start() { + public void start() { // Called in the VoiceAnnouncementManager Class Log.d(TAG, "Start"); if (tts == null) { @@ -121,7 +132,12 @@ public void start() { }); } if (ttsFallback == null) { + + ttsFallback = MediaPlayer.create(context, R.raw.tts_fallback); + // initialize a new instance of MediaPlayer & associates it with a sound file resource in the app's raw directory + //R.raw.tts_fallback : contains reference to the sound file + if (ttsFallback == null) { Log.w(TAG, "MediaPlayer for ttsFallback could not be created."); } else { From 334d5cde4df280f51f0b9841e8b6c65b3c065379 Mon Sep 17 00:00:00 2001 From: nour-soufani Date: Thu, 21 Mar 2024 14:24:17 -0400 Subject: [PATCH 3/8] More Comments - Complete for this file --- .../services/announcement/TTSManager.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java b/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java index 86acbf1cd..d56919d88 100644 --- a/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java +++ b/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java @@ -151,8 +151,8 @@ public void start() { // Called in the VoiceAnnouncementManager Class } public void announce(@NonNull Spannable announcement) { - synchronized (this) { - if (!ttsReady) { + synchronized (this) { // One announcement at a time + if (!ttsReady) { // checking if ready to make an announcement ttsReady = ttsInitStatus == TextToSpeech.SUCCESS; if (ttsReady) { onTtsReady(); @@ -196,8 +196,9 @@ public void stop() { } private void onTtsReady() { - Locale locale = Locale.getDefault(); - int languageAvailability = tts.isLanguageAvailable(locale); + Locale locale = Locale.getDefault(); // Get default geolocation / region etc + int languageAvailability = tts.isLanguageAvailable(locale); //Method in the TTS class : + // checks is the engine can speak specified language if (languageAvailability == TextToSpeech.LANG_MISSING_DATA || languageAvailability == TextToSpeech.LANG_NOT_SUPPORTED) { Log.w(TAG, "Default locale not available, use English."); locale = Locale.ENGLISH; @@ -207,7 +208,9 @@ private void onTtsReady() { */ } tts.setLanguage(locale); - tts.setSpeechRate(PreferencesUtils.getVoiceSpeedRate()); + tts.setSpeechRate(PreferencesUtils.getVoiceSpeedRate()); // Set speech rate output based on app preferences (set by user) + // track the progress of the TTS utterance,and to perform certain actions + // when specific events in the lifecycle of an utterance occur. tts.setOnUtteranceProgressListener(utteranceListener); } } From fb1bd600425a30376c07b20952060cc6dcbe179e Mon Sep 17 00:00:00 2001 From: nour-soufani Date: Fri, 22 Mar 2024 22:58:41 -0400 Subject: [PATCH 4/8] More Comments --- .../opentracks/services/announcement/TTSManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java b/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java index d56919d88..d9bb046fd 100644 --- a/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java +++ b/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java @@ -135,6 +135,7 @@ public void start() { // Called in the VoiceAnnouncementManager Class ttsFallback = MediaPlayer.create(context, R.raw.tts_fallback); + // initialize a new instance of MediaPlayer & associates it with a sound file resource in the app's raw directory //R.raw.tts_fallback : contains reference to the sound file @@ -206,8 +207,10 @@ private void onTtsReady() { * TODO: instead of using english, load the language if missing and show a toast if not supported. * Not able to change the resource strings to English. */ + + //Potentially set status to 0 } - tts.setLanguage(locale); + tts.setLanguage(locale); //set method in android sdk tts.setSpeechRate(PreferencesUtils.getVoiceSpeedRate()); // Set speech rate output based on app preferences (set by user) // track the progress of the TTS utterance,and to perform certain actions // when specific events in the lifecycle of an utterance occur. From 79ca6070d3deb4cc70c33c99652cde91e29aa676 Mon Sep 17 00:00:00 2001 From: nour-soufani Date: Fri, 22 Mar 2024 23:08:22 -0400 Subject: [PATCH 5/8] More Comments --- .../dennisguse/opentracks/services/announcement/TTSManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java b/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java index d9bb046fd..be042330a 100644 --- a/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java +++ b/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java @@ -151,7 +151,7 @@ public void start() { // Called in the VoiceAnnouncementManager Class } } - public void announce(@NonNull Spannable announcement) { + public void announce(@NonNull Spannable announcement) { // parameter cannot be null synchronized (this) { // One announcement at a time if (!ttsReady) { // checking if ready to make an announcement ttsReady = ttsInitStatus == TextToSpeech.SUCCESS; From 66072b0e9e788cb3b60c36495e1e65ecab807c31 Mon Sep 17 00:00:00 2001 From: nour-soufani Date: Fri, 22 Mar 2024 23:48:39 -0400 Subject: [PATCH 6/8] More Comments --- .../opentracks/services/announcement/TTSManager.java | 7 ++++--- .../de/dennisguse/opentracks/stats/TrackStatistics.java | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java b/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java index be042330a..10e573647 100644 --- a/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java +++ b/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java @@ -132,8 +132,6 @@ public void start() { // Called in the VoiceAnnouncementManager Class }); } if (ttsFallback == null) { - - ttsFallback = MediaPlayer.create(context, R.raw.tts_fallback); // initialize a new instance of MediaPlayer & associates it with a sound file resource in the app's raw directory @@ -178,7 +176,7 @@ public void announce(@NonNull Spannable announcement) { // parameter cannot be n return; } - if (announcement.length() > 0) { + if (announcement.length() > 0) { //Where it is gonna speak and start announcement / IMPORTANT // We don't care about the utterance id. It is supplied here to force onUtteranceCompleted to be called. tts.speak(announcement, TextToSpeech.QUEUE_FLUSH, null, "not used"); } @@ -217,3 +215,6 @@ private void onTtsReady() { tts.setOnUtteranceProgressListener(utteranceListener); } } + +//Write a method that converts text to speech +// diff --git a/src/main/java/de/dennisguse/opentracks/stats/TrackStatistics.java b/src/main/java/de/dennisguse/opentracks/stats/TrackStatistics.java index 41fa6d8e7..d1fa17894 100644 --- a/src/main/java/de/dennisguse/opentracks/stats/TrackStatistics.java +++ b/src/main/java/de/dennisguse/opentracks/stats/TrackStatistics.java @@ -72,7 +72,8 @@ public TrackStatistics() { * * @param other another statistics data object to copy from */ - public TrackStatistics(TrackStatistics other) { + public TrackStatistics(TrackStatistics other) { // Need to create objects of this in order to activate + //VoiceAnnouncementsManager startTime = other.startTime; stopTime = other.stopTime; totalDistance = other.totalDistance; From 2a141637065f2f3e6c84db0e9f71c4e0ab07704d Mon Sep 17 00:00:00 2001 From: nour-soufani Date: Sun, 24 Mar 2024 22:40:04 -0400 Subject: [PATCH 7/8] Rewriting the onTtsReady() method to trigger activities at button press: more specifically when the "track_recording_fab_button" is pressed after a run, it should trigger a voice announcement for that run. In comment above, there is also content view for when the recording is finished via "finish_button" TODO: implement for the finish button an if statement for respective setContentView since you cannot have 2 in the same brackets. --- .../services/announcement/TTSManager.java | 127 +++++++++++++++--- 1 file changed, 106 insertions(+), 21 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java b/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java index 10e573647..392dd94d7 100644 --- a/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java +++ b/src/main/java/de/dennisguse/opentracks/services/announcement/TTSManager.java @@ -20,12 +20,23 @@ import android.media.AudioAttributes; // Encapsulates the audio attributes of an audio stream import android.media.AudioManager; // Provides access to the system volume controls import android.media.MediaPlayer; // Provides a way to control playback of audio files/streams +import android.os.Bundle; + +import androidx.appcompat.app.AppCompatActivity; + import android.speech.tts.TextToSpeech; // Convert text to speech import android.speech.tts.UtteranceProgressListener; // Used to receive callbacks when the synthesis of an utterance starts/end or at an error import android.text.Spannable; //Mark up text with style information +import android.text.SpannableStringBuilder; import android.util.Log; // Provides methods to log messages (debugging purposes) +import android.view.View; +import android.widget.ImageView; +import android.widget.Toast; import androidx.annotation.NonNull; // Provides helper classes +import androidx.appcompat.app.AppCompatActivity; + +import com.google.android.material.floatingactionbutton.FloatingActionButton; import java.util.List; //Ordered collection of elements import java.util.Locale; // Represents a locale, which is a specific geographic, political, or cultural region @@ -34,7 +45,7 @@ import de.dennisguse.opentracks.settings.PreferencesUtils; // A custom class that provides helper methods for working with user preferences -public class TTSManager { +public class TTSManager extends AppCompatActivity { public final static int AUDIO_STREAM = TextToSpeech.Engine.DEFAULT_STREAM; // TextToSpeech: class part of the Android SDK used to convert tts @@ -52,6 +63,7 @@ public class TTSManager { //AudioManager.OnAudioFocusChangeListener : Interface in Android SDK // Monitors audio focus change and returns a LOG of the change + private final AudioManager.OnAudioFocusChangeListener audioFocusChangeListener = new AudioManager.OnAudioFocusChangeListener() { @Override @@ -101,13 +113,14 @@ public void onError(String utteranceId) { // Called if an error occurs during th } }; - private TextToSpeech tts; //Conversion + private TextToSpeech tts; //Conversion MY TTS OBJECT // Response from TTS after its initialization private int ttsInitStatus = TextToSpeech.ERROR; //Stores initialization status => // Can/will change to .SUCCESS or .FAILED_SYNTHESIS -// A boolean field that indicates whether the text-to-speech engine has been properly initialized + // A boolean field that indicates whether the text-to-speech engine has been properly initialized // and is ready to perform text-to-speech conversion. +// private boolean ttsReady = false; private boolean ttsReady = false; private MediaPlayer ttsFallback; @@ -123,11 +136,15 @@ public void onError(String utteranceId) { // Called if an error occurs during th } public void start() { // Called in the VoiceAnnouncementManager Class + + Log.d(TAG, "Start"); if (tts == null) { + tts = new TextToSpeech(context, status -> { Log.i(TAG, "TextToSpeech initialized with status " + status); + ttsInitStatus = status; }); } @@ -151,8 +168,12 @@ public void start() { // Called in the VoiceAnnouncementManager Class public void announce(@NonNull Spannable announcement) { // parameter cannot be null synchronized (this) { // One announcement at a time + if (!ttsReady) { // checking if ready to make an announcement ttsReady = ttsInitStatus == TextToSpeech.SUCCESS; + ; + Log.d(TAG, "TTS initialized successfully."); + // Update the UI to indicate that TTS is ready. if (ttsReady) { onTtsReady(); } @@ -194,27 +215,91 @@ public void stop() { } } - private void onTtsReady() { - Locale locale = Locale.getDefault(); // Get default geolocation / region etc - int languageAvailability = tts.isLanguageAvailable(locale); //Method in the TTS class : - // checks is the engine can speak specified language - if (languageAvailability == TextToSpeech.LANG_MISSING_DATA || languageAvailability == TextToSpeech.LANG_NOT_SUPPORTED) { - Log.w(TAG, "Default locale not available, use English."); - locale = Locale.ENGLISH; - /* - * TODO: instead of using english, load the language if missing and show a toast if not supported. - * Not able to change the resource strings to English. - */ - - //Potentially set status to 0 +// void onTtsReady() { +// Locale locale = Locale.getDefault(); // Get default geolocation / region etc +// int languageAvailability = tts.isLanguageAvailable(locale); //Method in the TTS class : +// // checks is the engine can speak specified language +// if (languageAvailability == TextToSpeech.LANG_MISSING_DATA || languageAvailability == TextToSpeech.LANG_NOT_SUPPORTED) { +// Log.w(TAG, "Default locale not available, use English."); +// locale = Locale.ENGLISH; +// +// +// } +// tts.setLanguage(locale); //set method in android sdk +// tts.setSpeechRate(PreferencesUtils.getVoiceSpeedRate()); // Set speech rate output based on app preferences (set by user) +// // track the progress of the TTS utterance,and to perform certain actions +// // when specific events in the lifecycle of an utterance occur. +// tts.setOnUtteranceProgressListener(utteranceListener); +// +// +// } + + //method is where you initialize your activity, set up the user interface, + // and perform any other necessary setup tasks. + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + // Call onTtsReady for initialization + onTtsReady(); + } + + void onTtsReady() { + // setContentView(R.layout.track_stopped); + // ImageView finish = findViewById(R.id.finish_button); + + +// Set the content view of the activity to the layout defined in 'track_recording.xml' + setContentView(R.layout.track_recording); + // Find the FloatingActionButton with the id 'track_recording_fab_action' in the layout + FloatingActionButton run = findViewById(R.id.track_recording_fab_action); + + if (run != null) { + // Initialize TextToSpeech instance with the application context + tts = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() { + @Override + public void onInit(int ttsInitStatus) { + // Get the default locale of the device + Locale locale = Locale.getDefault(); + int languageAvailability = tts.isLanguageAvailable(locale); + if (languageAvailability == TextToSpeech.LANG_MISSING_DATA || languageAvailability == TextToSpeech.LANG_NOT_SUPPORTED) { + Log.w(TAG, "Default locale not available, use English."); + // Set TextToSpeech language to English + locale = Locale.ENGLISH; + tts.setLanguage(locale); + // Set speech rate according to user preferences + tts.setSpeechRate(PreferencesUtils.getVoiceSpeedRate()); + tts.setOnUtteranceProgressListener(utteranceListener); + + // Set OnClickListener for FloatingActionButton 'run' + run.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + //Triggers the speaking FloatingActionButton is clicked + String speech = "Hello User!"; + tts.speak(speech, TextToSpeech.QUEUE_FLUSH, null, null); + } + }); + }else { + // If language other than English is selected, show a toast notification + Toast.makeText(getApplicationContext(), "Please note: Selected language may not be fully supported.", Toast.LENGTH_SHORT).show(); + } + } + }); + } else { + //Log error if not found + Log.e(TAG, "FloatingActionButton not found"); } - tts.setLanguage(locale); //set method in android sdk - tts.setSpeechRate(PreferencesUtils.getVoiceSpeedRate()); // Set speech rate output based on app preferences (set by user) - // track the progress of the TTS utterance,and to perform certain actions - // when specific events in the lifecycle of an utterance occur. - tts.setOnUtteranceProgressListener(utteranceListener); + + + + + } + } + + //Write a method that converts text to speech // From 9a93f38b298fe1f5d4532e5b08b9e7b5c9276bd2 Mon Sep 17 00:00:00 2001 From: nour-soufani Date: Sun, 24 Mar 2024 22:46:58 -0400 Subject: [PATCH 8/8] no comment, all works (ish rn, code crashing but because of implementation not bug) --- .idea/migrations.xml | 10 ++++++++++ build.gradle | 2 +- src/main/AndroidManifest.xml | 3 +++ .../announcement/VoiceAnnouncementManager.java | 10 +++++++++- .../services/announcement/VoiceAnnouncementUtils.java | 3 +++ src/main/res/layout/track_stopped.xml | 2 +- 6 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 .idea/migrations.xml diff --git a/.idea/migrations.xml b/.idea/migrations.xml new file mode 100644 index 000000000..f8051a6f9 --- /dev/null +++ b/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 1761f192b..ad98f2481 100644 --- a/build.gradle +++ b/build.gradle @@ -145,4 +145,4 @@ dependencies { androidTestImplementation 'org.mockito:mockito-android:5.8.0' androidTestUtil 'androidx.test:orchestrator:1.4.2' -} +} \ No newline at end of file diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index c0b67324d..80ab72a04 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -64,6 +64,8 @@ limitations under the License. + + + - +