From e13b7840e6546bf4ba130e08dd309a40cac46986 Mon Sep 17 00:00:00 2001 From: Rajat Talesra Date: Thu, 14 Nov 2019 15:21:41 +0530 Subject: [PATCH] Fix part of #140: Hifi topic play (#339) * Title and recyclerview fix * Inital UI implementation * Icons checks * Nit changes * Fix chapter min height * Final accessibility scanner test * Nit suggested changes * Nit change * Updated click listeners * Final changes * Changes on ChapterView --- .../app/topic/play/ChapterSummaryAdapter.kt | 8 +- .../app/topic/play/StorySummaryAdapter.kt | 2 +- app/src/main/res/drawable/dashed_divider.xml | 10 + .../ic_arrow_drop_down_black_24dp.xml | 9 + .../drawable/ic_arrow_drop_up_black_24dp.xml | 9 + app/src/main/res/drawable/ic_check_24dp.xml | 2 +- app/src/main/res/layout/play_chapter_view.xml | 60 +++-- .../main/res/layout/topic_play_fragment.xml | 3 + .../res/layout/topic_play_story_summary.xml | 215 +++++++++++------- app/src/main/res/layout/topic_play_title.xml | 3 +- app/src/main/res/values/colors.xml | 3 + app/src/main/res/values/strings.xml | 4 + 12 files changed, 219 insertions(+), 109 deletions(-) create mode 100644 app/src/main/res/drawable/dashed_divider.xml create mode 100644 app/src/main/res/drawable/ic_arrow_drop_down_black_24dp.xml create mode 100644 app/src/main/res/drawable/ic_arrow_drop_up_black_24dp.xml diff --git a/app/src/main/java/org/oppia/app/topic/play/ChapterSummaryAdapter.kt b/app/src/main/java/org/oppia/app/topic/play/ChapterSummaryAdapter.kt index c9f1322da9e..9818fe94dba 100755 --- a/app/src/main/java/org/oppia/app/topic/play/ChapterSummaryAdapter.kt +++ b/app/src/main/java/org/oppia/app/topic/play/ChapterSummaryAdapter.kt @@ -30,15 +30,15 @@ class ChapterSummaryAdapter( } override fun onBindViewHolder(chapterSummaryViewHolder: ChapterSummaryViewHolder, position: Int) { - chapterSummaryViewHolder.bind(chapterList[position]) + chapterSummaryViewHolder.bind(chapterList[position], position) } inner class ChapterSummaryViewHolder(private val binding: PlayChapterViewBinding) : RecyclerView.ViewHolder(binding.root) { - internal fun bind(chapterSummary: ChapterSummary) { - // TODO(#286): Fix the flickering behaviour of chapter-completion image. + internal fun bind(chapterSummary: ChapterSummary, position: Int) { binding.chapterSummary = chapterSummary - binding.chapterName.setOnClickListener { + binding.index = position + binding.chapterContainer.setOnClickListener { chapterSummarySelector.selectChapterSummary(chapterSummary) } } diff --git a/app/src/main/java/org/oppia/app/topic/play/StorySummaryAdapter.kt b/app/src/main/java/org/oppia/app/topic/play/StorySummaryAdapter.kt index 39e9b37d982..934cbb4585f 100644 --- a/app/src/main/java/org/oppia/app/topic/play/StorySummaryAdapter.kt +++ b/app/src/main/java/org/oppia/app/topic/play/StorySummaryAdapter.kt @@ -110,7 +110,7 @@ class StorySummaryAdapter( val chapterList = storySummaryViewModel.storySummary.chapterList binding.chapterRecyclerView.adapter = ChapterSummaryAdapter(chapterList, chapterSummarySelector) - binding.chapterListViewControl.setOnClickListener { + binding.expandListIcon.setOnClickListener { val previousIndex: Int? = currentExpandedChapterListIndex currentExpandedChapterListIndex = if (currentExpandedChapterListIndex != null && currentExpandedChapterListIndex == position) { diff --git a/app/src/main/res/drawable/dashed_divider.xml b/app/src/main/res/drawable/dashed_divider.xml new file mode 100644 index 00000000000..77ea21729cd --- /dev/null +++ b/app/src/main/res/drawable/dashed_divider.xml @@ -0,0 +1,10 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_arrow_drop_down_black_24dp.xml b/app/src/main/res/drawable/ic_arrow_drop_down_black_24dp.xml new file mode 100644 index 00000000000..62b27ef0b95 --- /dev/null +++ b/app/src/main/res/drawable/ic_arrow_drop_down_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_arrow_drop_up_black_24dp.xml b/app/src/main/res/drawable/ic_arrow_drop_up_black_24dp.xml new file mode 100644 index 00000000000..b1442ce1595 --- /dev/null +++ b/app/src/main/res/drawable/ic_arrow_drop_up_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_check_24dp.xml b/app/src/main/res/drawable/ic_check_24dp.xml index 56ceef4b9d7..e80d26ed12f 100755 --- a/app/src/main/res/drawable/ic_check_24dp.xml +++ b/app/src/main/res/drawable/ic_check_24dp.xml @@ -1,7 +1,7 @@ - + @@ -8,43 +7,56 @@ + + - + android:clickable="@{chapterSummary.chapterPlayState != ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES ? true: false}" + android:minHeight="48dp" + android:orientation="horizontal" + android:paddingStart="4dp" + android:paddingTop="8dp" + android:paddingEnd="4dp" + android:paddingBottom="8dp"> + + + android:layout_marginStart="4dp" + android:fontFamily="sans-serif" + android:text="@{String.format(@string/topic_play_chapter_index, (index + 1))}" + android:textColor="@{chapterSummary.chapterPlayState != ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES ? @color/oppiaPrimaryText: @color/oppiaPrimaryText30}" + android:textSize="12sp" /> - + android:textColor="@{chapterSummary.chapterPlayState != ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES ? @color/oppiaPrimaryText: @color/oppiaPrimaryText30}" + android:textSize="12sp" /> + diff --git a/app/src/main/res/layout/topic_play_fragment.xml b/app/src/main/res/layout/topic_play_fragment.xml index 4f2680967d8..101ac9dd1b8 100644 --- a/app/src/main/res/layout/topic_play_fragment.xml +++ b/app/src/main/res/layout/topic_play_fragment.xml @@ -7,11 +7,14 @@ android:layout_height="match_parent" android:background="@color/oppiaBackground"> + - - - - - - - - - - - - - - - - + + - + android:orientation="vertical"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/topic_play_title.xml b/app/src/main/res/layout/topic_play_title.xml index 47265a19c85..ee5888eec72 100644 --- a/app/src/main/res/layout/topic_play_title.xml +++ b/app/src/main/res/layout/topic_play_title.xml @@ -16,12 +16,11 @@ #2D4A9D #333333 + #4D333333 #00645C #666666 #F0FFFF @@ -24,11 +25,13 @@ #999999 #61999999 #DDDDDD + #80707070 #FFFFFF #CCFFFFFF #B3FFFFFF #000000 + #F9F9F9 @color/oppiaDarkBlue diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5ef9f798a10..3eb68633023 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -35,6 +35,7 @@ Review Topic %s\%% + %s. Chapter %s: %s Chapter %s: %s is completed. Write fraction here. @@ -52,6 +53,9 @@ Continue playing Topic Downloaded Downloaded + In Progress + Completed + Show/Hide chapter list of %s 1 Chapter