priya-zha / Software-Engineering-Project

0 stars 2 forks source link

UI element doesn't update in getstarted and help page unlike voiceselection page #3

Open priya-zha opened 1 year ago

priya-zha commented 1 year ago

Steps to reproduce: Say start on the getstarted page and notice that the background color of the start button doesn't change its color unlike the voice selection screen

Actual Result: The background color of the button doesn't update when user says 'start' or 'next' in getstarted page and in the help page, to show that the user voice was successfully taken by the application in a similar way how it is shown on the voice selection page where UI button element gets to red when user chooses a male/female voice

Expected Result: The UI background of the 'start' and 'next' button in getstarted and help page should change its color to red like that of the voiceselection page

Before fixing:

https://github.com/priya-zha/Software-Engineering-Project/assets/34065075/ca6c411d-7c2d-4880-b6df-c0f6045a4bf8

After fixing:

https://github.com/priya-zha/Software-Engineering-Project/assets/34065075/99b050c7-d3a6-49d0-87f1-4afc0f8912ca

priya-zha commented 1 year ago

Fixed solution: (getstarted page)

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

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

 @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode == SPEECH_REQUEST_CODE && resultCode == Activity.RESULT_OK && data != null) {
            ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
            if (matches != null && !matches.isEmpty()) {
                String recognizedText = matches.get(0).toLowerCase();
                if (recognizedText.equals("start")) {
                    // User said "start"
                    start.setBackgroundColor(Color.parseColor("#FF0000"));
                    navigateToSecondPage();

                }
        }
   }