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 #936 & #2297 : Oppia Android Promoted Stories App Layer. #2320

Merged
merged 517 commits into from
Feb 13, 2021
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
517 commits
Select commit Hold shift + click to select a range
597c3bf
Update HomeViewModel.kt
veena14cs Jan 12, 2021
af20304
Rename RecommendedActivityList to PromotedActivityList
veena14cs Jan 12, 2021
ccac3da
Address comments for HomeActivityTest
jcqli Jan 12, 2021
1d66248
Import ActivityScenario.launch for view model tests
jcqli Jan 12, 2021
65173e2
Use named parameters in StoryProgressTestHelperTest
jcqli Jan 12, 2021
83c99b1
Clarify new user used for no story progress in ProfileTestHelpr
jcqli Jan 12, 2021
1f25997
Order view model alphabetically
jcqli Jan 12, 2021
356e03e
Add readability fixes from review
jcqli Jan 12, 2021
0641c8e
Fix comments
jcqli Jan 12, 2021
0d08d9a
Resolve merge conflicts
jcqli Jan 12, 2021
86a2a36
Add dummy data in promoted story list view to appropriately initiate …
jcqli Jan 13, 2021
1bcd610
Merge commit 'refs/pull/2246/head' of https://github.com/oppia/oppia-…
veena14cs Jan 13, 2021
b5c56f4
Merge commit 'refs/pull/2246/head' of https://github.com/oppia/oppia-…
veena14cs Jan 13, 2021
b0b5045
Merge remote-tracking branch 'upstream/develop' into refactor-topic-l…
jcqli Jan 13, 2021
346fc10
Use BindingAdapter on the data list of promtoed stories
jcqli Jan 13, 2021
67eb418
Remove static binding adapter for data-binding in promoted story list…
jcqli Jan 14, 2021
e1e0703
Address review comments
jcqli Jan 14, 2021
4116a55
Merge branch 'refactor-topic-list-adapter-to-use-bindable-adapter-vee…
veena14cs Jan 14, 2021
f67521e
updated
veena14cs Jan 14, 2021
60c9cfc
Remove extra space in layout
jcqli Jan 14, 2021
03e076c
Merge commit 'refs/pull/2246/head' of https://github.com/oppia/oppia-…
veena14cs Jan 14, 2021
bc6b71c
Merge branch 'refactor-topic-list-adapter-to-use-bindable-adapter-vee…
veena14cs Jan 14, 2021
ee3ae37
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 14, 2021
73e9210
updated implementation
veena14cs Jan 15, 2021
bbb349e
Fixed data binding error
veena14cs Jan 15, 2021
7895b49
updated implementation
veena14cs Jan 17, 2021
ef5fa65
fixed logic of computing story is completed
veena14cs Jan 17, 2021
810eb4f
Update HomeViewModel.kt
veena14cs Jan 18, 2021
de22e9a
updated topic ontroller
veena14cs Jan 18, 2021
7874e25
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 18, 2021
0d84080
Update promoted_story_list.xml
veena14cs Jan 18, 2021
1388c52
fixed implementation and updated testcases
veena14cs Jan 18, 2021
97f16f7
updated
veena14cs Jan 18, 2021
16a68ad
fixed lint errors
veena14cs Jan 18, 2021
d460988
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 18, 2021
3501a1e
updated viewmodel
veena14cs Jan 18, 2021
cdb3bfc
updated tests
veena14cs Jan 19, 2021
0c85d35
Update StoryProgressTestHelper.kt
veena14cs Jan 19, 2021
db021c8
fixed lint errors
veena14cs Jan 19, 2021
933bac0
Update StoryProgressTestHelperTest.kt
veena14cs Jan 19, 2021
de0cfba
Update StoryProgressTestHelperTest.kt
veena14cs Jan 19, 2021
07ec5e6
Update StoryProgressTestHelperTest.kt
veena14cs Jan 19, 2021
93ca1ef
fixed lint errors
veena14cs Jan 19, 2021
dcaca22
updated lint fix
veena14cs Jan 19, 2021
d55273d
fixed lint
veena14cs Jan 19, 2021
8b2f3e3
Update topic.proto
veena14cs Jan 19, 2021
223d5d5
merged with latest prmoted story
veena14cs Jan 19, 2021
5c721e4
Fixed number of days
veena14cs Jan 19, 2021
47656be
Update TopicListController.kt
veena14cs Jan 19, 2021
a021b80
Fixed issues
veena14cs Jan 20, 2021
bb0c22f
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 20, 2021
065d9f8
Update RecentlyPlayedFragmentPresenter.kt
veena14cs Jan 20, 2021
427de92
Update domain/src/main/java/org/oppia/android/domain/topic/StoryProgr…
veena14cs Jan 20, 2021
656131b
fixing logical error
veena14cs Jan 20, 2021
b4f2ae4
Update TopicListController.kt
veena14cs Jan 20, 2021
a06a47d
Update TopicListController.kt
veena14cs Jan 20, 2021
c3b47ab
Update TopicListController.kt
veena14cs Jan 20, 2021
8f573de
Update domain/src/main/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 20, 2021
ac3ead7
Fixed nit changes
veena14cs Jan 20, 2021
4191552
Update TopicListController.kt
veena14cs Jan 20, 2021
9cf9701
fixed nit changes
veena14cs Jan 20, 2021
08b9eef
Update TopicListController.kt
veena14cs Jan 20, 2021
0d12997
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 20, 2021
d7e5a3f
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 21, 2021
e6f6a02
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 21, 2021
18cc3b5
fixed olderstories list.
veena14cs Jan 21, 2021
af05938
Update HomeActivityTest.kt
veena14cs Jan 21, 2021
f4ad67b
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 21, 2021
7f7ea3f
Update TopicListController.kt
veena14cs Jan 21, 2021
c051c58
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 21, 2021
49c5bdb
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 21, 2021
f78db26
Update TopicListControllerTest.kt
veena14cs Jan 22, 2021
d2a3079
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 22, 2021
b75d103
Update TopicListControllerTest.kt
veena14cs Jan 22, 2021
084a5f9
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 22, 2021
8761258
fixed issues
veena14cs Jan 22, 2021
f210706
removed limit
veena14cs Jan 22, 2021
c8a44b9
Update HomeViewModel.kt
veena14cs Jan 22, 2021
75d73d2
updated implementation
veena14cs Jan 22, 2021
5ffde9d
fixed lint
veena14cs Jan 22, 2021
7e15317
Update HomeViewModel.kt
veena14cs Jan 22, 2021
697b2d4
Update HomeViewModel.kt
veena14cs Jan 22, 2021
a37015e
updated implementation
veena14cs Jan 22, 2021
b6529db
Update domain/src/main/java/org/oppia/android/domain/topic/StoryProgr…
veena14cs Jan 22, 2021
3b8ffe5
Update StoryProgressController.kt
veena14cs Jan 22, 2021
fb55314
updated storyProgressController
veena14cs Jan 22, 2021
0bf3643
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 22, 2021
4e4399b
Removed lastPlayed timestamp from topic progress
veena14cs Jan 23, 2021
dc12d20
Fixed testcases and TopicListcontroller
veena14cs Jan 23, 2021
eff7c62
Update TopicListController.kt
veena14cs Jan 23, 2021
acd25c4
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 23, 2021
d54f6b9
updated changes
veena14cs Jan 23, 2021
f1d4b80
Update topic.proto
veena14cs Jan 23, 2021
f50eebd
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 23, 2021
67ec1de
fixed sorting
veena14cs Jan 23, 2021
104a669
fixed lint
veena14cs Jan 23, 2021
ff2a983
Updated changes
veena14cs Jan 23, 2021
f80a87b
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 23, 2021
0aa5327
Update domain/src/test/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 23, 2021
7fb3c12
Implemented changes
veena14cs Jan 23, 2021
3ddcbe3
fixed lint
veena14cs Jan 23, 2021
48f8fa2
Update TopicListController.kt
veena14cs Jan 23, 2021
f1fa4b9
Update StoryProgressTestHelperTest.kt
veena14cs Jan 23, 2021
cb8ddc1
Update StoryProgressController.kt
veena14cs Jan 23, 2021
a460014
fixed testcases
veena14cs Jan 23, 2021
fc94cec
implemented changes
veena14cs Jan 23, 2021
d4af3fb
Fixed suggestionList
veena14cs Jan 24, 2021
fc49d00
fixed testcases
veena14cs Jan 24, 2021
f797fa3
updated list ids
veena14cs Jan 24, 2021
bda7b8a
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 24, 2021
ad91320
Update domain/src/main/java/org/oppia/android/domain/topic/StoryProgr…
veena14cs Jan 24, 2021
6c4d2f1
Update domain/src/main/java/org/oppia/android/domain/topic/StoryProgr…
veena14cs Jan 24, 2021
03244c1
Update domain/src/main/java/org/oppia/android/domain/topic/StoryProgr…
veena14cs Jan 24, 2021
06af4c7
Update domain/src/main/java/org/oppia/android/domain/topic/StoryProgr…
veena14cs Jan 24, 2021
3e157bc
Update domain/src/main/java/org/oppia/android/domain/topic/StoryProgr…
veena14cs Jan 24, 2021
5bb4566
Update domain/src/main/java/org/oppia/android/domain/topic/StoryProgr…
veena14cs Jan 24, 2021
d8ea956
fixed suggested list logic
veena14cs Jan 24, 2021
95391f3
lint errors
veena14cs Jan 24, 2021
2157adb
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 24, 2021
3d43745
updated
veena14cs Jan 24, 2021
e21bbce
updated testcases
veena14cs Jan 24, 2021
0dcaa1b
Update HomeActivityTest.kt
veena14cs Jan 24, 2021
6f12d2d
added helper tests
veena14cs Jan 24, 2021
db82130
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 24, 2021
615d2f5
Update StoryProgressTestHelperTest.kt
veena14cs Jan 24, 2021
394566a
Update TopicController.kt
veena14cs Jan 24, 2021
8dd60bb
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 24, 2021
7a34298
Update BUILD.bazel
veena14cs Jan 24, 2021
0826b41
Update TopicListController.kt
veena14cs Jan 25, 2021
57e66bf
removed duplicate function
veena14cs Jan 25, 2021
36b825d
Update TopicListController.kt
veena14cs Jan 25, 2021
19de4a9
Fixed lint
veena14cs Jan 25, 2021
fb155e2
Updated Suggestion logic
veena14cs Jan 25, 2021
8bf4711
Update BUILD.bazel
veena14cs Jan 25, 2021
bab2547
fixed nit.
veena14cs Jan 26, 2021
486ba33
Update TopicListController.kt
veena14cs Jan 26, 2021
85488ee
fixed test
veena14cs Jan 26, 2021
c8e99b8
rename testcase
veena14cs Jan 26, 2021
2cb170b
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 26, 2021
1b8246d
Done changes in the implementation and testcases as per discussion.
veena14cs Jan 27, 2021
f766ac7
Update TopicListController.kt
veena14cs Jan 27, 2021
156b692
Update TopicListController.kt
veena14cs Jan 27, 2021
8ee6cb0
Update TopicListController.kt
veena14cs Jan 27, 2021
6255455
Updated implementation changes and testcases as per discussion.
veena14cs Jan 27, 2021
14cee39
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 28, 2021
2441187
updated with develop code to pass ci tests.
veena14cs Jan 28, 2021
e6f7ece
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 28, 2021
4f2f0c2
Update TopicListController.kt
veena14cs Jan 28, 2021
c905b26
Update TopicListController.kt
veena14cs Jan 28, 2021
abc8bb7
fixed changes
veena14cs Jan 28, 2021
530b13a
fixed changes
veena14cs Jan 28, 2021
ad14c9f
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 28, 2021
82fb7ed
fixing testases
veena14cs Jan 28, 2021
dddbcda
Update TopicListControllerTest.kt
veena14cs Jan 28, 2021
1c79489
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 28, 2021
e78f7ab
Update domain/src/main/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 29, 2021
d5f074e
Update domain/src/main/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 29, 2021
ed9185f
Update domain/src/main/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 29, 2021
193344d
Update domain/src/main/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 29, 2021
e9dd454
Update domain/src/main/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 29, 2021
ddf4bb0
Update domain/src/test/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 29, 2021
026b9c0
fixed testcases and implementation
veena14cs Jan 29, 2021
70fcf8a
fixed testcases and implementation
veena14cs Jan 29, 2021
d06fcc6
Update TopicListController.kt
veena14cs Jan 29, 2021
f23615c
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 29, 2021
bd76e7f
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 29, 2021
2117507
renamed timestamp in all the test files.
veena14cs Jan 29, 2021
a3ff91f
fixed timestamp
veena14cs Jan 29, 2021
e476fdb
removed block of unwanted code
veena14cs Jan 29, 2021
d91733c
fixing changes
veena14cs Jan 29, 2021
17afb19
Update TopicListControllerTest.kt
veena14cs Jan 29, 2021
a74776e
Update TopicListControllerTest.kt
veena14cs Jan 29, 2021
9e24377
fixed issue
veena14cs Jan 29, 2021
5738065
Update StoryProgressTestHelperTest.kt
veena14cs Jan 29, 2021
1df0d7e
Update TopicListControllerTest.kt
veena14cs Jan 29, 2021
b6697fa
Fixed suggested changes
veena14cs Jan 29, 2021
860e8e1
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 29, 2021
804a506
Update StoryProgressTestHelper.kt
veena14cs Jan 29, 2021
834e471
Update StoryProgressTestHelperTest.kt
veena14cs Jan 29, 2021
6b83e09
Update domain/src/main/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 30, 2021
6351f1d
Update TopicListControllerTest.kt
veena14cs Jan 30, 2021
fdc28cc
Merge branch 'promoted-story' of https://github.com/veena14cs/oppia-a…
veena14cs Jan 30, 2021
ba99386
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 30, 2021
357ba9a
Update domain/src/main/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 30, 2021
6093d5e
fixed tests
veena14cs Jan 30, 2021
15004ce
Update TopicListController.kt
veena14cs Jan 30, 2021
0837760
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 30, 2021
cc9b9b5
Fixed itestcases
veena14cs Jan 30, 2021
cac42d1
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 30, 2021
494ed41
Fixing testcases
veena14cs Jan 30, 2021
16e8e6c
reverted file change
veena14cs Jan 30, 2021
629c2d1
Update HomeActivityTest.kt
veena14cs Jan 30, 2021
d6362ab
Update domain/src/test/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 31, 2021
5d0d362
Update domain/src/test/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 31, 2021
c4ed382
Update domain/src/main/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 31, 2021
07d7113
Update TopicListControllerTest.kt
veena14cs Jan 31, 2021
538ca05
Merge branch 'promoted-story' of https://github.com/veena14cs/oppia-a…
veena14cs Jan 31, 2021
72e156a
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 31, 2021
47a4897
Update domain/src/test/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 31, 2021
1e7d32a
Update domain/src/test/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 31, 2021
51a4c09
Update domain/src/main/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 31, 2021
15fa990
Update HomeActivityTest.kt
veena14cs Jan 31, 2021
2cd8a51
Merge branch 'promoted-story' into promoted-story-part-1
veena14cs Jan 31, 2021
663377e
Merge remote-tracking branch 'upstream/develop' into promoted-story-p…
veena14cs Jan 31, 2021
fce0303
Update test_exp_id_4.json
veena14cs Jan 31, 2021
e2651f7
Update ProfileProgressFragmentTest.kt
veena14cs Jan 31, 2021
0c7b6d4
Fixed testcases
veena14cs Jan 31, 2021
4f249ce
Update HomeActivityTest.kt
veena14cs Jan 31, 2021
5508a54
Update HomeActivityTest.kt
veena14cs Jan 31, 2021
e1a3fe8
Update HomeActivityTest.kt
veena14cs Jan 31, 2021
5dd17be
Update PromotedStoryListViewModel.kt
veena14cs Feb 1, 2021
32d4946
Update PromotedStoryListViewModel.kt
veena14cs Feb 1, 2021
dd498d1
Update HomeActivityTest.kt
veena14cs Feb 1, 2021
6e9e708
Update HomeActivityTest.kt
veena14cs Feb 1, 2021
859b1f2
Fixed ordering of topics in testcases
veena14cs Feb 1, 2021
2fd5bfa
Update HomeActivityTest.kt
veena14cs Feb 1, 2021
54fbd7c
Merge remote-tracking branch 'upstream/develop' into promoted-story-p…
veena14cs Feb 1, 2021
cb7c692
Update ProfileProgressFragmentTest.kt
veena14cs Feb 1, 2021
1dba5c2
Update HomeActivityTest.kt
veena14cs Feb 2, 2021
66e99a5
Merge remote-tracking branch 'upstream/develop' into promoted-story-p…
veena14cs Feb 2, 2021
cb5b3e2
Update HomeActivityTest.kt
veena14cs Feb 2, 2021
9d3a89d
Update HomeActivityTest.kt
veena14cs Feb 2, 2021
b031132
Update HomeActivityTest.kt
veena14cs Feb 2, 2021
eb6f39d
Fixed testcases by clearing profile progress
veena14cs Feb 3, 2021
31950e8
Update HomeActivityTest.kt
veena14cs Feb 3, 2021
01286cc
Update HomeActivityTest.kt
veena14cs Feb 3, 2021
09162dd
Merge remote-tracking branch 'upstream/develop' into promoted-story-p…
veena14cs Feb 3, 2021
89200da
reverted profile changes
veena14cs Feb 5, 2021
c25b7de
Added 4th option in Fifth exploration
veena14cs Feb 5, 2021
4de733b
Merge remote-tracking branch 'upstream/develop' into promoted-story-p…
veena14cs Feb 11, 2021
abd8945
fixed tescases
veena14cs Feb 11, 2021
b19f653
Update HomeActivityTest.kt
veena14cs Feb 11, 2021
afaa8b6
Update test_exp_id_4.json
veena14cs Feb 11, 2021
48d132b
Merge remote-tracking branch 'upstream/develop' into promoted-story-p…
veena14cs Feb 12, 2021
c9b4fc2
fixed changes
veena14cs Feb 12, 2021
031b95c
Update HomeActivityTest.kt
veena14cs Feb 12, 2021
26a18f7
Update app/src/sharedTest/java/org/oppia/android/app/home/HomeActivit…
veena14cs Feb 12, 2021
4793341
Update app/src/sharedTest/java/org/oppia/android/app/home/HomeActivit…
veena14cs Feb 12, 2021
9f3eb4c
Update HomeActivityTest.kt
veena14cs Feb 12, 2021
29b731d
Fixed nit
veena14cs Feb 12, 2021
0ccb5e5
Merge branch 'promoted-story-part-1' of https://github.com/veena14cs/…
veena14cs Feb 12, 2021
2269334
Merge remote-tracking branch 'upstream/develop' into promoted-story-p…
veena14cs Feb 12, 2021
a6f342e
Update app/src/sharedTest/java/org/oppia/android/app/home/HomeActivit…
veena14cs Feb 12, 2021
67f5664
Update app/src/sharedTest/java/org/oppia/android/app/home/HomeActivit…
veena14cs Feb 12, 2021
252014a
Update app/src/sharedTest/java/org/oppia/android/app/home/HomeActivit…
veena14cs Feb 12, 2021
353a3a4
Merge remote-tracking branch 'upstream/develop' into promoted-story-p…
veena14cs Feb 12, 2021
45a6b18
Update TopicListController.kt
veena14cs Feb 12, 2021
d42f6c8
Merge branch 'develop' into promoted-story-part-1
BenHenning Feb 13, 2021
d524dac
Merge branch 'develop' into promoted-story-part-1
BenHenning Feb 13, 2021
e5c047b
Merge branch 'develop' into promoted-story-part-1
BenHenning Feb 13, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ VIEW_MODELS_WITH_RESOURCE_IMPORTS = [
"src/main/java/org/oppia/android/app/help/HelpListViewModel.kt",
"src/main/java/org/oppia/android/app/help/faq/FAQListViewModel.kt",
"src/main/java/org/oppia/android/app/home/HomeViewModel.kt",
"src/main/java/org/oppia/android/app/home/topiclist/TopicSummaryViewModel.kt",
jcqli marked this conversation as resolved.
Show resolved Hide resolved
"src/main/java/org/oppia/android/app/home/promotedlist/ComingSoonTopicListViewModel.kt",
jcqli marked this conversation as resolved.
Show resolved Hide resolved
"src/main/java/org/oppia/android/app/home/promotedlist/ComingSoonTopicsViewModel.kt",
"src/main/java/org/oppia/android/app/home/promotedlist/PromotedStoryListViewModel.kt",
"src/main/java/org/oppia/android/app/home/promotedlist/PromotedStoryViewModel.kt",
"src/main/java/org/oppia/android/app/home/topiclist/TopicSummaryViewModel.kt",
Expand Down Expand Up @@ -313,6 +316,7 @@ VIEWS = [
"src/main/java/org/oppia/android/app/customview/interaction/NumericInputInteractionView.kt",
"src/main/java/org/oppia/android/app/customview/interaction/TextInputInteractionView.kt",
"src/main/java/org/oppia/android/app/customview/interaction/RatioInputInteractionView.kt",
"src/main/java/org/oppia/android/app/home/promotedlist/ComingSoonTopicsListView.kt",
rt4914 marked this conversation as resolved.
Show resolved Hide resolved
"src/main/java/org/oppia/android/app/home/promotedlist/PromotedStoryListView.kt",
"src/main/java/org/oppia/android/app/player/state/DragDropSortInteractionView.kt",
"src/main/java/org/oppia/android/app/player/state/ImageRegionSelectionInteractionView.kt",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import androidx.recyclerview.widget.GridLayoutManager
import org.oppia.android.R
import org.oppia.android.app.drawer.KEY_NAVIGATION_PROFILE_ID
import org.oppia.android.app.fragment.FragmentScope
import org.oppia.android.app.home.promotedlist.ComingSoonTopicListViewModel
import org.oppia.android.app.home.promotedlist.PromotedStoryListViewModel
import org.oppia.android.app.home.topiclist.AllTopicsViewModel
import org.oppia.android.app.home.topiclist.TopicSummaryViewModel
import org.oppia.android.app.model.EventLog
import org.oppia.android.app.model.TopicSummary
import org.oppia.android.app.recyclerview.BindableAdapter
import org.oppia.android.databinding.AllTopicsBinding
import org.oppia.android.databinding.ComingSoonTopicListBinding
import org.oppia.android.databinding.HomeFragmentBinding
import org.oppia.android.databinding.PromotedStoryListBinding
import org.oppia.android.databinding.TopicSummaryViewBinding
Expand Down Expand Up @@ -72,7 +74,7 @@ class HomeFragmentPresenter @Inject constructor(
homeLayoutManager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
override fun getSpanSize(position: Int): Int {
return if (position < homeAdapter.itemCount &&
homeAdapter.getItemViewType(position) === ViewType.TOPIC_LIST.ordinal
homeAdapter.getItemViewType(position) == ViewType.TOPIC_LIST.ordinal
anandwana001 marked this conversation as resolved.
Show resolved Hide resolved
) 1
else spanCount
}
Expand All @@ -96,6 +98,7 @@ class HomeFragmentPresenter @Inject constructor(
when (viewModel) {
is WelcomeViewModel -> ViewType.WELCOME_MESSAGE
is PromotedStoryListViewModel -> ViewType.PROMOTED_STORY_LIST
is ComingSoonTopicListViewModel -> ViewType.COMING_SOON_TOPIC_LIST
aggarwalpulkit596 marked this conversation as resolved.
Show resolved Hide resolved
is AllTopicsViewModel -> ViewType.ALL_TOPICS
is TopicSummaryViewModel -> ViewType.TOPIC_LIST
else -> throw IllegalArgumentException("Encountered unexpected view model: $viewModel")
Expand All @@ -113,6 +116,12 @@ class HomeFragmentPresenter @Inject constructor(
setViewModel = PromotedStoryListBinding::setViewModel,
transformViewModel = { it as PromotedStoryListViewModel }
)
.registerViewDataBinder(
viewType = ViewType.COMING_SOON_TOPIC_LIST,
inflateDataBinding = ComingSoonTopicListBinding::inflate,
setViewModel = ComingSoonTopicListBinding::setViewModel,
transformViewModel = { it as ComingSoonTopicListViewModel }
)
.registerViewDataBinder(
viewType = ViewType.ALL_TOPICS,
inflateDataBinding = AllTopicsBinding::inflate,
Expand All @@ -131,6 +140,7 @@ class HomeFragmentPresenter @Inject constructor(
private enum class ViewType {
WELCOME_MESSAGE,
PROMOTED_STORY_LIST,
COMING_SOON_TOPIC_LIST,
ALL_TOPICS,
TOPIC_LIST
}
Expand Down
153 changes: 115 additions & 38 deletions app/src/main/java/org/oppia/android/app/home/HomeViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel
import org.oppia.android.R
import org.oppia.android.app.fragment.FragmentScope
import org.oppia.android.app.home.promotedlist.ComingSoonTopicListViewModel
import org.oppia.android.app.home.promotedlist.ComingSoonTopicsViewModel
import org.oppia.android.app.home.promotedlist.PromotedStoryListViewModel
import org.oppia.android.app.home.promotedlist.PromotedStoryViewModel
import org.oppia.android.app.home.topiclist.AllTopicsViewModel
import org.oppia.android.app.home.topiclist.TopicSummaryClickListener
import org.oppia.android.app.home.topiclist.TopicSummaryViewModel
import org.oppia.android.app.model.OngoingStoryList
import org.oppia.android.app.model.ComingSoonTopicList
import org.oppia.android.app.model.Profile
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.model.PromotedActivityList
import org.oppia.android.app.model.PromotedStoryList
import org.oppia.android.app.model.TopicList
import org.oppia.android.app.viewmodel.ObservableViewModel
import org.oppia.android.domain.profile.ProfileManagementController
Expand All @@ -26,9 +30,12 @@ import org.oppia.android.util.logging.ConsoleLogger
import org.oppia.android.util.parser.StoryHtmlParserEntityType
import org.oppia.android.util.parser.TopicHtmlParserEntityType
import org.oppia.android.util.system.OppiaClock
import java.util.Collections

private const val PROFILE_AND_ONGOING_STORY_COMBINED_PROVIDER_ID = "profile+ongoingStoryList"
private const val HOME_FRAGMENT_COMBINED_PROVIDER_ID = "profile+ongoingStoryList+topicListProvider"
private const val PROFILE_AND_PROMOTED_ACTIVITY_COMBINED_PROVIDER_ID =
"profile+promotedActivityList"
private const val HOME_FRAGMENT_COMBINED_PROVIDER_ID =
"profile+promotedActivityList+topicListProvider"

/** [ViewModel] for layouts in home fragment. */
@FragmentScope
Expand All @@ -45,7 +52,6 @@ class HomeViewModel(
) : ObservableViewModel() {

private val profileId: ProfileId = ProfileId.newBuilder().setInternalId(internalProfileId).build()

private val promotedStoryListLimit = activity.resources.getInteger(
R.integer.promoted_story_list_limit
)
Expand All @@ -54,8 +60,8 @@ class HomeViewModel(
profileManagementController.getProfile(profileId)
}

private val ongoingStoryListSummaryDataProvider: DataProvider<OngoingStoryList> by lazy {
topicListController.getOngoingStoryList(profileId)
private val promotedActivityListSummaryDataProvider: DataProvider<PromotedActivityList> by lazy {
topicListController.getPromotedActivityList(profileId)
}

private val topicListSummaryDataProvider: DataProvider<TopicList> by lazy {
Expand All @@ -67,12 +73,12 @@ class HomeViewModel(
// instances). If any of the data providers are pending or failed, the combined result will also
// be pending or failed.
profileDataProvider.combineWith(
ongoingStoryListSummaryDataProvider,
PROFILE_AND_ONGOING_STORY_COMBINED_PROVIDER_ID
) { profile, ongoingStoryList ->
promotedActivityListSummaryDataProvider,
PROFILE_AND_PROMOTED_ACTIVITY_COMBINED_PROVIDER_ID
) { profile, promotedActivityList ->
listOfNotNull(
computeWelcomeViewModel(profile),
computePromotedStoryListViewModel(ongoingStoryList)
computePromotedActivityListViewModel(promotedActivityList)
)
}.combineWith(
topicListSummaryDataProvider,
Expand Down Expand Up @@ -111,20 +117,39 @@ class HomeViewModel(
}

/**
* Returns a [HomeItemViewModel] corresponding to the promoted stories to be displayed for this learner
* (see [PromotedStoryListViewModel]), or null if this profile does not have any promoted stories.
* Promoted stories are determined by any recent stories started by this profile.
* Returns a [HomeItemViewModel] corresponding to the promoted stories(Recommended, Recently-played and
* Last-played stories)[PromotedStoryListViewModel] and Upcoming topics [ComingSoonTopicListViewModel]
jcqli marked this conversation as resolved.
Show resolved Hide resolved
* to be displayed for this learner or null if this profile does not have any promoted stories.
* Promoted stories are determined by any recent stories last-played stories or suggested stories started by this profile.
*/
private fun computePromotedStoryListViewModel(
ongoingStoryList: OngoingStoryList
private fun computePromotedActivityListViewModel(
promotedActivityList: PromotedActivityList
): HomeItemViewModel? {
val storyViewModelList = computePromotedStoryViewModelList(ongoingStoryList)
return if (storyViewModelList.isNotEmpty()) {
return PromotedStoryListViewModel(
activity,
storyViewModelList
)
} else null
when (promotedActivityList.recommendationTypeCase) {
PromotedActivityList.RecommendationTypeCase.PROMOTED_STORY_LIST -> {
val storyViewModelList = computePromotedStoryViewModelList(
promotedActivityList.promotedStoryList
)
return if (storyViewModelList.isNotEmpty()) {
return PromotedStoryListViewModel(
activity,
storyViewModelList,
promotedActivityList
)
} else null
}
PromotedActivityList.RecommendationTypeCase.COMING_SOON_TOPIC_LIST -> {
val comingSoonTopicsList = computeComingSoonTopicViewModelList(
promotedActivityList.comingSoonTopicList
)
return if (comingSoonTopicsList.isNotEmpty()) {
return ComingSoonTopicListViewModel(
comingSoonTopicsList
)
} else null
}
else -> return null
anandwana001 marked this conversation as resolved.
Show resolved Hide resolved
}
}

/**
Expand All @@ -133,24 +158,76 @@ class HomeViewModel(
* ongoing stories at all.
*/
private fun computePromotedStoryViewModelList(
ongoingStoryList: OngoingStoryList
promotedStoryList: PromotedStoryList
): List<PromotedStoryViewModel> {
val storyList = if (ongoingStoryList.recentStoryCount != 0) {
ongoingStoryList.recentStoryList
} else {
// TODO(#936): Optimise this as part of recommended stories.
ongoingStoryList.olderStoryList
}
return storyList.take(promotedStoryListLimit)
.map { promotedStory ->
PromotedStoryViewModel(
activity,
internalProfileId,
storyList.size,
storyEntityType,
promotedStory
)
with(promotedStoryList) {
val storyList = when {
suggestedStoryCount != 0 -> {
if (recentlyPlayedStoryCount != 0 ||
olderPlayedStoryCount != 0
) {
recentlyPlayedStoryList +
olderPlayedStoryList +
suggestedStoryList
} else {
suggestedStoryList
}
}
recentlyPlayedStoryCount != 0 -> {
recentlyPlayedStoryList
}
else -> {
olderPlayedStoryList
}
}

// Check if at least one story in topic is completed. Prioritize recommended story over completed story topic.
// Use swap function to change recommended and completed story topic position.
storyList.take(promotedStoryListLimit).mapIndexed { completedStoryIndex, promotedStory ->
if (promotedStory.isTopicLearned &&
suggestedStoryCount != 0
) {
if (completedStoryIndex == 0 &&
(recentlyPlayedStoryCount > 1 || olderPlayedStoryCount > 1)
) {
Collections.swap(storyList, completedStoryIndex, 1)
} else {
val swapWithSuggestedListIndex0 =
recentlyPlayedStoryList.size + olderPlayedStoryList.size
Collections.swap(storyList, completedStoryIndex, swapWithSuggestedListIndex0)
}
}
}

return storyList.take(promotedStoryListLimit)
.map { promotedStory ->
PromotedStoryViewModel(
activity,
internalProfileId,
storyList.size,
storyEntityType,
promotedStory
)
}
}
}

/**
* Returns a list of [HomeItemViewModel]s corresponding to [ComingSoonTopicListViewModel] all the upcoming topics available in future and to be
* displayed for this profile (see [ComingSoonTopicsViewModel]), or an empty list if the profile does not have any
* ongoing stories at all.
*/
private fun computeComingSoonTopicViewModelList(
comingSoonTopicList: ComingSoonTopicList
): List<ComingSoonTopicsViewModel> {
return comingSoonTopicList.upcomingTopicList.map { topicSummary ->
ComingSoonTopicsViewModel(
activity,
topicSummary,
topicEntityType,
comingSoonTopicList
)
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.oppia.android.app.home.promotedlist

import androidx.lifecycle.ViewModel
import org.oppia.android.app.home.HomeItemViewModel
import java.util.Objects

/** [ViewModel] for the upcoming topic list displayed in [HomeFragment]. */
class ComingSoonTopicListViewModel(
val comingSoonTopicList: List<ComingSoonTopicsViewModel>
) : HomeItemViewModel() {
// Overriding equals is needed so that DataProvider combine functions used in the HomeViewModel
// will only rebind when the actual data in the data list changes, rather than when the ViewModel
// object changes.
override fun equals(other: Any?): Boolean {
return other is ComingSoonTopicListViewModel &&
other.comingSoonTopicList == this.comingSoonTopicList
}

override fun hashCode() = Objects.hash(comingSoonTopicList)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package org.oppia.android.app.home.promotedlist

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.RecyclerView
import org.oppia.android.app.recyclerview.BindableAdapter
import org.oppia.android.app.recyclerview.StartSnapHelper
import org.oppia.android.app.shim.ViewBindingShim
import org.oppia.android.app.shim.ViewComponentFactory
import org.oppia.android.util.logging.ConsoleLogger
import javax.inject.Inject

private const val COMING_SOON_TOPIC_LIST_VIEW_TAG = "ComingSoonTopicsListView"

/**
* A custom [RecyclerView] for displaying a variable list of Upcoming topics that snaps to
* a fixed position when being scrolled.
*/
class ComingSoonTopicsListView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : RecyclerView(context, attrs, defStyleAttr) {

@Inject
lateinit var bindingInterface: ViewBindingShim

@Inject
lateinit var logger: ConsoleLogger

override fun onAttachedToWindow() {
super.onAttachedToWindow()

(FragmentManager.findFragment<Fragment>(this) as ViewComponentFactory)
.createViewComponent(this).inject(this)

// The StartSnapHelper is used to snap between items rather than smooth scrolling, so that
// the item is completely visible in [HomeFragment] as soon as learner lifts the finger
// after scrolling.
val snapHelper = StartSnapHelper()
aggarwalpulkit596 marked this conversation as resolved.
Show resolved Hide resolved
onFlingListener = null
snapHelper.attachToRecyclerView(this)
}

/**
* Sets the list of coming soon topics that this view shows to the learner.
*
* @param newDataList the new list of topics to present
*/
fun setComingSoonTopicList(newDataList: List<ComingSoonTopicsViewModel>?) {
// To reliably bind data only after the adapter is created, we manually set the data so we can first
// check for the adapter; when using an existing [RecyclerViewBindingAdapter] there is no reliable
// way to check that the adapter is created.
// This ensures that the adapter will only be created once and correctly rebinds the data.
// For more context: https://github.com/oppia/oppia-android/pull/2246#pullrequestreview-565964462
if (adapter == null) {
adapter = createAdapter()
}
if (newDataList == null) {
logger.w(COMING_SOON_TOPIC_LIST_VIEW_TAG, "Failed to resolve upcoming topic list data")
} else {
(adapter as BindableAdapter<*>).setDataUnchecked(newDataList)
}
}

private fun createAdapter(): BindableAdapter<ComingSoonTopicsViewModel> {
return BindableAdapter.SingleTypeBuilder.newBuilder<ComingSoonTopicsViewModel>()
.registerViewBinder(
inflateView = { parent ->
bindingInterface.provideComingSoonTopicViewInflatedView(
LayoutInflater.from(parent.context),
parent,
attachToParent = false
)
},
bindView = { view, viewModel ->
bindingInterface.provideComingSoonTopicsViewViewModel(
view,
viewModel
)
}
).build()
}
}
Loading