forked from github/wulkanowy-mirror
Add grade id to equals (#213)
This commit is contained in:
parent
c3d354cd5b
commit
c2bcbfaaa9
@ -52,7 +52,6 @@ class GradeDetailsHeader(
|
|||||||
if (subject != other.subject) return false
|
if (subject != other.subject) return false
|
||||||
if (number != other.number) return false
|
if (number != other.number) return false
|
||||||
if (average != other.average) return false
|
if (average != other.average) return false
|
||||||
if (newGrades != other.newGrades) return false
|
|
||||||
if (isExpandable != other.isExpandable) return false
|
if (isExpandable != other.isExpandable) return false
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@ -62,7 +61,6 @@ class GradeDetailsHeader(
|
|||||||
var result = subject.hashCode()
|
var result = subject.hashCode()
|
||||||
result = 31 * result + number.hashCode()
|
result = 31 * result + number.hashCode()
|
||||||
result = 31 * result + average.hashCode()
|
result = 31 * result + average.hashCode()
|
||||||
result = 31 * result + newGrades
|
|
||||||
result = 31 * result + isExpandable.hashCode()
|
result = 31 * result + isExpandable.hashCode()
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,8 @@ import io.github.wulkanowy.utils.toFormattedString
|
|||||||
import kotlinx.android.extensions.LayoutContainer
|
import kotlinx.android.extensions.LayoutContainer
|
||||||
import kotlinx.android.synthetic.main.item_grade_details.*
|
import kotlinx.android.synthetic.main.item_grade_details.*
|
||||||
|
|
||||||
class GradeDetailsItem(val grade: Grade, private val weightString: String, private val valueColor: Int)
|
class GradeDetailsItem(val grade: Grade, private val weightString: String, private val valueColor: Int) :
|
||||||
: AbstractFlexibleItem<GradeDetailsItem.ViewHolder>() {
|
AbstractFlexibleItem<GradeDetailsItem.ViewHolder>() {
|
||||||
|
|
||||||
override fun getLayoutRes() = R.layout.item_grade_details
|
override fun getLayoutRes() = R.layout.item_grade_details
|
||||||
|
|
||||||
@ -24,8 +24,10 @@ class GradeDetailsItem(val grade: Grade, private val weightString: String, priva
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
override fun bindViewHolder(adapter: FlexibleAdapter<IFlexible<*>>, holder: ViewHolder,
|
override fun bindViewHolder(
|
||||||
position: Int, payloads: MutableList<Any>?) {
|
adapter: FlexibleAdapter<IFlexible<*>>, holder: ViewHolder,
|
||||||
|
position: Int, payloads: MutableList<Any>?
|
||||||
|
) {
|
||||||
holder.run {
|
holder.run {
|
||||||
gradeItemValue.run {
|
gradeItemValue.run {
|
||||||
text = grade.entry
|
text = grade.entry
|
||||||
@ -45,6 +47,7 @@ class GradeDetailsItem(val grade: Grade, private val weightString: String, priva
|
|||||||
other as GradeDetailsItem
|
other as GradeDetailsItem
|
||||||
|
|
||||||
if (grade != other.grade) return false
|
if (grade != other.grade) return false
|
||||||
|
if (grade.id != other.grade.id) return false
|
||||||
if (weightString != other.weightString) return false
|
if (weightString != other.weightString) return false
|
||||||
if (valueColor != other.valueColor) return false
|
if (valueColor != other.valueColor) return false
|
||||||
|
|
||||||
@ -53,12 +56,12 @@ class GradeDetailsItem(val grade: Grade, private val weightString: String, priva
|
|||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
var result = grade.hashCode()
|
var result = grade.hashCode()
|
||||||
|
result = 31 * result + grade.id.toInt()
|
||||||
result = 31 * result + weightString.hashCode()
|
result = 31 * result + weightString.hashCode()
|
||||||
result = 31 * result + valueColor
|
result = 31 * result + valueColor
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ViewHolder(view: View, adapter: FlexibleAdapter<*>) : FlexibleViewHolder(view, adapter),
|
class ViewHolder(view: View, adapter: FlexibleAdapter<*>) : FlexibleViewHolder(view, adapter),
|
||||||
LayoutContainer {
|
LayoutContainer {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user