mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2024-11-13 22:40:28 -06:00
Don't display brackets in login student select items when schoolShortName is blank
This commit is contained in:
parent
2121125283
commit
622c75bb42
@ -19,19 +19,23 @@ class LoginStudentSelectAdapter @Inject constructor() :
|
|||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||||
val inflater = LayoutInflater.from(parent.context)
|
val inflater = LayoutInflater.from(parent.context)
|
||||||
return when (LoginStudentSelectItemType.values()[viewType]) {
|
return when (LoginStudentSelectItemType.entries[viewType]) {
|
||||||
LoginStudentSelectItemType.EMPTY_SYMBOLS_HEADER -> EmptySymbolsHeaderViewHolder(
|
LoginStudentSelectItemType.EMPTY_SYMBOLS_HEADER -> EmptySymbolsHeaderViewHolder(
|
||||||
ItemLoginStudentSelectEmptySymbolHeaderBinding.inflate(inflater, parent, false),
|
ItemLoginStudentSelectEmptySymbolHeaderBinding.inflate(inflater, parent, false),
|
||||||
)
|
)
|
||||||
|
|
||||||
LoginStudentSelectItemType.SYMBOL_HEADER -> SymbolsHeaderViewHolder(
|
LoginStudentSelectItemType.SYMBOL_HEADER -> SymbolsHeaderViewHolder(
|
||||||
ItemLoginStudentSelectHeaderSymbolBinding.inflate(inflater, parent, false)
|
ItemLoginStudentSelectHeaderSymbolBinding.inflate(inflater, parent, false)
|
||||||
)
|
)
|
||||||
|
|
||||||
LoginStudentSelectItemType.SCHOOL_HEADER -> SchoolHeaderViewHolder(
|
LoginStudentSelectItemType.SCHOOL_HEADER -> SchoolHeaderViewHolder(
|
||||||
ItemLoginStudentSelectHeaderSchoolBinding.inflate(inflater, parent, false)
|
ItemLoginStudentSelectHeaderSchoolBinding.inflate(inflater, parent, false)
|
||||||
)
|
)
|
||||||
|
|
||||||
LoginStudentSelectItemType.STUDENT -> StudentViewHolder(
|
LoginStudentSelectItemType.STUDENT -> StudentViewHolder(
|
||||||
ItemLoginStudentSelectStudentBinding.inflate(inflater, parent, false)
|
ItemLoginStudentSelectStudentBinding.inflate(inflater, parent, false)
|
||||||
)
|
)
|
||||||
|
|
||||||
LoginStudentSelectItemType.HELP -> HelpViewHolder(
|
LoginStudentSelectItemType.HELP -> HelpViewHolder(
|
||||||
ItemLoginStudentSelectHelpBinding.inflate(inflater, parent, false)
|
ItemLoginStudentSelectHelpBinding.inflate(inflater, parent, false)
|
||||||
)
|
)
|
||||||
@ -98,9 +102,11 @@ class LoginStudentSelectAdapter @Inject constructor() :
|
|||||||
with(binding) {
|
with(binding) {
|
||||||
loginStudentSelectHeaderSchoolName.text = buildString {
|
loginStudentSelectHeaderSchoolName.text = buildString {
|
||||||
append(item.unit.schoolName.trim())
|
append(item.unit.schoolName.trim())
|
||||||
append(" (")
|
if (item.unit.schoolShortName.isNotBlank()) {
|
||||||
append(item.unit.schoolShortName)
|
append(" (")
|
||||||
append(")")
|
append(item.unit.schoolShortName)
|
||||||
|
append(")")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
loginStudentSelectHeaderSchoolDetails.isVisible = item.unit.students.isEmpty()
|
loginStudentSelectHeaderSchoolDetails.isVisible = item.unit.students.isEmpty()
|
||||||
loginStudentSelectHeaderSchoolError.text = item.unit.error?.message
|
loginStudentSelectHeaderSchoolError.text = item.unit.error?.message
|
||||||
@ -170,9 +176,11 @@ class LoginStudentSelectAdapter @Inject constructor() :
|
|||||||
oldItem is LoginStudentSelectItem.SymbolHeader && newItem is LoginStudentSelectItem.SymbolHeader -> {
|
oldItem is LoginStudentSelectItem.SymbolHeader && newItem is LoginStudentSelectItem.SymbolHeader -> {
|
||||||
oldItem.symbol == newItem.symbol
|
oldItem.symbol == newItem.symbol
|
||||||
}
|
}
|
||||||
|
|
||||||
oldItem is LoginStudentSelectItem.Student && newItem is LoginStudentSelectItem.Student -> {
|
oldItem is LoginStudentSelectItem.Student && newItem is LoginStudentSelectItem.Student -> {
|
||||||
oldItem.student == newItem.student
|
oldItem.student == newItem.student
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> oldItem == newItem
|
else -> oldItem == newItem
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user