Convert Data.Audio to data class, and implement equals and hashCode as suggested.
This commit is contained in:
@@ -17,10 +17,28 @@
|
||||
package io.element.android.libraries.voicerecorder.impl.audio
|
||||
|
||||
sealed interface Audio {
|
||||
class Data(
|
||||
data class Data(
|
||||
val readSize: Int,
|
||||
val buffer: ShortArray,
|
||||
) : Audio
|
||||
) : Audio {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as Data
|
||||
|
||||
if (readSize != other.readSize) return false
|
||||
if (!buffer.contentEquals(other.buffer)) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = readSize
|
||||
result = 31 * result + buffer.contentHashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
data class Error(
|
||||
val audioRecordErrorCode: Int
|
||||
|
||||
Reference in New Issue
Block a user