From 31152c5a83c6c8120ad13777b15fc6f2b0373d94 Mon Sep 17 00:00:00 2001 From: Rajat Talesra Date: Mon, 17 Aug 2020 18:10:21 +0530 Subject: [PATCH] Fix #1666: Lowfi update for Profile Progress (#1669) * Lowfi update * Nit change Co-authored-by: Rajat Talesra --- .../ProfileProgressViewModel.kt | 5 +- ...le_progress_recently_played_story_card.xml | 67 +++++++++--------- ...le_progress_recently_played_story_card.xml | 6 +- ...le_progress_recently_played_story_card.xml | 6 +- ...le_progress_recently_played_story_card.xml | 69 +++++++++---------- app/src/main/res/values-land/integers.xml | 3 +- .../main/res/values-sw600dp-land/integers.xml | 1 - .../main/res/values-sw600dp-port/integers.xml | 1 - app/src/main/res/values/integers.xml | 3 +- .../ProfileProgressFragmentTest.kt | 29 ++------ .../app/testing/ProfileProgressSpanCount.kt | 4 +- 11 files changed, 78 insertions(+), 116 deletions(-) diff --git a/app/src/main/java/org/oppia/app/profileprogress/ProfileProgressViewModel.kt b/app/src/main/java/org/oppia/app/profileprogress/ProfileProgressViewModel.kt index c96c0265646..14be4303a23 100644 --- a/app/src/main/java/org/oppia/app/profileprogress/ProfileProgressViewModel.kt +++ b/app/src/main/java/org/oppia/app/profileprogress/ProfileProgressViewModel.kt @@ -37,7 +37,6 @@ class ProfileProgressViewModel @Inject constructor( private var internalProfileId: Int = -1 private lateinit var profileId: ProfileId private var limit: Int = 0 - private var subset: Int = 0 private val headerViewModel = ProfileProgressHeaderViewModel(activity, fragment) @@ -97,7 +96,6 @@ class ProfileProgressViewModel @Inject constructor( */ fun handleOnConfigurationChange() { limit = fragment.resources.getInteger(R.integer.profile_progress_limit) - subset = fragment.resources.getInteger(R.integer.profile_progress_subset) refreshedOngoingStoryListViewModelLiveData = Transformations.map(ongoingStoryListLiveData, ::processOngoingStoryList) as MutableLiveData } @@ -119,9 +117,8 @@ class ProfileProgressViewModel @Inject constructor( ongoingStoryList: OngoingStoryList ): List { limit = fragment.resources.getInteger(R.integer.profile_progress_limit) - subset = fragment.resources.getInteger(R.integer.profile_progress_subset) val itemList = if (ongoingStoryList.recentStoryList.size > limit) { - ongoingStoryList.recentStoryList.subList(0, subset) + ongoingStoryList.recentStoryList.subList(0, limit) } else { ongoingStoryList.recentStoryList } diff --git a/app/src/main/res/layout-land/profile_progress_recently_played_story_card.xml b/app/src/main/res/layout-land/profile_progress_recently_played_story_card.xml index a4cf88d5cc4..384531e7b9d 100755 --- a/app/src/main/res/layout-land/profile_progress_recently_played_story_card.xml +++ b/app/src/main/res/layout-land/profile_progress_recently_played_story_card.xml @@ -14,84 +14,79 @@ + android:layout_height="match_parent" + android:clickable="true" + android:focusable="true"> - - - + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/lesson_thumbnail"> + android:textSize="14sp" + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + android:textSize="14sp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/story_name_text_view" /> + diff --git a/app/src/main/res/layout-sw600dp-land/profile_progress_recently_played_story_card.xml b/app/src/main/res/layout-sw600dp-land/profile_progress_recently_played_story_card.xml index a0f097fcdc7..384531e7b9d 100644 --- a/app/src/main/res/layout-sw600dp-land/profile_progress_recently_played_story_card.xml +++ b/app/src/main/res/layout-sw600dp-land/profile_progress_recently_played_story_card.xml @@ -50,7 +50,7 @@ app:layout_constraintTop_toBottomOf="@id/lesson_thumbnail"> + app:layout_constraintTop_toBottomOf="@id/story_name_text_view" /> diff --git a/app/src/main/res/layout-sw600dp-port/profile_progress_recently_played_story_card.xml b/app/src/main/res/layout-sw600dp-port/profile_progress_recently_played_story_card.xml index a0f097fcdc7..384531e7b9d 100644 --- a/app/src/main/res/layout-sw600dp-port/profile_progress_recently_played_story_card.xml +++ b/app/src/main/res/layout-sw600dp-port/profile_progress_recently_played_story_card.xml @@ -50,7 +50,7 @@ app:layout_constraintTop_toBottomOf="@id/lesson_thumbnail"> + app:layout_constraintTop_toBottomOf="@id/story_name_text_view" /> diff --git a/app/src/main/res/layout/profile_progress_recently_played_story_card.xml b/app/src/main/res/layout/profile_progress_recently_played_story_card.xml index 0478ea29c3b..384531e7b9d 100755 --- a/app/src/main/res/layout/profile_progress_recently_played_story_card.xml +++ b/app/src/main/res/layout/profile_progress_recently_played_story_card.xml @@ -14,84 +14,79 @@ + app:cardElevation="4dp"> + android:layout_height="match_parent" + android:clickable="true" + android:focusable="true"> - - - + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/lesson_thumbnail"> + android:textSize="14sp" + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + android:textSize="14sp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/story_name_text_view" /> + diff --git a/app/src/main/res/values-land/integers.xml b/app/src/main/res/values-land/integers.xml index eff38b05d8c..690610b3d60 100644 --- a/app/src/main/res/values-land/integers.xml +++ b/app/src/main/res/values-land/integers.xml @@ -6,7 +6,6 @@ 3 3 3 - 1 + 3 3 - 2 diff --git a/app/src/main/res/values-sw600dp-land/integers.xml b/app/src/main/res/values-sw600dp-land/integers.xml index 070a7c40ce7..b74b2f0011b 100644 --- a/app/src/main/res/values-sw600dp-land/integers.xml +++ b/app/src/main/res/values-sw600dp-land/integers.xml @@ -9,5 +9,4 @@ 4 4 4 - 4 diff --git a/app/src/main/res/values-sw600dp-port/integers.xml b/app/src/main/res/values-sw600dp-port/integers.xml index 4a29791029e..78e349483ee 100644 --- a/app/src/main/res/values-sw600dp-port/integers.xml +++ b/app/src/main/res/values-sw600dp-port/integers.xml @@ -10,5 +10,4 @@ 3 3 3 - 3 diff --git a/app/src/main/res/values/integers.xml b/app/src/main/res/values/integers.xml index da4e0f98781..4998c5ea7ba 100644 --- a/app/src/main/res/values/integers.xml +++ b/app/src/main/res/values/integers.xml @@ -11,7 +11,6 @@ 2 2 2 - 1 + 2 3 - 2 diff --git a/app/src/sharedTest/java/org/oppia/app/profileprogress/ProfileProgressFragmentTest.kt b/app/src/sharedTest/java/org/oppia/app/profileprogress/ProfileProgressFragmentTest.kt index 3644168911f..2c7c2a4ec93 100644 --- a/app/src/sharedTest/java/org/oppia/app/profileprogress/ProfileProgressFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/app/profileprogress/ProfileProgressFragmentTest.kt @@ -410,37 +410,16 @@ class ProfileProgressFragmentTest { } @Test - fun testProfileProgressActivity_recyclerViewItem1_chapterNameIsCorrect() { - launch(createProfileProgressActivityIntent(internalProfileId)).use { - onView(withId(R.id.profile_progress_list)).perform( - scrollToPosition( - 1 - ) - ) - waitForTheView(withText("Prototype Exploration")) - onView( - atPositionOnView( - R.id.profile_progress_list, - 1, R.id.chapter_name_text_view - ) - ).check( - matches(withText(containsString("Prototype Exploration"))) - ) - } - } - - @Test - @Config(qualifiers = "port-xxhdpi") - fun testProfileProgressActivity_changeConfiguration_recyclerViewItem1_chapterNameIsCorrect() { + fun testProfileProgressActivity_changeConfiguration_recyclerViewItem1_storyNameIsCorrect() { launch(createProfileProgressActivityIntent(internalProfileId)).use { onView(isRoot()).perform(orientationLandscape()) onView(withId(R.id.profile_progress_list)) .perform(scrollToPosition(1)) - waitForTheView(withText("Prototype Exploration")) + waitForTheView(withText("First Story")) onView( - atPositionOnView(R.id.profile_progress_list, 1, R.id.chapter_name_text_view) + atPositionOnView(R.id.profile_progress_list, 1, R.id.story_name_text_view) ).check( - matches(withText(containsString("Prototype Exploration"))) + matches(withText(containsString("First Story"))) ) } } diff --git a/app/src/test/java/org/oppia/app/testing/ProfileProgressSpanCount.kt b/app/src/test/java/org/oppia/app/testing/ProfileProgressSpanCount.kt index 40e74ecce56..6e77b045ed0 100644 --- a/app/src/test/java/org/oppia/app/testing/ProfileProgressSpanCount.kt +++ b/app/src/test/java/org/oppia/app/testing/ProfileProgressSpanCount.kt @@ -45,7 +45,7 @@ class ProfileProgressSpanCount { fun testProfileProgress_checkRecyclerViewSpanCount_spanIsCorrect() { launch(ProfileProgressActivity::class.java).use { it.onActivity { activity -> - assertThat(getProfileProgressSpanCount(activity)).isEqualTo(1) + assertThat(getProfileProgressSpanCount(activity)).isEqualTo(2) } } } @@ -55,7 +55,7 @@ class ProfileProgressSpanCount { fun testProfileProgress_checkRecyclerViewSpanCount_land_spanIsCorrect() { launch(ProfileProgressActivity::class.java).use { it.onActivity { activity -> - assertThat(getProfileProgressSpanCount(activity)).isEqualTo(1) + assertThat(getProfileProgressSpanCount(activity)).isEqualTo(3) } } }