Skip to content

Commit

Permalink
Merge branch 'oppia:develop' into talkbackissue
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishwajith-Shettigar authored Oct 14, 2023
2 parents 2f3992b + e060e2f commit 6322214
Show file tree
Hide file tree
Showing 17 changed files with 77 additions and 14 deletions.
15 changes: 14 additions & 1 deletion app/src/main/java/org/oppia/android/app/home/HomeViewModel.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.oppia.android.app.home

import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.ObservableField
import androidx.fragment.app.Fragment
import androidx.lifecycle.LiveData
import androidx.lifecycle.Transformations
Expand Down Expand Up @@ -58,6 +59,15 @@ class HomeViewModel(
R.integer.promoted_story_list_limit
)

/**
* A Boolean property indicating the visibility state of a progress bar.
* This property is used to control the visibility of a progress bar in a user interface.
* When set to true, the progress bar is made visible, indicating that an ongoing task
* or operation is in progress or pending or failed. When set to false, the progress bar is hidden, indicating
* that the operation has completed.
*/
val isProgressBarVisible = ObservableField(true)

private val profileDataProvider: DataProvider<Profile> by lazy {
profileManagementController.getProfile(profileId)
}
Expand Down Expand Up @@ -111,7 +121,10 @@ class HomeViewModel(
listOf()
}
is AsyncResult.Pending -> listOf()
is AsyncResult.Success -> itemListResult.value
is AsyncResult.Success -> {
isProgressBarVisible.set(false)
itemListResult.value
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout-land/profile_progress_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
android:contentDescription="@string/edit_profile_picture_content_description"
android:onClick="@{() -> viewModel.clickOnProfilePicture()}"
android:paddingStart="12dp"
android:paddingEnd="0dp"
android:paddingTop="12dp"
android:elevation="4dp"
app:layout_constraintBottom_toBottomOf="@+id/profile_edit_image"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
android:paddingTop="28dp"
android:paddingEnd="16dp"
android:paddingBottom="20dp"
android:text="Learner Study Analytics"
android:text="@string/learner_analytics_label_text"
android:textColor="@color/component_color_shared_active_text_color"
app:layout_constraintBottom_toTopOf="@id/profile_and_device_id_text_view"
app:layout_constraintEnd_toEndOf="parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
android:elevation="4dp"
android:onClick="@{() -> viewModel.clickOnProfilePicture()}"
android:paddingStart="12dp"
android:paddingEnd="0dp"
android:paddingTop="12dp"
app:layout_constraintBottom_toBottomOf="@+id/profile_edit_image"
app:layout_constraintEnd_toEndOf="@+id/profile_edit_image"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
android:layout_margin="8dp"
android:background="@drawable/edit_text_background"
android:focusable="true"
android:hint="Write the digit here."
android:hint="@string/test_number_input_interaction_hint"
android:textColor="@color/component_color_shared_primary_text_color"
android:textColorHint="@color/component_color_shared_edit_text_hint_color"
android:longClickable="false"
Expand Down Expand Up @@ -154,7 +154,7 @@
android:layout_margin="8dp"
android:background="@drawable/edit_text_background"
android:focusable="true"
android:hint="Write here."
android:hint="@string/test_text_input_interaction_hint"
android:inputType="text"
android:longClickable="false"
android:maxLength="200"
Expand All @@ -181,7 +181,7 @@
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:onClick="getPendingAnswerErrorOnSubmitClick"
android:text="Submit"
android:text="@string/submit_button_text"
android:textColor="@color/component_color_shared_secondary_4_text_color" />
</LinearLayout>
</ScrollView>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/add_profile_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
android:contentDescription="@string/edit_profile_picture_content_description"
android:elevation="4dp"
android:paddingStart="12dp"
android:paddingEnd="0dp"
android:paddingTop="12dp"
app:layout_constraintBottom_toBottomOf="@+id/add_profile_activity_user_image_view"
app:layout_constraintEnd_toEndOf="@+id/add_profile_activity_user_image_view"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
android:paddingTop="28dp"
android:paddingEnd="16dp"
android:paddingBottom="20dp"
android:text="Learner Study Analytics"
android:text="@string/learner_analytics_label_text"
android:textColor="@color/component_color_shared_active_text_color"
app:layout_constraintBottom_toTopOf="@id/profile_and_device_id_text_view"
app:layout_constraintEnd_toEndOf="parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
android:id="@+id/open_dialog_0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Concept Card 1"
android:text="@string/concept_card_one_button_text"
android:textAllCaps="false"/>

<Button
android:id="@+id/open_dialog_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Concept Card 2"
android:text="@string/concept_card_two_button_text"
android:textAllCaps="false" />
</LinearLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/exploration_test_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
android:id="@+id/play_exploration_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Play exploration"
android:text="@string/play_exploration_button_text"
android:textAllCaps="false"/>

<FrameLayout
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/font_scale_test_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:text="html Content"
android:text="@string/font_scale_html_content_text"
android:textColor="@color/component_color_shared_primary_text_color"
android:textSize="20sp" />
</FrameLayout>
12 changes: 10 additions & 2 deletions app/src/main/res/layout/home_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto">

<data>

<import type="org.oppia.android.R" />

<import type="android.view.View" />
<variable
name="viewModel"
type="org.oppia.android.app.home.HomeViewModel" />
Expand All @@ -17,6 +16,15 @@
android:background="@color/component_color_shared_screen_primary_background_color"
android:gravity="center">

<ProgressBar
android:id="@+id/home_fragment_progress_bar"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:indeterminateTint="@color/component_color_home_activity_progressbar_color"
android:visibility="@{viewModel.isProgressBarVisible?View.VISIBLE:View.GONE}"
/>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/home_recycler_view"
android:layout_width="match_parent"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/profile_progress_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
android:elevation="4dp"
android:onClick="@{() -> viewModel.clickOnProfilePicture()}"
android:paddingStart="8dp"
android:paddingEnd="0dp"
android:paddingTop="8dp"
app:layout_constraintBottom_toBottomOf="@+id/profile_edit_image"
app:layout_constraintEnd_toEndOf="@+id/profile_edit_image"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
android:id="@+id/sample_spotlight_target"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This is a sample text view"
android:text="@string/sample_text_view_text"
style="@style/TextViewStart"
android:layout_marginTop="80dp"
android:layout_marginStart="80dp"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/state_fragment_test_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Play exploration"
android:text="@string/play_exploration_button_text"
android:textAllCaps="false"
android:visibility="@{viewModel.hasExplorationStarted ? View.GONE : View.VISIBLE}" />
</FrameLayout>
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 @@ -223,6 +223,7 @@
<!-- Home Activity -->
<color name="component_color_home_activity_view_all_text_color">@color/color_palette_view_all_text_color</color>
<color name="component_color_home_activity_layout_greeting_text_line_color">@color/color_palette_layout_below_greeting_text_color</color>
<color name="component_color_home_activity_progressbar_color">@color/color_palette_progress_bar_solid_color</color>
<!-- CONFETTI COLORS -->
<color name="component_color_confetti_red_color">@color/color_palette_confetti_red_color</color>
<color name="component_color_confetti_yellow_color">@color/color_palette_confetti_yellow_color</color>
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<string name="menu_my_downloads">My Downloads</string>
<string name="menu_help">Help</string>
<string name="exploration_activity_title">Exploration 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">Switch Profile</string>
Expand All @@ -27,6 +28,8 @@
<string name="cellular_data_alert_dialog_description">Streaming audio may use a lot of cellular data.</string>
<string name="cellular_data_alert_dialog_checkbox">Don\'t 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="concept_card_two_button_text">Concept Card 2</string>
<string name="revision_card_toolbar_title">Revision Card</string>
<string name="unsaved_exploration_dialog_title">Leave to Topic Page?</string>
<string name="unsaved_exploration_dialog_description">Your progress will not be saved.</string>
Expand Down Expand Up @@ -60,6 +63,7 @@
<string name="previous_state_description">Navigate to the previous card</string>
<string name="next_state_description">Navigate to the next card</string>
<string name="state_submit_button">Submit</string>
<string name="submit_button_text">Submit</string>
<string name="lesson_replay_button_text">Replay</string>
<string name="state_end_exploration_button">Return To Topic</string>
<string name="previous_responses_header">Previous Responses (%s)</string>
Expand All @@ -68,6 +72,7 @@
<string name="topic_download_text">(%s)</string>
<string name="see_more">See More</string>
<string name="see_less">See Less</string>
<string name="sample_text_view_text">This is a sample text view</string>
<string name="FAQs">FAQs</string>
<string name="featured_questions">Featured Questions</string>
<string name="frequently_asked_questions">Frequently Asked Questions</string>
Expand Down Expand Up @@ -356,6 +361,8 @@
<string name="add_profile_required">Required</string>
<string name="back_button">Back Button</string>
<string name="next">Next</string>
<!-- ProfileAndDeviceIDsActivity -->
<string name="learner_analytics_label_text">Learner Study Analytics</string>
<!-- AdministratorControlsFragment -->
<string name="administrator_controls_general_label">General</string>
<string name="administrator_controls_edit_account">Edit account</string>
Expand Down Expand Up @@ -482,6 +489,8 @@
<string name="ratio_content_description_separator" description="The separator that would be used to build the text that would be read out for ratio interaction.For e.g if the input is 1:2:3 the read out text would be 1 to 2 to 3">\u0020to\u0020</string>
<string name="ratio_default_hint_text" description="The default hint text for the ratio interaction if the placeholder text is not available.">Enter a ratio in the form x:y.</string>
<string name="text_input_default_hint_text">Tap here to enter text.</string>
<string name="test_number_input_interaction_hint">Write the digit here.</string>
<string name="test_text_input_interaction_hint">Write here.</string>
<string name="smallest_text_size_content_description">Smallest text size</string>
<string name="largest_text_size_content_description">Largest text size</string>
<string name="coming_soon">Coming Soon</string>
Expand Down Expand Up @@ -596,4 +605,5 @@
<string name="profile_picture_image_view_content_description">Profile Picture Image View</string>
<string name="lock_icon_content_description">Lock Icon</string>
<string name="download_status_image_content_description">Download Status</string>
<string name="font_scale_html_content_text">html Content</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,33 @@ class HomeActivityTest {
assertThat(screenName).isEqualTo(ScreenName.HOME_ACTIVITY)
}

@Test
fun testHomeActivity_loadingItemsPending_progressbarIsDisplayed() {
fakeOppiaClock.setFakeTimeMode(FakeOppiaClock.FakeTimeMode.MODE_FIXED_FAKE_TIME)
launch<HomeActivity>(createHomeActivityIntent(internalProfileId)).use {
onView(withId(R.id.home_fragment_progress_bar)).check(
matches(
isDisplayed()
)
)
}
}

@Test
fun testHomeActivity_loadingItemsSuccess_checkProgressbarIsNotDisplayed() {
fakeOppiaClock.setFakeTimeMode(FakeOppiaClock.FakeTimeMode.MODE_FIXED_FAKE_TIME)
launch<HomeActivity>(createHomeActivityIntent(internalProfileId)).use {
testCoroutineDispatchers.runCurrent()
onView(withId(R.id.home_fragment_progress_bar)).check(
matches(
not(
isDisplayed()
)
)
)
}
}

@Test
fun testHomeActivity_hasCorrectActivityLabel() {
launch(HomeActivity::class.java).use { scenario ->
Expand Down

0 comments on commit 6322214

Please sign in to comment.