priya-zha / Software-Engineering-Project

0 stars 2 forks source link

Select voice button is not working and doesn't select the voiceselected #5

Open priya-zha opened 11 months ago

priya-zha commented 11 months ago

Steps to reproduce:

Click on any male/female radiobutton and then click on the Select voice button.

Actual Result:

When the 'Select Voice' button is clicked, it does not navigate to another screen as expected. The user-selected voice is not passed to the new activity.

Expected Result:

The 'Select Voice' button should function in the same way as when the user selects a voice using voice recognition. It should navigate to another screen, passing the selected voice to that new activity.

Before fixing:

https://github.com/priya-zha/Software-Engineering-Project/assets/34065075/667214cd-7eca-49ba-a5fd-97a9bb63f7f5

After fixing:

https://github.com/priya-zha/Software-Engineering-Project/assets/34065075/7dc72f11-2a82-4318-9196-ef1d8eaf4507

priya-zha commented 11 months ago

Solution: In the voiceselection page, we can create a new intent and transfer the selected voice to a new activity so that the same selected voice can be used there too.

https://github.com/priya-zha/Software-Engineering-Project/blob/2da8cc17807297e2b2a7ec59d183edb1f416f06c/app/src/main/java/com/example/se/VoiceSelection.java#L87C8-L97C6

    Button selectButton = findViewById(R.id.selectButton);
        selectButton.setOnClickListener(v -> {
            // Prompt the user for confirmation or selection
            Intent nextActivityIntent = new Intent(VoiceSelection.this, HelpScreen.class);
            nextActivityIntent.putExtra("selectedVoiceName", selectedVoice);
            // You can add more properties here if needed
            startActivity(nextActivityIntent);
            textToSpeech.speak("Voice has been selected", TextToSpeech.QUEUE_FLUSH, null);
        });
    }