Skip to content

Commit

Permalink
Merge branch 'develop' into hintstimer
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishwajith-Shettigar authored Nov 23, 2023
2 parents 29030a0 + 54e0ba5 commit 38f64ed
Show file tree
Hide file tree
Showing 18 changed files with 142 additions and 107 deletions.
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ git_repository(
# to correctly size in-line SVGs (such as those needed for LaTeX-based math expressions).
git_repository(
name = "androidsvg",
commit = "1265eb1087056cf3fc2e10442e5545bc65c109ce",
commit = "5bc9c7553e94c3476e8ea32baea3c77567228fcd",
remote = "https://github.com/oppia/androidsvg",
shallow_since = "1686302944 -0700",
shallow_since = "1686304726 -0700",
)

git_repository(
Expand Down
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ android {
includeCompileClasspath true
}
}
vectorDrawables { useSupportLibrary true }
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import org.oppia.android.app.utility.lifecycle.LifecycleSafeTimerFactory
import org.oppia.android.app.view.ViewComponentFactory
import org.oppia.android.app.view.ViewComponentImpl
import org.oppia.android.domain.oppialogger.OppiaLogger
import org.oppia.android.util.platformparameter.EnableContinueButtonAnimation
import org.oppia.android.util.platformparameter.PlatformParameterValue
import org.oppia.android.util.system.OppiaClock
import javax.inject.Inject

Expand All @@ -25,12 +23,14 @@ class ContinueButtonView @JvmOverloads constructor(
defStyleAttr: Int = R.style.StateButtonActive
) : androidx.appcompat.widget.AppCompatButton(context, attrs, defStyleAttr) {

@field:[Inject EnableContinueButtonAnimation]
lateinit var enableContinueButtonAnimation: PlatformParameterValue<Boolean>
@Inject lateinit var fragment: Fragment
@Inject lateinit var oppiaClock: OppiaClock
@Inject lateinit var lifecycleSafeTimerFactory: LifecycleSafeTimerFactory
@Inject lateinit var oppiaLogger: OppiaLogger
@Inject
lateinit var fragment: Fragment
@Inject
lateinit var oppiaClock: OppiaClock
@Inject
lateinit var lifecycleSafeTimerFactory: LifecycleSafeTimerFactory
@Inject
lateinit var oppiaLogger: OppiaLogger

private var shouldAnimateContinueButtonLateinit: Boolean? = null
private val shouldAnimateContinueButton: Boolean
Expand Down Expand Up @@ -119,13 +119,11 @@ class ContinueButtonView @JvmOverloads constructor(

private fun startAnimating() {
val animation = AnimationUtils.loadAnimation(context, R.anim.wobble_button_animation)
if (enableContinueButtonAnimation.value) {
startAnimation(animation)
// Repeat the animation after a fixed interval.
lifecycleSafeTimerFactory.createTimer(INTERVAL_BETWEEN_CONTINUE_BUTTON_ANIM_MS)
.observe(fragment) {
startAnimating()
}
}
startAnimation(animation)
// Repeat the animation after a fixed interval.
lifecycleSafeTimerFactory.createTimer(INTERVAL_BETWEEN_CONTINUE_BUTTON_ANIM_MS)
.observe(fragment) {
startAnimating()
}
}
}
15 changes: 15 additions & 0 deletions app/src/main/res/layout/audio_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/audio_fragment_voiceover_progressbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true"
android:visibility="@{viewModel.playStatusLiveData == UiAudioPlayStatus.LOADING ? View.VISIBLE : View.GONE}"
app:indicatorColor="@color/component_color_audio_fragment_voiceover_progressbar_color"
app:indicatorSize="@dimen/audio_fragment_progress_indicator_size"
app:trackThickness="@dimen/audio_fragment_progress_indicator_track_thickness"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/play_pause_audio_icon"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/play_pause_audio_icon"
android:layout_width="52dp"
Expand All @@ -44,6 +58,7 @@
android:clickable="@{viewModel.playStatusLiveData != UiAudioPlayStatus.LOADING}"
android:contentDescription="@{viewModel.playStatusLiveData == UiAudioPlayStatus.PLAYING ? @string/audio_pause_description : @string/audio_play_description}"
android:onClick="@{(v) -> viewModel.togglePlayPause(viewModel.playStatusLiveData)}"
android:visibility="@{viewModel.playStatusLiveData != UiAudioPlayStatus.LOADING ? View.VISIBLE : View.INVISIBLE}"
android:padding="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/component_colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@
<color name="component_color_concept_card_fragment_toolbar_color">@color/color_palette_concept_card_toolbar_color</color>
<!-- Audio Fragment -->
<color name="component_color_audio_fragment_background_color">@color/color_palette_audio_fragment_background_color</color>
<color name="component_color_audio_fragment_voiceover_progressbar_color">@color/color_palette_icon_background_secondary_color</color>
<color name="component_color_audio_fragment_seekbar_progress_color">@color/color_palette_icon_background_secondary_color</color>
<color name="component_color_audio_fragment_seekbar_color">@color/color_palette_seekbar_progress_background_color</color>
<color name="component_color_audio_fragment_seekbar_thumb_shadow_color">@color/color_palette_seekbar_thumb_shadow_color</color>
Expand Down
8 changes: 6 additions & 2 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
<dimen name="answer_tick_margin">12dp</dimen>
<integer name="fade_in_duration_ms">1000</integer>
<integer name="fade_out_duration_ms">1000</integer>
<dimen name="audio_fragment_corner_radius">8dp</dimen>
<dimen name="audio_fragment_margin">28dp</dimen>
<dimen name="cellular_data_dialog_padding">24dp</dimen>
<dimen name="state_previous_next_button_radius">4dp</dimen>
<dimen name="train_checkbox_padding">18dp</dimen>
Expand Down Expand Up @@ -769,4 +767,10 @@
<dimen name="resume_lesson_chapter_flexbox_margin_end">28dp</dimen>
<dimen name="resume_lesson_chapter_flexbox_margin_top">32dp</dimen>
<dimen name="resume_lesson_start_over_button_margin">8dp</dimen>

<!-- AudioFragment-->
<dimen name="audio_fragment_corner_radius">8dp</dimen>
<dimen name="audio_fragment_margin">28dp</dimen>
<dimen name="audio_fragment_progress_indicator_size">20dp</dimen>
<dimen name="audio_fragment_progress_indicator_track_thickness">3dp</dimen>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ class ExplorationActivityTest {
@Before
fun setUp() {
Intents.init()
TestPlatformParameterModule.forceEnableContinueButtonAnimation(false)
setUpTestApplicationComponent()
testCoroutineDispatchers.registerIdlingResource()
profileTestHelper.initializeProfiles()
Expand Down Expand Up @@ -1071,7 +1070,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())
}
Expand Down Expand Up @@ -1295,6 +1294,43 @@ class ExplorationActivityTest {
explorationDataController.stopPlayingExploration(isCompletion = false)
}

@Test
fun testExplorationActivity_loadingAudio_progressbarIsDisplayed() {
markAllSpotlightsSeen()
setUpAudio()
launch<ExplorationActivity>(
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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4749,7 +4749,6 @@ class StateFragmentTest {
}

private fun setUpTest() {
TestPlatformParameterModule.forceEnableContinueButtonAnimation(false)
Intents.init()
setUpTestApplicationComponent()
testCoroutineDispatchers.registerIdlingResource()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ class StateFragmentLocalTest {

@Test
fun testContinueInteractionAnim_openPrototypeExp_checkContinueButtonAnimatesAfter45Seconds() {
TestPlatformParameterModule.forceEnableContinueButtonAnimation(true)
launchForExploration(TEST_EXPLORATION_ID_2).use {
startPlayingExploration()
testCoroutineDispatchers.runCurrent()
Expand Down Expand Up @@ -339,7 +338,6 @@ class StateFragmentLocalTest {

@Test
fun testConIntAnim_openProtExp_orientLandscapeAfter30Sec_checkAnimHasNotStarted() {
TestPlatformParameterModule.forceEnableContinueButtonAnimation(true)
launchForExploration(TEST_EXPLORATION_ID_2).use {
startPlayingExploration()

Expand All @@ -353,7 +351,6 @@ class StateFragmentLocalTest {

@Test
fun testConIntAnim_openProtExp_orientLandAfter30Sec_checkAnimStartsIn15SecAfterOrientChange() {
TestPlatformParameterModule.forceEnableContinueButtonAnimation(true)
launchForExploration(TEST_EXPLORATION_ID_2).use {
startPlayingExploration()

Expand All @@ -368,7 +365,6 @@ class StateFragmentLocalTest {

@Test
fun testContNavBtnAnim_openMathExp_checkContNavBtnAnimatesAfter45Seconds() {
TestPlatformParameterModule.forceEnableContinueButtonAnimation(true)
launchForExploration(TEST_EXPLORATION_ID_5).use {
startPlayingExploration()
onView(withId(R.id.state_recycler_view)).perform(
Expand All @@ -391,7 +387,6 @@ class StateFragmentLocalTest {
@Ignore("Continue navigation animation behavior fails during testing")
@Test
fun testContNavBtnAnim_openMathExp_playThroughSecondState_checkContBtnDoesNotAnimateAfter45Sec() {
TestPlatformParameterModule.forceEnableContinueButtonAnimation(true)
launchForExploration(TEST_EXPLORATION_ID_5).use {
startPlayingExploration()
onView(withId(R.id.state_recycler_view)).perform(
Expand Down Expand Up @@ -424,7 +419,6 @@ class StateFragmentLocalTest {
@Ignore("Continue navigation animation behavior fails during testing")
@Test
fun testConIntAnim_openFractions_expId1_checkButtonDoesNotAnimate() {
TestPlatformParameterModule.forceEnableContinueButtonAnimation(true)
launchForExploration(TEST_EXPLORATION_ID_2).use {
startPlayingExploration()
playThroughTestState1()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING
import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.CacheLatexRendering
import org.oppia.android.util.platformparameter.ENABLE_APP_AND_OS_DEPRECATION_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_CONTINUE_BUTTON_ANIMATION_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE
Expand All @@ -18,7 +17,6 @@ import org.oppia.android.util.platformparameter.ENABLE_PERFORMANCE_METRICS_COLLE
import org.oppia.android.util.platformparameter.ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_SPOTLIGHT_UI_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.EnableAppAndOsDeprecation
import org.oppia.android.util.platformparameter.EnableContinueButtonAnimation
import org.oppia.android.util.platformparameter.EnableDownloadsSupport
import org.oppia.android.util.platformparameter.EnableEditAccountsOptionsUi
import org.oppia.android.util.platformparameter.EnableExtraTopicTabsUi
Expand Down Expand Up @@ -215,14 +213,6 @@ class PlatformParameterAlphaKenyaModule {
)
}

@Provides
@EnableContinueButtonAnimation
fun provideEnableContinueButtonAnimation(): PlatformParameterValue<Boolean> {
return PlatformParameterValue.createDefaultParameter(
ENABLE_CONTINUE_BUTTON_ANIMATION_DEFAULT_VALUE
)
}

@Provides
@EnableSpotlightUi
fun enableSpotlightUi(): PlatformParameterValue<Boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING
import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.CacheLatexRendering
import org.oppia.android.util.platformparameter.ENABLE_APP_AND_OS_DEPRECATION_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_CONTINUE_BUTTON_ANIMATION_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE
Expand All @@ -17,7 +16,6 @@ import org.oppia.android.util.platformparameter.ENABLE_LANGUAGE_SELECTION_UI_DEF
import org.oppia.android.util.platformparameter.ENABLE_PERFORMANCE_METRICS_COLLECTION
import org.oppia.android.util.platformparameter.ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.EnableAppAndOsDeprecation
import org.oppia.android.util.platformparameter.EnableContinueButtonAnimation
import org.oppia.android.util.platformparameter.EnableDownloadsSupport
import org.oppia.android.util.platformparameter.EnableEditAccountsOptionsUi
import org.oppia.android.util.platformparameter.EnableExtraTopicTabsUi
Expand Down Expand Up @@ -216,14 +214,6 @@ class PlatformParameterAlphaModule {
)
}

@Provides
@EnableContinueButtonAnimation
fun provideEnableContinueButtonAnimation(): PlatformParameterValue<Boolean> {
return PlatformParameterValue.createDefaultParameter(
ENABLE_CONTINUE_BUTTON_ANIMATION_DEFAULT_VALUE
)
}

@Provides
@EnableAppAndOsDeprecation
fun provideEnableAppAndOsDeprecation(): PlatformParameterValue<Boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING
import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.CacheLatexRendering
import org.oppia.android.util.platformparameter.ENABLE_APP_AND_OS_DEPRECATION_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_CONTINUE_BUTTON_ANIMATION_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE
Expand All @@ -18,7 +17,6 @@ import org.oppia.android.util.platformparameter.ENABLE_PERFORMANCE_METRICS_COLLE
import org.oppia.android.util.platformparameter.ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_SPOTLIGHT_UI_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.EnableAppAndOsDeprecation
import org.oppia.android.util.platformparameter.EnableContinueButtonAnimation
import org.oppia.android.util.platformparameter.EnableDownloadsSupport
import org.oppia.android.util.platformparameter.EnableEditAccountsOptionsUi
import org.oppia.android.util.platformparameter.EnableExtraTopicTabsUi
Expand Down Expand Up @@ -221,14 +219,6 @@ class PlatformParameterModule {
)
}

@Provides
@EnableContinueButtonAnimation
fun provideEnableContinueButtonAnimation(): PlatformParameterValue<Boolean> {
return PlatformParameterValue.createDefaultParameter(
ENABLE_CONTINUE_BUTTON_ANIMATION_DEFAULT_VALUE
)
}

@Provides
@EnableAppAndOsDeprecation
fun provideEnableAppAndOsDeprecation(): PlatformParameterValue<Boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING
import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.CacheLatexRendering
import org.oppia.android.util.platformparameter.ENABLE_APP_AND_OS_DEPRECATION_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_CONTINUE_BUTTON_ANIMATION_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.EnableAppAndOsDeprecation
import org.oppia.android.util.platformparameter.EnableContinueButtonAnimation
import org.oppia.android.util.platformparameter.EnableDownloadsSupport
import org.oppia.android.util.platformparameter.EnableEditAccountsOptionsUi
import org.oppia.android.util.platformparameter.EnableExtraTopicTabsUi
Expand Down Expand Up @@ -206,14 +204,6 @@ class TestPlatformParameterModule {
fun provideEnableInteractionConfigChangeStateRetention(): PlatformParameterValue<Boolean> =
PlatformParameterValue.createDefaultParameter(enableInteractionConfigChangeStateRetention)

@Provides
@EnableContinueButtonAnimation
fun provideEnableContinueButtonAnimation(): PlatformParameterValue<Boolean> {
return PlatformParameterValue.createDefaultParameter(
enableContinueButtonAnimation
)
}

@Provides
@EnableSpotlightUi
fun provideEnableSpotlightUi(): PlatformParameterValue<Boolean> {
Expand Down Expand Up @@ -304,7 +294,6 @@ class TestPlatformParameterModule {
fun forceEnableDownloadsSupport(value: Boolean) {
enableDownloadsSupport = value
}
private var enableContinueButtonAnimation = ENABLE_CONTINUE_BUTTON_ANIMATION_DEFAULT_VALUE

/** Enables forcing [EnableLanguageSelectionUi] platform parameter flag from tests. */
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
Expand Down Expand Up @@ -354,12 +343,6 @@ class TestPlatformParameterModule {
enablePerformanceMetricsCollection = value
}

/** Enables forcing [EnableContinueButtonAnimation] platform parameter flag from tests. */
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
fun forceEnableContinueButtonAnimation(value: Boolean) {
enableContinueButtonAnimation = value
}

/** Enables forcing [EnableSpotlightUi] platform parameter flag from tests. */
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
fun forceEnableSpotlightUi(value: Boolean) {
Expand Down
2 changes: 1 addition & 1 deletion utility/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ dependencies {
'androidx.appcompat:appcompat:1.0.2',
'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0-alpha03',
'androidx.work:work-runtime-ktx:2.4.0',
'com.github.oppia:androidsvg:1265eb1087056cf3fc2e10442e5545bc65c109ce',
'com.github.oppia:androidsvg:5bc9c7553e94c3476e8ea32baea3c77567228fcd',
'com.github.oppia:kotlitex:43139c140833c7120f351d63d74b42c253d2b213',
'com.github.bumptech.glide:glide:4.11.0',
'com.google.dagger:dagger:2.24',
Expand Down
Loading

0 comments on commit 38f64ed

Please sign in to comment.