From 87c6fb2812caca3bb1fe54e2e35ee8434aadf23c Mon Sep 17 00:00:00 2001 From: "Mr. 17" Date: Tue, 14 Nov 2023 22:43:45 +0530 Subject: [PATCH] Fix #3596: Adds Audio Loading UI (#5179) ## Explanation Fixes #3596 This PR adds an indeterminate progress bar when the audio is loading, before it starts playing. ## Essential Checklist - [x] The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".) - [x] Any changes to [scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets) files have their rationale included in the PR explanation. - [x] The PR follows the [style guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide). - [x] The PR does not contain any unnecessary code changes from Android Studio ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)). - [x] The PR is made from a branch that's **not** called "develop" and is up-to-date with "develop". - [x] The PR is **assigned** to the appropriate reviewers ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)). ## For UI-specific PRs only If your PR includes UI-related changes, then: - Add screenshots for portrait/landscape for both a tablet & phone of the before & after UI changes - For the screenshots above, include both English and pseudo-localized (RTL) screenshots (see [RTL guide](https://github.com/oppia/oppia-android/wiki/RTL-Guidelines)) - Add a video showing the full UX flow with a screen reader enabled (see [accessibility guide](https://github.com/oppia/oppia-android/wiki/Accessibility-A11y-Guide)) - Add a screenshot demonstrating that you ran affected Espresso tests locally & that they're passing https://github.com/oppia/oppia-android/assets/84731134/5c6fe393-5d89-4bda-a144-57bdc42a9c57 --------- Co-authored-by: Adhiambo Peres <59600948+adhiamboperes@users.noreply.github.com> --- app/src/main/res/layout/audio_fragment.xml | 15 +++++++ app/src/main/res/values/component_colors.xml | 1 + app/src/main/res/values/dimens.xml | 8 +++- .../exploration/ExplorationActivityTest.kt | 39 ++++++++++++++++++- 4 files changed, 60 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/layout/audio_fragment.xml b/app/src/main/res/layout/audio_fragment.xml index d849e51c03c..20ca0081c0e 100755 --- a/app/src/main/res/layout/audio_fragment.xml +++ b/app/src/main/res/layout/audio_fragment.xml @@ -36,6 +36,20 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> + + @color/color_palette_concept_card_toolbar_color @color/color_palette_audio_fragment_background_color + @color/color_palette_icon_background_secondary_color @color/color_palette_icon_background_secondary_color @color/color_palette_seekbar_progress_background_color @color/color_palette_seekbar_thumb_shadow_color diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 4361dce5674..65e5ca43e22 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -8,8 +8,6 @@ 12dp 1000 1000 - 8dp - 28dp 24dp 4dp 18dp @@ -769,4 +767,10 @@ 28dp 32dp 8dp + + + 8dp + 28dp + 20dp + 3dp diff --git a/app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt index 27c75850e7d..165f250bde4 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt @@ -1071,7 +1071,7 @@ class ExplorationActivityTest { onView(withId(R.id.action_audio_player)).perform(click()) testCoroutineDispatchers.runCurrent() - onView(withId(R.id.play_pause_audio_icon)).check(matches(isDisplayed())) + onView(withId(R.id.audio_bar_container)).check(matches(isDisplayed())) onView(withText(context.getString(R.string.cellular_data_alert_dialog_title))) .check(doesNotExist()) } @@ -1295,6 +1295,43 @@ class ExplorationActivityTest { explorationDataController.stopPlayingExploration(isCompletion = false) } + @Test + fun testExplorationActivity_loadingAudio_progressbarIsDisplayed() { + markAllSpotlightsSeen() + setUpAudio() + launch( + createExplorationActivityIntent( + internalProfileId, + RATIOS_TOPIC_ID, + RATIOS_STORY_ID_0, + RATIOS_EXPLORATION_ID_0, + shouldSavePartialProgress = false + ) + ).use { + explorationDataController.startPlayingNewExploration( + internalProfileId, + RATIOS_TOPIC_ID, + RATIOS_STORY_ID_0, + RATIOS_EXPLORATION_ID_0 + ) + networkConnectionUtil.setCurrentConnectionStatus(ProdConnectionStatus.LOCAL) + testCoroutineDispatchers.runCurrent() + onView(withId(R.id.action_audio_player)).perform(click()) + + testCoroutineDispatchers.runCurrent() + onView(withId(R.id.audio_bar_container)).check(matches(isDisplayed())) + onView(withId(R.id.audio_fragment_voiceover_progressbar)).check(matches(isDisplayed())) + + waitForTheView(withDrawable(R.drawable.ic_pause_circle_filled_white_24dp)) + onView(withId(R.id.play_pause_audio_icon)).check( + matches( + withDrawable(R.drawable.ic_pause_circle_filled_white_24dp) + ) + ) + } + explorationDataController.stopPlayingExploration(isCompletion = false) + } + // TODO(#89): Check this test case too. It works in pair with below test cases. @Test fun testExpActivity_showUnsavedExpDialog_cancel_dismissesDialog() {