Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #3487: Make changes to UI to indicate partial progress of explorations. #3500

Merged
merged 22 commits into from
Aug 10, 2021

Conversation

MaskedCarrot
Copy link
Contributor

@MaskedCarrot MaskedCarrot commented Jul 17, 2021

Explanation

Fixes #3487

Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The PR explanation includes the words "Fixes #bugnum: ..." (or "Fixes part of #bugnum" if the PR only partially fixes an issue).
  • The PR follows the style guide.
  • The PR does not contain any unnecessary auto-generated code from Android Studio.
  • The PR is made from a branch that's not called "develop".
  • The PR is made from a branch that is up-to-date with "develop".
  • The PR's branch is based on "develop" and not on any other branch.
  • The PR is assigned to an appropriate reviewer in both the Assignees and the Reviewers sections.

Espresso Tests

RecentlyPlayedFragmentTest

Screenshot from 2021-07-18 12-46-35

TopicLessonsFragmentTest

Screenshot from 2021-07-27 14-35-46

Steps to see these changes or a real/emulator device

  1. Change the value of the variables shouldSavePartialProgress and isCheckpointingEnabled to true in TopicLessonsFragmentPresenter or replace topicLessonsFragmentPresneter with this file.
  2. Run the app
  3. start any exploration from the topic lessons tab. Exit it partially complete.
  4. see changes.

@MaskedCarrot MaskedCarrot marked this pull request as ready for review July 17, 2021 19:22
@MaskedCarrot MaskedCarrot marked this pull request as draft July 17, 2021 19:22
@MaskedCarrot
Copy link
Contributor Author

Screenshot from 2021-07-18 00-56-16

@rt4914 where can I get this icon to represent partial progress?

@MaskedCarrot
Copy link
Contributor Author

@aggarwalpulkit596 Can you please review these changes.

@MaskedCarrot
Copy link
Contributor Author

Now the recently played chapter means chapters that are marked started_not_completed, in_progress_saved and in_progress_not_saved instead of just started_not_completed.

There were a lot of functions in StoryProgressTestHelper that marked topic/stories/explorations as started_not_completed. These functions were named like testMarkChapterAsRecentlyPlayed......... In this PR, every functions that marked a chapter/story/topic as recently played is now expanded into three functions:

  1. testMarkChapterAsStartedNotCompleted......
  2. testMarkChapterAsInProgressSaved.......
  3. testMarkChapterAsInProgressNotSaved......

The functions and their tests (present in StoryProgressTestHelperTest) have remained almost the same, the only change that is made is in the function name and what chapterPlayState they are marking the topic/story/exploration in.

@@ -173,12 +173,50 @@ class RecentlyPlayedFragmentTest {
}

@Test
fun testRecentlyPlayedTestActivity_defaultRecentlyPlayedToolbarTitleIsDisplayed() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test was incorrectly passing on robolectic and was failing on espresso.

Title on RecentlyPlayedActivtiy changes depending upon the chapters played. But it takes time to update the title. Adding delay after launching the activity makes this test fail on robolectric too.

This test is now passing.

Copy link
Contributor Author

@MaskedCarrot MaskedCarrot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MaskedCarrot MaskedCarrot assigned rt4914 and unassigned MaskedCarrot Jul 19, 2021
@MaskedCarrot MaskedCarrot marked this pull request as ready for review July 21, 2021 14:15
@rt4914
Copy link
Contributor

rt4914 commented Jul 22, 2021

Screenshot from 2021-07-18 00-56-16

@rt4914 where can I get this icon to represent partial progress?

I will email @mschanteltc for this.

chapterInProgressArcPaint.color =
ContextCompat.getColor(context, R.color.oppiaProgressChapterInProgress)

chapterNotStartedArcPaint = Paint(Paint.ANTI_ALIAS_FLAG)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move it to helper function since this is being written here twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes it consistent with chapterFinishedArcPaint. Doing these two with a helper function and chapterFinishedArcPaint without a helper function might be slightly misleading.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since that is also using a similar process i would suggest moving both of them to a helper function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -109,12 +124,20 @@ class SegmentedCircularProgressView : View {
canvas.drawArc(baseRect!!, startAngle, sweepAngle, false, chapterFinishedArcPaint)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use lateinit instead of making it nullable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

val inProgressChapterCount =
chapterSummaries.map(ChapterSummary::getChapterPlayState)
.filter {
Log.d("12345", "bindTopicLessonStorySummary: chapter is marked $it")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleanup logs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@MaskedCarrot
Copy link
Contributor Author

For now, this PR uses the ic_arrow_right_24dp icon as the icon for showing partial progress. I will update this temporary icon with the actual partial progress icon once it is available. All the tests check the arrow icon for now.

@anandwana001
Copy link
Contributor

I will take a look at this tomorrow.

@BenHenning
Copy link
Sponsor Member

Deferring to @aggarwalpulkit596 for approval before I take a look at codeowners.

Copy link
Contributor

@anandwana001 anandwana001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @MaskedCarrot
Left nit thoughts.

@rt4914
Copy link
Contributor

rt4914 commented Aug 8, 2021

@MaskedCarrot I have done following steps and still I am unable to check this implementation.

  1. Uninstalled the app.
  2. Change isCheckpointingEnabled in ExplorationActivityPresenter to true
  3. Change isCheckpointingEnabled in ExplorationActivity to true
  4. Change shouldSavePartialProgress in ExplorationProgress to true

After these steps I ran the app on emulator Pixel 3A API 28

  1. Open Fractions topic
  2. Open Matthew Goes to Bakery
  3. Complete couple of states and then leave exploration

Unable to see any partial-progress icon. Also when I open the exploration again it starts from first state.

@MaskedCarrot
Copy link
Contributor Author

@rt4914 I missed specifying that isCheckpointingEnabled and shouldSavePartialProgress will only have to be changed in topicLessonsFragmentPresenter. I have updated the PR description now.

Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

@rt4914 rt4914 removed their assignment Aug 8, 2021
Copy link
Contributor

@anandwana001 anandwana001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code owner file LGTM.

Could you please add the Espresso test result screenshot of all the test file in this PR? @MaskedCarrot

Copy link
Sponsor Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @MaskedCarrot. Just a couple of follow-ups, otherwise this PR LGTM.

@BenHenning BenHenning removed their assignment Aug 9, 2021
@MaskedCarrot
Copy link
Contributor Author

@BenHenning PTAL

Copy link
Sponsor Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @MaskedCarrot. This LGTM!

@aggarwalpulkit596 aggarwalpulkit596 merged commit 630a433 into develop Aug 10, 2021
@aggarwalpulkit596 aggarwalpulkit596 deleted the show-partial-progress-in-ui branch August 10, 2021 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show partial progress in the UI layer.
6 participants