1
0
mirror of https://github.com/wulkanowy/wulkanowy.git synced 2024-11-23 22:56:23 -06:00

Show full subject name on expand (#193)

This commit is contained in:
Rafał Borcz 2018-12-08 12:27:00 +01:00 committed by Mikołaj Pich
parent 6fd70a0194
commit 247e81ba00
2 changed files with 15 additions and 33 deletions

View File

@ -31,11 +31,12 @@ class GradeDetailsHeader(
override fun bindViewHolder(adapter: FlexibleAdapter<IFlexible<*>>?, holder: ViewHolder, position: Int, payloads: MutableList<Any>?) {
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) }
}
}
}

View File

@ -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">
<TextView
android:id="@+id/gradeHeaderSubject"
@ -16,8 +16,8 @@
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:layout_marginRight="20dp"
android:layout_toLeftOf="@id/gradeHeaderNote"
android:layout_toStartOf="@id/gradeHeaderNote"
android:layout_toLeftOf="@id/gradeHeaderNote"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/app_name"
@ -38,8 +38,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/gradeHeaderSubject"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_toEndOf="@+id/gradeHeaderAverage"
android:layout_toRightOf="@+id/gradeHeaderAverage"
@ -47,30 +47,6 @@
android:textColor="?android:attr/android:textColorSecondary"
android:textSize="12sp" />
<TextView
android:id="@+id/gradeHeaderPredicted"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/gradeHeaderAverage"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:text="@string/grade_predicted"
android:textColor="?android:attr/android:textColorSecondary"
android:textSize="12sp" />
<TextView
android:id="@+id/gradeHeaderFinal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/gradeHeaderAverage"
android:layout_marginTop="5dp"
android:layout_toEndOf="@+id/gradeHeaderPredicted"
android:layout_toRightOf="@+id/gradeHeaderPredicted"
android:text="@string/grade_final"
android:textColor="?android:attr/android:textColorSecondary"
android:textSize="12sp" />
<ImageView
android:id="@+id/gradeHeaderNote"
android:layout_width="wrap_content"