Add new colors for live tracks
This commit is contained in:
parent
c066e737fe
commit
c58ff85926
2 changed files with 3 additions and 5 deletions
|
@ -207,7 +207,7 @@ class TelegramSettings(private val app: TelegramApplication) {
|
||||||
fun updateLiveTrack(userId: Int, chatId: Long, deviceName: String, enable: Boolean) {
|
fun updateLiveTrack(userId: Int, chatId: Long, deviceName: String, enable: Boolean) {
|
||||||
val tracksInfo = liveTracksInfo.toMutableList()
|
val tracksInfo = liveTracksInfo.toMutableList()
|
||||||
if (enable) {
|
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))
|
tracksInfo.add(LiveTrackInfo(userId, chatId, deviceName, colorIndex))
|
||||||
} else {
|
} else {
|
||||||
tracksInfo.removeAll { it.userId == userId && it.chatId == chatId && it.deviceName == deviceName }
|
tracksInfo.removeAll { it.userId == userId && it.chatId == chatId && it.deviceName == deviceName }
|
||||||
|
|
|
@ -43,8 +43,6 @@ class ShowLocationHelper(private val app: TelegramApplication) {
|
||||||
|
|
||||||
const val LIVE_TRACKS_DIR = "livetracks"
|
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_ID = "status_widget"
|
||||||
private const val STATUS_WIDGET_MENU_ICON = "widget_location_sharing_night"
|
private const val STATUS_WIDGET_MENU_ICON = "widget_location_sharing_night"
|
||||||
private const val STATUS_WIDGET_MENU_ICON_OLD = "ic_action_relative_bearing"
|
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"
|
private const val STATUS_WIDGET_OFF_ICON_NIGHT = "widget_location_sharing_off_night"
|
||||||
|
|
||||||
val GPX_COLORS = arrayOf(
|
val GPX_COLORS = arrayOf(
|
||||||
"red", "orange", "lightblue", "blue", "purple",
|
"red", "orange", "lightblue", "blue", "purple", "pink",
|
||||||
"translucent_red", "translucent_orange", "translucent_lightblue",
|
"translucent_red", "translucent_orange", "translucent_lightblue",
|
||||||
"translucent_blue", "translucent_purple"
|
"translucent_blue", "translucent_purple", "translucent_pink"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue