ref: ce9129d4de463914e1fa126bcf87baf06654c6fd
app/src/main/java/xyz/apiote/bimba/czwek/repo/Line.kt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
package xyz.apiote.bimba.czwek.repo import android.content.Context import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable import xyz.apiote.bimba.czwek.api.LineV1 data class Line( val name: String, val colour: Colour, val type: LineType, val feedID: String, val headsigns: Array<List<String>>, val graphs: Array<LineGraph>, ) : Queryable, LineAbstract { constructor(line: LineV1) : this( line.name, Colour(line.colour), LineType.of(line.type), line.feedID, line.headsigns, line.graphs.map{LineGraph(it)}.toTypedArray() ) fun icon(context: Context, scale: Float = 1f): Drawable { return BitmapDrawable(context.resources, super.icon(context, type, colour, scale)) } override fun equals(other: Any?): Boolean { if (this === other) return true if (javaClass != other?.javaClass) return false other as Line if (name != other.name) return false if (colour != other.colour) return false if (type != other.type) return false if (feedID != other.feedID) return false if (!headsigns.contentEquals(other.headsigns)) return false if (!graphs.contentEquals(other.graphs)) return false return true } override fun hashCode(): Int { var result = name.hashCode() result = 31 * result + colour.hashCode() result = 31 * result + type.hashCode() result = 31 * result + feedID.hashCode() result = 31 * result + headsigns.contentHashCode() result = 31 * result + graphs.contentHashCode() return result } } |