Add new colors for live tracks

This commit is contained in:
Vitaliy 2020-02-11 17:17:27 +02:00
parent c066e737fe
commit c58ff85926
2 changed files with 3 additions and 5 deletions

View file

@ -207,7 +207,7 @@ class TelegramSettings(private val app: TelegramApplication) {
fun updateLiveTrack(userId: Int, chatId: Long, deviceName: String, enable: Boolean) {
val tracksInfo = liveTracksInfo.toMutableList()
if (enable) {
val colorIndex = if (tracksInfo.size > 0) (tracksInfo.last().colorIndex + 1) % ShowLocationHelper.GPX_COLORS_COUNT else 0
val colorIndex = if (tracksInfo.size > 0) (tracksInfo.last().colorIndex + 1) % ShowLocationHelper.GPX_COLORS.size else 0
tracksInfo.add(LiveTrackInfo(userId, chatId, deviceName, colorIndex))
} else {
tracksInfo.removeAll { it.userId == userId && it.chatId == chatId && it.deviceName == deviceName }

View file

@ -43,8 +43,6 @@ class ShowLocationHelper(private val app: TelegramApplication) {
const val LIVE_TRACKS_DIR = "livetracks"
const val GPX_COLORS_COUNT = 10
private const val STATUS_WIDGET_ID = "status_widget"
private const val STATUS_WIDGET_MENU_ICON = "widget_location_sharing_night"
private const val STATUS_WIDGET_MENU_ICON_OLD = "ic_action_relative_bearing"
@ -57,9 +55,9 @@ class ShowLocationHelper(private val app: TelegramApplication) {
private const val STATUS_WIDGET_OFF_ICON_NIGHT = "widget_location_sharing_off_night"
val GPX_COLORS = arrayOf(
"red", "orange", "lightblue", "blue", "purple",
"red", "orange", "lightblue", "blue", "purple", "pink",
"translucent_red", "translucent_orange", "translucent_lightblue",
"translucent_blue", "translucent_purple"
"translucent_blue", "translucent_purple", "translucent_pink"
)
}