ref: 343255d5c2e7108dd510ca9e7707d2d3d67e0bc6
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 56 |
// SPDX-FileCopyrightText: Adam Evyčędo // // SPDX-License-Identifier: GPL-3.0-or-later 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 import xyz.apiote.bimba.czwek.api.LineV2 import xyz.apiote.bimba.czwek.api.LineV3 data class Line( val id: String, val name: String, val colour: Colour, val type: LineType, val feedID: String, val headsigns: List<List<String>>, val graphs: List<LineGraph>, ) : Queryable, LineAbstract { constructor(line: LineV1) : this( line.name, line.name, Colour(line.colour), LineType.of(line.type), line.feedID, line.headsigns, line.graphs.map{LineGraph(it)} ) constructor(line: LineV2) : this( line.name, line.name, Colour(line.colour), LineType.of(line.type), line.feedID, line.headsigns, line.graphs.map{LineGraph(it)} ) constructor(line: LineV3) : this( line.id, line.name, Colour(line.colour), LineType.of(line.type), line.feedID, line.headsigns, line.graphs.map{LineGraph(it)} ) fun icon(context: Context, scale: Float = 1f): Drawable { return BitmapDrawable(context.resources, super.icon(context, type, colour, scale)) } } |