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 #4602, #4449: Modify the design of the chapter list in lessons tab #4605

Closed
Closed
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
4c1213b
add locked lesson view, modify completed lesson view
JishnuGoyal Jul 9, 2022
e1aa0ba
add borders, not started chapter view, recycler multi adapter
JishnuGoyal Jul 26, 2022
707958e
add divider item decoration
JishnuGoyal Jul 27, 2022
3b749a6
commit before checkout -- all design modified
JishnuGoyal Aug 1, 2022
61f1db7
add divider item decoration grey color
JishnuGoyal Aug 2, 2022
128591d
modify chapter recycler items to have 0 margins
JishnuGoyal Aug 2, 2022
959d218
remove unused lines
JishnuGoyal Aug 2, 2022
0427668
add in-progress chapter view item
JishnuGoyal Aug 17, 2022
c7de108
use frame layout to make dotted line thinner
JishnuGoyal Aug 20, 2022
fa90e64
lint
JishnuGoyal Aug 25, 2022
859bd06
remove unused resources and code analysis
JishnuGoyal Aug 25, 2022
1b3c0d2
lint
JishnuGoyal Aug 25, 2022
33a4a24
merge with develop + resolve conflicts
JishnuGoyal Aug 25, 2022
34fbb30
rename file to more describing name
JishnuGoyal Aug 25, 2022
4431361
add tests and correct some errors
JishnuGoyal Aug 26, 2022
c603c39
suggested changes + fix some problems
JishnuGoyal Aug 26, 2022
0de1122
rename resources
JishnuGoyal Aug 26, 2022
205e98c
lint
JishnuGoyal Aug 26, 2022
63ea836
lint
JishnuGoyal Aug 26, 2022
d50f858
add missing eof
JishnuGoyal Aug 26, 2022
454d22e
add private identifier to enum
JishnuGoyal Aug 30, 2022
7989a87
remove 0dp margin
JishnuGoyal Aug 30, 2022
83e0bbe
commit requested changes
JishnuGoyal Aug 30, 2022
dd87e1a
add framelayout to sw600dp-land for tablets + lint fix for file
JishnuGoyal Aug 30, 2022
3fd2638
rename resources
JishnuGoyal Aug 30, 2022
d3cab61
lint
JishnuGoyal Aug 30, 2022
39ef109
switch to constraint layout
JishnuGoyal Aug 30, 2022
beca4d3
remove the "period sign" in chapter index.
JishnuGoyal Aug 31, 2022
c87e11a
Merge branch 'develop' into modify_chapter_list_design
JishnuGoyal Sep 3, 2022
7c85b20
add field to topicsummary proto, and complete the func for opening ch…
JishnuGoyal Sep 3, 2022
54a3202
lint
JishnuGoyal Sep 3, 2022
df353fc
Merge remote-tracking branch 'upstream/develop' into modify_chapter_l…
JishnuGoyal Sep 6, 2022
7be8ec0
update test
JishnuGoyal Sep 6, 2022
28da385
Merge branch 'develop' into modify_chapter_list_design
JishnuGoyal Sep 7, 2022
94a1b6c
update logic
JishnuGoyal Sep 7, 2022
72d11ed
Merge branch 'develop' into modify_chapter_list_design
JishnuGoyal Sep 8, 2022
d770da7
merge with develop and fix minor bug
JishnuGoyal Sep 8, 2022
1ce48e9
these two tests together validate that chapter list is expanded by de…
JishnuGoyal Sep 9, 2022
126bde4
lint
JishnuGoyal Sep 11, 2022
4cbb363
ci fail check
JishnuGoyal Sep 11, 2022
790aa18
nits
JishnuGoyal Sep 12, 2022
958d27d
add suggested changes
JishnuGoyal Sep 17, 2022
72132f4
remove duplicate entry
JishnuGoyal Sep 22, 2022
fa7f177
Merge commit 'e91de5d' into reponse_to_modify_pr_reversion
JishnuGoyal Sep 22, 2022
ae85509
remove duplicate entry
JishnuGoyal Sep 22, 2022
cfaccf5
Merge branch 'develop' into reponse_to_modify_pr_reversion
JishnuGoyal Sep 22, 2022
cd11937
merge jishnu's changes
JishnuGoyal Sep 24, 2022
970d21f
remove duplicate entry
JishnuGoyal Sep 24, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class HomeFragmentPresenter @Inject constructor(
private val dateTimeUtil: DateTimeUtil,
private val translationController: TranslationController
) {
private val routeToTopicListener = activity as RouteToTopicListener
private val routeToTopicPlayStoryListener = activity as RouteToTopicPlayStoryListener
private lateinit var binding: HomeFragmentBinding
private var internalProfileId: Int = -1

Expand Down Expand Up @@ -149,7 +149,11 @@ class HomeFragmentPresenter @Inject constructor(
}

fun onTopicSummaryClicked(topicSummary: TopicSummary) {
routeToTopicListener.routeToTopic(internalProfileId, topicSummary.topicId)
routeToTopicPlayStoryListener.routeToTopicPlayStory(
internalProfileId,
topicSummary.topicId,
topicSummary.firstStoryId
)
}

private fun logHomeActivityEvent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import org.oppia.android.app.model.StorySummary
import org.oppia.android.app.recyclerview.BindableAdapter
import org.oppia.android.app.topic.RouteToResumeLessonListener
import org.oppia.android.app.topic.RouteToStoryListener
import org.oppia.android.databinding.LessonsChapterViewBinding
import org.oppia.android.databinding.LessonsCompletedChapterViewBinding
import org.oppia.android.databinding.LessonsInProgressChapterViewBinding
import org.oppia.android.databinding.LessonsLockedChapterViewBinding
import org.oppia.android.databinding.LessonsNotStartedChapterViewBinding
import org.oppia.android.databinding.TopicLessonsFragmentBinding
import org.oppia.android.databinding.TopicLessonsStorySummaryBinding
import org.oppia.android.databinding.TopicLessonsTitleBinding
Expand Down Expand Up @@ -224,12 +227,50 @@ class TopicLessonsFragmentPresenter @Inject constructor(
}

private fun createChapterRecyclerViewAdapter(): BindableAdapter<ChapterSummaryViewModel> {
return BindableAdapter.SingleTypeBuilder
.newBuilder<ChapterSummaryViewModel>()
.registerViewDataBinderWithSameModelType(
inflateDataBinding = LessonsChapterViewBinding::inflate,
setViewModel = LessonsChapterViewBinding::setViewModel
).build()
return BindableAdapter.MultiTypeBuilder
.newBuilder<ChapterSummaryViewModel, ChapterViewType> { viewModel ->
when (viewModel.chapterPlayState) {
ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES -> ChapterViewType.CHAPTER_LOCKED
ChapterPlayState.COMPLETED -> ChapterViewType.CHAPTER_COMPLETED
ChapterPlayState.IN_PROGRESS_SAVED, ChapterPlayState.IN_PROGRESS_NOT_SAVED,
ChapterPlayState.STARTED_NOT_COMPLETED, ChapterPlayState.COMPLETION_STATUS_UNSPECIFIED
-> ChapterViewType.CHAPTER_IN_PROGRESS
ChapterPlayState.NOT_STARTED -> ChapterViewType.CHAPTER_NOT_STARTED
ChapterPlayState.UNRECOGNIZED -> throw IllegalArgumentException("Play state unknown")
}
}
.registerViewDataBinder(
viewType = ChapterViewType.CHAPTER_LOCKED,
inflateDataBinding = LessonsLockedChapterViewBinding::inflate,
setViewModel = LessonsLockedChapterViewBinding::setViewModel,
transformViewModel = { it }
)
.registerViewDataBinder(
viewType = ChapterViewType.CHAPTER_COMPLETED,
inflateDataBinding = LessonsCompletedChapterViewBinding::inflate,
setViewModel = LessonsCompletedChapterViewBinding::setViewModel,
transformViewModel = { it }
)
.registerViewDataBinder(
viewType = ChapterViewType.CHAPTER_NOT_STARTED,
inflateDataBinding = LessonsNotStartedChapterViewBinding::inflate,
setViewModel = LessonsNotStartedChapterViewBinding::setViewModel,
transformViewModel = { it }
)
.registerViewDataBinder(
viewType = ChapterViewType.CHAPTER_IN_PROGRESS,
inflateDataBinding = LessonsInProgressChapterViewBinding::inflate,
setViewModel = LessonsInProgressChapterViewBinding::setViewModel,
transformViewModel = { it }
)
.build()
}

private enum class ChapterViewType {
CHAPTER_NOT_STARTED,
CHAPTER_COMPLETED,
CHAPTER_LOCKED,
CHAPTER_IN_PROGRESS
}

fun storySummaryClicked(storySummary: StorySummary) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="4dp"
android:color="@color/color_def_bright_green" />
<solid android:color="@color/color_def_oppia_green" />
</shape>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:color="@color/color_def_bright_green" android:width="4dp"/>
<solid android:color="@color/color_def_white"/>
</shape>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/color_def_accessible_light_grey_2" />
<size android:height="1dp" />
</shape>
13 changes: 4 additions & 9 deletions app/src/main/res/drawable/ic_baseline_lock_24.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="80dp"
android:height="80dp"
android:tint="#FFFFFF"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM12,17c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2zM15.1,8L8.9,8L8.9,6c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2z" />
<vector android:autoMirrored="true" android:height="24dp"
android:tint="#FFFFFF" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFFFFF" android:pathData="M18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM12,17c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2zM15.1,8L8.9,8L8.9,6c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2z"/>
</vector>
8 changes: 4 additions & 4 deletions app/src/main/res/drawable/ic_pending_24dp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF333333"
android:fillColor="#FFFFFF"
android:pathData="M12,2C6.48,2 2,6.48 2,12c0,5.52 4.48,10 10,10s10,-4.48 10,-10C22,6.48 17.52,2 12,2zM12,20c-4.42,0 -8,-3.58 -8,-8c0,-4.42 3.58,-8 8,-8s8,3.58 8,8C20,16.42 16.42,20 12,20z" />
<path
android:fillColor="#FF333333"
android:fillColor="#FFFFFF"
android:pathData="M7,12m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0" />
<path
android:fillColor="#FF333333"
android:fillColor="#FFFFFF"
android:pathData="M12,12m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0" />
<path
android:fillColor="#FF333333"
android:fillColor="#FFFFFF"
android:pathData="M17,12m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0" />
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:gravity="center"
android:contentDescription="@{viewModel.computeProgressContainerContentDescription()}"
android:gravity="center"
android:orientation="vertical">

<FrameLayout
Expand Down Expand Up @@ -141,37 +141,37 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:contentDescription="@{isListExpanded ? @string/hide_chapter_list : @string/show_chapter_list}"
app:srcCompat="@drawable/ic_arrow_drop_down_black_24dp"
app:isRotationAnimationClockwise="@{isListExpanded}"
app:rotationAnimationAngle="@{180f}" />
app:rotationAnimationAngle="@{180f}"
app:srcCompat="@drawable/ic_arrow_drop_down_black_24dp" />
</FrameLayout>
</LinearLayout>
</LinearLayout>

<LinearLayout
<!-- FrameLayout is used here instead of LinearLayout to properly adjust the spacing of the
dashed divider by allowing the divider to render slightly on top of the container. -->
<FrameLayout
android:id="@+id/chapter_list_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_def_white_light"
android:orientation="vertical"
android:visibility="@{isListExpanded? View.VISIBLE : View.GONE}">

<View
android:id="@+id/topic_play_story_dashed_line_view"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/dashed_divider" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/chapter_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_marginTop="2dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:list="@{viewModel.chapterSummaryItemList}" />
</LinearLayout>

<View
android:id="@+id/topic_play_story_dashed_line_view"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/dashed_divider" />
</FrameLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</FrameLayout>
Expand Down
64 changes: 0 additions & 64 deletions app/src/main/res/layout/lessons_chapter_view.xml

This file was deleted.

70 changes: 70 additions & 0 deletions app/src/main/res/layout/lessons_completed_chapter_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<data>

<import type="android.view.View" />

<import type="org.oppia.android.app.model.ChapterPlayState" />

<variable
name="viewModel"
type="org.oppia.android.app.topic.lessons.ChapterSummaryViewModel" />
</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/lessons_completed_chapter_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="@{() -> viewModel.onClick(viewModel.explorationId)}"
android:orientation="vertical">

<TextView
android:id="@+id/chapter_index"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@color/color_def_oppia_green"
android:fontFamily="sans-serif"
android:gravity="center"
android:importantForAccessibility="@{viewModel.chapterPlayState != ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES ? View.IMPORTANT_FOR_ACCESSIBILITY_YES : View.IMPORTANT_FOR_ACCESSIBILITY_NO}"
android:minWidth="60dp"
android:minHeight="48dp"
android:paddingStart="8dp"
android:paddingTop="12dp"
android:paddingEnd="8dp"
android:paddingBottom="12dp"
android:text="@{viewModel.computePlayChapterIndexText()}"
android:textColor="@color/color_def_white"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/chapter_name"
style="@style/TextViewStart"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/color_def_light_green"
android:fontFamily="sans-serif"
android:gravity="center|start"
android:importantForAccessibility="@{viewModel.chapterPlayState != ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES ? View.IMPORTANT_FOR_ACCESSIBILITY_YES : View.IMPORTANT_FOR_ACCESSIBILITY_NO}"
android:minHeight="48dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:text="@{viewModel.chapterTitle}"
android:textColor="@{viewModel.chapterPlayState != ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES ? @color/oppia_primary_text : @color/oppia_primary_text_30}"
android:textSize="14sp"
app:layout_constraintBottom_toTopOf="@id/divider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/chapter_index"
app:layout_constraintTop_toTopOf="parent" />

<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@drawable/grey_recycler_view_item_decoration_divider"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
Loading