Skip to content

Commit

Permalink
Remove stepQuizDescription for code quizes
Browse files Browse the repository at this point in the history
  • Loading branch information
XanderZhu committed Sep 27, 2023
1 parent 1512307 commit 3e1e99c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ru.nobird.android.view.base.ui.delegate.ViewStateDelegate
object StepQuizViewStateDelegateFactory {
fun create(
fragmentStepQuizBinding: FragmentStepQuizBinding,
descriptionBinding: LayoutStepQuizDescriptionBinding,
descriptionBinding: LayoutStepQuizDescriptionBinding?,
skeletonView: View,
vararg quizViews: View
): ViewStateDelegate<StepQuizFeature.StepQuizState> =
Expand All @@ -20,20 +20,26 @@ object StepQuizViewStateDelegateFactory {
fragmentStepQuizBinding.stepQuizFeedbackBlocks.root
)
addState<StepQuizFeature.StepQuizState.Loading>(
skeletonView,
descriptionBinding.stepQuizDescriptionSkeleton
*listOfNotNull(
skeletonView,
descriptionBinding?.stepQuizDescriptionSkeleton
).toTypedArray()
)
addState<StepQuizFeature.StepQuizState.AttemptLoading>(
skeletonView,
descriptionBinding.stepQuizDescriptionSkeleton
*listOfNotNull(
skeletonView,
descriptionBinding?.stepQuizDescriptionSkeleton
).toTypedArray()
)
addState<StepQuizFeature.StepQuizState.AttemptLoaded>(
fragmentStepQuizBinding.stepQuizFeedbackBlocks.root,
descriptionBinding.stepQuizDescription,
fragmentStepQuizBinding.stepQuizButtons.stepQuizSubmitButton,
fragmentStepQuizBinding.stepQuizStatistics,
fragmentStepQuizBinding.stepQuizProblemsLimit.root,
*quizViews
*listOfNotNull(
fragmentStepQuizBinding.stepQuizFeedbackBlocks.root,
descriptionBinding?.stepQuizDescription,
fragmentStepQuizBinding.stepQuizButtons.stepQuizSubmitButton,
fragmentStepQuizBinding.stepQuizStatistics,
fragmentStepQuizBinding.stepQuizProblemsLimit.root,
*quizViews
).toTypedArray()
)
addState<StepQuizFeature.StepQuizState.NetworkError>(fragmentStepQuizBinding.stepQuizNetworkError.root)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ abstract class DefaultStepQuizFragment :

protected abstract val quizViews: Array<View>
protected abstract val skeletonView: View
protected abstract val descriptionBinding: LayoutStepQuizDescriptionBinding
protected abstract val descriptionBinding: LayoutStepQuizDescriptionBinding?

protected var step: Step by argument(serializer = Step.serializer())
protected var stepRoute: StepRoute by argument(serializer = StepRoute.serializer())
Expand Down Expand Up @@ -371,7 +371,7 @@ abstract class DefaultStepQuizFragment :
}

private fun renderAttemptLoaded(state: StepQuizFeature.StepQuizState.AttemptLoaded) {
descriptionBinding.stepQuizDescription.text =
descriptionBinding?.stepQuizDescription?.text =
stepQuizTitleMapper?.getStepQuizTitle(
blockName = step.block.name,
isMultipleChoice = state.attempt.dataset?.isMultipleChoice,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ class CodeStepQuizFragment :
override val skeletonView: View
get() = binding.stepQuizCodeSkeleton.root

override val descriptionBinding: LayoutStepQuizDescriptionBinding
get() = binding.codeStepDescription
override val descriptionBinding: LayoutStepQuizDescriptionBinding? = null

override fun createStepView(layoutInflater: LayoutInflater, parent: ViewGroup): View {
val binding = LayoutStepQuizCodeBinding.inflate(layoutInflater, parent, false).also {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="@layout/layout_step_quiz_code_details"
android:layout_marginBottom="20dp"
android:layout_marginBottom="16dp"
/>

<include
android:id="@+id/codeStepDescription"
layout="@layout/layout_step_quiz_description"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginHorizontal="20dp"
android:layout_marginBottom="20dp"/>

<include layout="@layout/view_divider_vertical" />

<org.hyperskill.app.android.code.view.widget.CodeEditorLayout
Expand Down

0 comments on commit 3e1e99c

Please sign in to comment.