From 247e81ba00ba411f484b26d228d5fb0e0008383c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Borcz?= Date: Sat, 8 Dec 2018 12:27:00 +0100 Subject: [PATCH] Show full subject name on expand (#193) --- .../grade/details/GradeDetailsHeader.kt | 16 +++++++--- .../main/res/layout/header_grade_details.xml | 32 +++---------------- 2 files changed, 15 insertions(+), 33 deletions(-) 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"> - - - -