-
Notifications
You must be signed in to change notification settings - Fork 503
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Added story-progress and test cases * RV inside RV * Test case modified * LV implementation * Finalised RecyclerView * Visbility contol * Play exploration connected * Single list item expansaion * Initial test cases * Nit change * Test cases added * Configuration change support * Nit changes * Nit changes * Nit changes * Nit changes * Added issue number * Nit change
- Loading branch information
Showing
14 changed files
with
497 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
app/src/main/java/org/oppia/app/topic/play/ChapterSummaryAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.oppia.app.topic.play | ||
|
||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import org.oppia.app.R | ||
import androidx.databinding.DataBindingUtil | ||
import android.view.LayoutInflater | ||
import org.oppia.app.databinding.PlayChapterViewBinding | ||
import org.oppia.app.model.ChapterSummary | ||
|
||
// TODO(#216): Make use of generic data-binding-enabled RecyclerView adapter. | ||
|
||
/** Adapter to bind ChapterSummary to [RecyclerView] inside [TopicPlayFragment]. */ | ||
class ChapterSummaryAdapter( | ||
private val chapterList: List<ChapterSummary>, | ||
private val chapterSummarySelector: ChapterSummarySelector | ||
) : | ||
RecyclerView.Adapter<ChapterSummaryAdapter.ChapterSummaryViewHolder>() { | ||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ChapterSummaryViewHolder { | ||
val chapterSummaryListItemBinding = DataBindingUtil.inflate<PlayChapterViewBinding>( | ||
LayoutInflater.from(parent.context), | ||
R.layout.play_chapter_view, parent, | ||
/* attachToRoot= */ false | ||
) | ||
return ChapterSummaryViewHolder(chapterSummaryListItemBinding) | ||
} | ||
|
||
override fun getItemCount(): Int { | ||
return chapterList.size | ||
} | ||
|
||
override fun onBindViewHolder(chapterSummaryViewHolder: ChapterSummaryViewHolder, position: Int) { | ||
chapterSummaryViewHolder.bind(chapterList[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. | ||
binding.chapterSummary = chapterSummary | ||
binding.chapterName.setOnClickListener { | ||
chapterSummarySelector.selectChapterSummary(chapterSummary) | ||
} | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
app/src/main/java/org/oppia/app/topic/play/ChapterSummarySelector.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.oppia.app.topic.play | ||
|
||
import org.oppia.app.model.ChapterSummary | ||
|
||
/** Interface to transfer the selected chapter summary to [TopicPlayFragmentPresenter]. */ | ||
interface ChapterSummarySelector { | ||
fun selectChapterSummary(chapterSummary: ChapterSummary) | ||
} |
9 changes: 9 additions & 0 deletions
9
app/src/main/java/org/oppia/app/topic/play/ExpandedChapterListIndexListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.oppia.app.topic.play | ||
|
||
/** | ||
* Interface to keep track of story-index for which ChapterList is visible/expanded. | ||
* This mainly helps to maintain the state during configuration change. | ||
*/ | ||
interface ExpandedChapterListIndexListener { | ||
fun onExpandListIconClicked(index: Int?) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<vector xmlns:android="http:https://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:tint="#019489" | ||
android:viewportWidth="24.0" | ||
android:viewportHeight="24.0"> | ||
<path | ||
android:fillColor="#FF000000" | ||
android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z" /> | ||
</vector> |
Oops, something went wrong.