diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsHeader.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsHeader.kt index 8d8cac8f3..5dec00a9f 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsHeader.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsHeader.kt @@ -31,11 +31,12 @@ class GradeDetailsHeader( override fun bindViewHolder(adapter: FlexibleAdapter>?, holder: ViewHolder, position: Int, payloads: MutableList?) { holder.run { - gradeHeaderSubject.text = subject + gradeHeaderSubject.apply { + text = subject + maxLines = if (isExpanded) 2 else 1 + } gradeHeaderAverage.text = average gradeHeaderNumber.text = number - gradeHeaderPredicted.visibility = GONE - gradeHeaderFinal.visibility = GONE gradeHeaderNote.visibility = if (newGrades > 0) VISIBLE else GONE isViewExpandable = isExpandable @@ -71,11 +72,16 @@ class GradeDetailsHeader( contentView.setOnClickListener(this) } + override val containerView: View + get() = contentView + override fun isViewCollapsibleOnClick() = isViewExpandable override fun isViewExpandableOnClick() = isViewExpandable - override val containerView: View - get() = contentView + override fun onClick(view: View?) { + super.onClick(view) + mAdapter.getItem(adapterPosition)?.let { mAdapter.updateItem(it) } + } } } diff --git a/app/src/main/res/layout/header_grade_details.xml b/app/src/main/res/layout/header_grade_details.xml index 77e5a783a..f92aec62f 100644 --- a/app/src/main/res/layout/header_grade_details.xml +++ b/app/src/main/res/layout/header_grade_details.xml @@ -5,10 +5,10 @@ android:layout_height="wrap_content" android:background="@drawable/ic_all_divider" android:foreground="?attr/selectableItemBackgroundBorderless" - android:paddingBottom="10dp" android:paddingLeft="16dp" + android:paddingTop="10dp" android:paddingRight="16dp" - android:paddingTop="10dp"> + android:paddingBottom="10dp"> - - - -