Skip to content

Commit

Permalink
Merge branch 'develop' into nps-optional-response-upload
Browse files Browse the repository at this point in the history
  • Loading branch information
adhiamboperes authored Nov 22, 2023
2 parents 8215c53 + 54e0ba5 commit 99a15d3
Show file tree
Hide file tree
Showing 30 changed files with 294 additions and 197 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()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ class StateFragmentPresenter @Inject constructor(

fun onSubmitButtonClicked() {
hideKeyboard()
handleSubmitAnswer(viewModel.getPendingAnswer(recyclerViewAssembler::getPendingAnswerHandler))
val answer = viewModel.getPendingAnswer(recyclerViewAssembler::getPendingAnswerHandler)
if (answer != null) {
handleSubmitAnswer(answer)
}
}

fun onResponsesHeaderClicked() {
Expand All @@ -215,7 +218,10 @@ class StateFragmentPresenter @Inject constructor(
fun handleKeyboardAction() {
hideKeyboard()
if (viewModel.getCanSubmitAnswer().get() == true) {
handleSubmitAnswer(viewModel.getPendingAnswer(recyclerViewAssembler::getPendingAnswerHandler))
val answer = viewModel.getPendingAnswer(recyclerViewAssembler::getPendingAnswerHandler)
if (answer != null) {
handleSubmitAnswer(answer)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ class StateViewModel @Inject constructor(

fun getPendingAnswer(
retrieveAnswerHandler: (List<StateItemViewModel>) -> InteractionAnswerHandler?
): UserAnswer {
): UserAnswer? {
return getPendingAnswerWithoutError(
retrieveAnswerHandler(
getAnswerItemList()
)
) ?: UserAnswer.getDefaultInstance()
)
}

fun canQuicklyToggleBetweenSwahiliAndEnglish(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,10 @@ class SurveyFragmentPresenter @Inject constructor(

private fun subscribeToCurrentQuestion() {
ephemeralQuestionLiveData.observe(
fragment,
{
processEphemeralQuestionResult(it)
}
)
fragment.viewLifecycleOwner
) {
processEphemeralQuestionResult(it)
}
}

private fun processEphemeralQuestionResult(result: AsyncResult<EphemeralSurveyQuestion>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/administrator_controls_guideline"
app:layout_constraintTop_toBottomOf="@id/extra_controls_title" />
app:layout_constraintTop_toBottomOf="@id/extra_controls_title"
tools:ignore="InconsistentLayout" />

<View
android:id="@+id/administrator_controls_toolbar_shadow_view"
Expand Down
9 changes: 6 additions & 3 deletions app/src/main/res/layout-sw600dp/help_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
android:visibility="gone"
app:layout_constraintStart_toEndOf="@id/multipane_guideline"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_arrow_back_black_24_dp" />
app:srcCompat="@drawable/ic_arrow_back_black_24_dp"
tools:ignore="InconsistentLayout" />

<TextView
android:id="@+id/help_multipane_options_title_textview"
Expand All @@ -61,7 +62,8 @@
android:textColor="@color/component_color_shared_primary_text_color"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/help_multipane_options_back_button"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
tools:ignore="InconsistentLayout" />

<FrameLayout
android:id="@+id/multipane_options_container"
Expand All @@ -71,7 +73,8 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/multipane_guideline"
app:layout_constraintTop_toBottomOf="@id/help_multipane_options_title_textview" />
app:layout_constraintTop_toBottomOf="@id/help_multipane_options_title_textview"
tools:ignore="InconsistentLayout" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/multipane_guideline"
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/res/layout-sw600dp/option_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/multipane_guideline"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
tools:ignore="InconsistentLayout" />

<FrameLayout
android:id="@+id/multipane_options_container"
Expand All @@ -55,7 +56,8 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/multipane_guideline"
app:layout_constraintTop_toBottomOf="@id/options_activity_selected_options_title" />
app:layout_constraintTop_toBottomOf="@id/options_activity_selected_options_title"
tools:ignore="InconsistentLayout" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/multipane_guideline"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/options_activity_drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
Expand Down Expand Up @@ -44,7 +45,8 @@
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/multipane_guideline"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
tools:ignore="InconsistentLayout" />

<FrameLayout
android:id="@+id/multipane_options_container"
Expand All @@ -54,7 +56,8 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/multipane_guideline"
app:layout_constraintTop_toBottomOf="@id/options_activity_selected_options_title" />
app:layout_constraintTop_toBottomOf="@id/options_activity_selected_options_title"
tools:ignore="InconsistentLayout" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/multipane_guideline"
Expand Down
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
9 changes: 6 additions & 3 deletions app/src/main/res/values-pcm-rNG/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Authors:
* Busayo
* Confidence
* Osetiemoria
-->
<resources>
Expand All @@ -9,6 +10,7 @@
<string name="menu_my_downloads">My Downloads</string>
<string name="menu_help">Help</string>
<string name="exploration_activity_title">Lesson Player</string>
<string name="play_exploration_button_text">play exploration</string>
<string name="help_activity_title">Help</string>
<string name="bottom_sheet_options_menu_close">Close</string>
<string name="menu_switch_profile">Change Profile</string>
Expand All @@ -19,18 +21,19 @@
<string name="audio_play_description">Play di audio</string>
<string name="audio_pause_description">Pause di audio</string>
<string name="audio_unavailable_in_selected_language">%s audio no dey available.</string>
<string name="audio_language_select_dialog_okay_button" fuzzy="true">OK</string>
<string name="audio_language_select_dialog_okay_button">OK</string>
<string name="audio_language_select_dialog_cancel_button">Cancel am</string>
<string name="audio_language_select_dialog_title">Audio Language</string>
<string name="audio_dialog_offline_title">You dey offline</string>
<string name="audio_dialog_offline_message">Make sure sey Wi-Fi or mobile data dey on, den try am again.</string>
<string name="audio_dialog_offline_positive" fuzzy="true">OK</string>
<string name="cellular_data_alert_dialog_okay_button" fuzzy="true">OK</string>
<string name="audio_dialog_offline_positive">OK</string>
<string name="cellular_data_alert_dialog_okay_button">OK</string>
<string name="cellular_data_alert_dialog_cancel_button">Cancel am</string>
<string name="cellular_data_alert_dialog_title">Na your data you dey use now</string>
<string name="cellular_data_alert_dialog_description">Playing di audio go use plenti mobile data.</string>
<string name="cellular_data_alert_dialog_checkbox">No show this message again</string>
<string name="concept_card_toolbar_title">Concept Card</string>
<string name="concept_card_one_button_text">Concept Card 1</string>
<string name="revision_card_toolbar_title">Revision Card</string>
<string name="unsaved_exploration_dialog_title">Comot go the topic page?</string>
<string name="unsaved_exploration_dialog_description">Wetin you don do before no go save</string>
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>
Loading

0 comments on commit 99a15d3

Please sign in to comment.