Merge pull request #8441 from osmandapp/Fix_8269

Fix_8269
This commit is contained in:
vshcherb 2020-02-11 16:55:41 +01:00 committed by GitHub
commit ecc9795b6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 6 deletions

View file

@ -1557,6 +1557,8 @@ public class GPXUtilities {
serializer.endTag(null, "wpt"); //$NON-NLS-1$
}
writeExtensions(serializer, file);
serializer.endTag(null, "gpx"); //$NON-NLS-1$
serializer.endDocument();
serializer.flush();

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"
)
}

View file

@ -1119,7 +1119,7 @@ public class OsmandAidlApi {
@SuppressLint("StaticFieldLeak")
private void finishGpxImport(boolean destinationExists, File destination, String color, boolean show) {
int col = ConfigureMapMenu.GpxAppearanceAdapter.parseTrackColor(
final int col = ConfigureMapMenu.GpxAppearanceAdapter.parseTrackColor(
app.getRendererRegistry().getCurrentSelectedRenderer(), color);
if (!destinationExists) {
GpxDataItem gpxDataItem = new GpxDataItem(destination, col);
@ -1145,6 +1145,9 @@ public class OsmandAidlApi {
@Override
protected void onPostExecute(GPXFile gpx) {
if (gpx.error == null) {
if (col != -1) {
gpx.setColor(col);
}
selectedGpx.setGpxFile(gpx, app);
refreshMap();
}