From c54e4d7a386abfa7b2e3985773cfad56db175ba3 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Fri, 12 Feb 2021 15:42:19 +0200 Subject: [PATCH 1/3] Show articles by 30 --- .../plus/wikivoyage/data/TravelObfHelper.java | 78 ++++++++++--------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java index 2d76743c65..cd215fc28c 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java @@ -115,47 +115,49 @@ public class TravelObfHelper implements TravelHelper { public synchronized List loadPopularArticles() { String lang = app.getLanguage(); List popularArticles = new ArrayList<>(this.popularArticles); - if (foundAmenities.size() - foundAmenitiesIndex < MAX_POPULAR_ARTICLES_COUNT) { - final LatLon location = app.getMapViewTrackingUtilities().getMapLocation(); - for (final BinaryMapIndexReader reader : getReaders()) { - try { - searchAmenity(foundAmenities, location, reader, searchRadius, -1, ROUTE_ARTICLE); - searchAmenity(foundAmenities, location, reader, searchRadius / 5, 15, ROUTE_TRACK); - } catch (Exception e) { - LOG.error(e.getMessage(), e); - } - } - if (foundAmenities.size() > 0) { - Collections.sort(foundAmenities, new Comparator>() { - @Override - public int compare(Pair article1, Pair article2) { - Amenity amenity1 = (Amenity) article1.second; - double d1 = MapUtils.getDistance(amenity1.getLocation(), location) - / (ROUTE_ARTICLE.equals(amenity1.getSubType()) ? 5 : 1); - Amenity amenity2 = (Amenity) article2.second; - double d2 = MapUtils.getDistance(amenity2.getLocation(), location) - / (ROUTE_ARTICLE.equals(amenity2.getSubType()) ? 5 : 1); - return Double.compare(d1, d2); - } - }); - } - searchRadius *= 2; - } - - int pagesCount = popularArticles.size() / MAX_POPULAR_ARTICLES_COUNT; - while (foundAmenitiesIndex < foundAmenities.size() - 1) { - Pair amenity = foundAmenities.get(foundAmenitiesIndex); - if (!Algorithms.isEmpty(amenity.second.getName(lang))) { - TravelArticle article = cacheTravelArticles(amenity.first, amenity.second, lang, false, null); - if (article != null && !popularArticles.contains(article)) { - popularArticles.add(article); - if (popularArticles.size() >= (pagesCount + 1) * MAX_POPULAR_ARTICLES_COUNT) { - break; + int pagesCount; + do { + if (foundAmenities.size() - foundAmenitiesIndex < MAX_POPULAR_ARTICLES_COUNT) { + final LatLon location = app.getMapViewTrackingUtilities().getMapLocation(); + for (final BinaryMapIndexReader reader : getReaders()) { + try { + searchAmenity(foundAmenities, location, reader, searchRadius, -1, ROUTE_ARTICLE); + searchAmenity(foundAmenities, location, reader, searchRadius / 5, 15, ROUTE_TRACK); + } catch (Exception e) { + LOG.error(e.getMessage(), e); } } + if (foundAmenities.size() > 0) { + Collections.sort(foundAmenities, new Comparator>() { + @Override + public int compare(Pair article1, Pair article2) { + Amenity amenity1 = (Amenity) article1.second; + double d1 = MapUtils.getDistance(amenity1.getLocation(), location) + / (ROUTE_ARTICLE.equals(amenity1.getSubType()) ? 5 : 1); + Amenity amenity2 = (Amenity) article2.second; + double d2 = MapUtils.getDistance(amenity2.getLocation(), location) + / (ROUTE_ARTICLE.equals(amenity2.getSubType()) ? 5 : 1); + return Double.compare(d1, d2); + } + }); + } + searchRadius *= 2; } - foundAmenitiesIndex++; - } + pagesCount = popularArticles.size() / MAX_POPULAR_ARTICLES_COUNT; + while (foundAmenitiesIndex < foundAmenities.size() - 1) { + Pair amenity = foundAmenities.get(foundAmenitiesIndex); + if (!Algorithms.isEmpty(amenity.second.getName(lang))) { + TravelArticle article = cacheTravelArticles(amenity.first, amenity.second, lang, false, null); + if (article != null && !popularArticles.contains(article)) { + popularArticles.add(article); + if (popularArticles.size() >= (pagesCount + 1) * MAX_POPULAR_ARTICLES_COUNT) { + break; + } + } + } + foundAmenitiesIndex++; + } + } while (popularArticles.size() < (pagesCount + 1) * MAX_POPULAR_ARTICLES_COUNT); this.popularArticles = popularArticles; return popularArticles; } From 233a4ba3d7c4adf6e6c00750cbf5eab3e65d6d95 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Fri, 12 Feb 2021 17:13:26 +0200 Subject: [PATCH 2/3] remove "Show more" button when all travel files deleted. --- .../explore/ExploreTabFragment.java | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java index ff692f8f1c..7255694422 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java @@ -186,28 +186,28 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv } } } - - TravelButtonCard travelButtonCard = new TravelButtonCard(app, nightMode); - travelButtonCard.setListener(new TravelNeededMapsCard.CardListener() { - @Override - public void onPrimaryButtonClick() { - if (activity instanceof WikivoyageExploreActivity) { - new LoadWikivoyageData((WikivoyageExploreActivity) activity,false).execute(); + if (app.getTravelHelper().isAnyTravelBookPresent()) { + TravelButtonCard travelButtonCard = new TravelButtonCard(app, nightMode); + travelButtonCard.setListener(new TravelNeededMapsCard.CardListener() { + @Override + public void onPrimaryButtonClick() { + if (activity instanceof WikivoyageExploreActivity) { + new LoadWikivoyageData((WikivoyageExploreActivity) activity, false).execute(); + } } - } - @Override - public void onSecondaryButtonClick() { + @Override + public void onSecondaryButtonClick() { - } + } - @Override - public void onIndexItemClick(IndexItem item) { - - } - }); - items.add(travelButtonCard); + @Override + public void onIndexItemClick(IndexItem item) { + } + }); + items.add(travelButtonCard); + } items.add(new StartEditingTravelCard(activity, nightMode)); adapter.setItems(items); final DownloadIndexesThread downloadThread = app.getDownloadThread(); @@ -248,11 +248,14 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv } private void addIndexItemCards(List mainIndexItem, List neededIndexItems) { - this.mainIndexItems.clear(); - this.mainIndexItems.addAll(mainIndexItem); + final OsmandApplication app = getMyApplication(); + if (app != null && !app.getTravelHelper().isAnyTravelBookPresent()) { + this.mainIndexItems.clear(); + this.mainIndexItems.addAll(mainIndexItem); + addDownloadUpdateCard(); + } this.neededIndexItems.clear(); this.neededIndexItems.addAll(neededIndexItems); - addDownloadUpdateCard(); addNeededMapsCard(); } From 9fe74b12cdbdd56471467cc76e2eae0502aff2e4 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Mon, 15 Feb 2021 16:48:22 +0200 Subject: [PATCH 3/3] Fix GPX file from bookmarked articles doesn't show without file --- .../data/TravelLocalDataHelper.java | 94 +++++++++++----- .../plus/wikivoyage/data/TravelObfHelper.java | 106 +++++++++--------- .../explore/travelcards/TravelGpxCard.java | 18 ++- 3 files changed, 134 insertions(+), 84 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java index d95b9239ee..6778b3c736 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java @@ -7,13 +7,19 @@ import android.database.sqlite.SQLiteDatabase; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import net.osmand.GPXUtilities; import net.osmand.IndexConstants; +import net.osmand.PlatformUtil; import net.osmand.plus.OsmandApplication; import net.osmand.plus.api.SQLiteAPI.SQLiteConnection; import net.osmand.plus.api.SQLiteAPI.SQLiteCursor; import net.osmand.util.Algorithms; +import org.apache.commons.logging.Log; + +import java.io.ByteArrayInputStream; import java.io.File; +import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -27,6 +33,8 @@ import java.util.Set; public class TravelLocalDataHelper { + private static final Log LOG = PlatformUtil.getLog(TravelLocalDataHelper.class); + private static final int HISTORY_ITEMS_LIMIT = 300; private final WikivoyageLocalDataDbHelper dbHelper; @@ -189,7 +197,7 @@ public class TravelLocalDataHelper { private static class WikivoyageLocalDataDbHelper { - private static final int DB_VERSION = 7; + private static final int DB_VERSION = 8; private static final String DB_NAME = "wikivoyage_local_data"; private static final String HISTORY_TABLE_NAME = "wikivoyage_search_history"; @@ -227,6 +235,7 @@ public class TravelLocalDataHelper { private static final String BOOKMARKS_COL_CONTENT_JSON = "content_json"; private static final String BOOKMARKS_COL_CONTENT = "content"; private static final String BOOKMARKS_COL_LAST_MODIFIED = "last_modified"; + private static final String BOOKMARKS_COL_GPX_GZ = "gpx_gz"; private static final String BOOKMARKS_TABLE_CREATE = "CREATE TABLE IF NOT EXISTS " + BOOKMARKS_TABLE_NAME + " (" + @@ -240,7 +249,8 @@ public class TravelLocalDataHelper { BOOKMARKS_COL_ROUTE_ID + " TEXT, " + BOOKMARKS_COL_CONTENT_JSON + " TEXT, " + BOOKMARKS_COL_CONTENT + " TEXT, " + - BOOKMARKS_COL_LAST_MODIFIED + " long" + ");"; + BOOKMARKS_COL_LAST_MODIFIED + " long, " + + BOOKMARKS_COL_GPX_GZ + " blob" + ");"; private static final String BOOKMARKS_TABLE_SELECT = "SELECT " + BOOKMARKS_COL_ARTICLE_TITLE + ", " + @@ -253,7 +263,8 @@ public class TravelLocalDataHelper { BOOKMARKS_COL_ROUTE_ID + ", " + BOOKMARKS_COL_CONTENT_JSON + ", " + BOOKMARKS_COL_CONTENT + ", " + - BOOKMARKS_COL_LAST_MODIFIED + + BOOKMARKS_COL_LAST_MODIFIED + ", " + + BOOKMARKS_COL_GPX_GZ + " FROM " + BOOKMARKS_TABLE_NAME; private final OsmandApplication context; @@ -322,6 +333,9 @@ public class TravelLocalDataHelper { conn.execSQL("UPDATE " + BOOKMARKS_TABLE_NAME + " SET " + BOOKMARKS_COL_PARTIAL_CONTENT + " = null"); } + if (oldVersion < 8) { + conn.execSQL("ALTER TABLE " + BOOKMARKS_TABLE_NAME + " ADD " + BOOKMARKS_COL_GPX_GZ + " blob"); + } } @NonNull @@ -465,35 +479,48 @@ public class TravelLocalDataHelper { return count > 0; } - void addSavedArticle(@NonNull TravelArticle article) { - String travelBook = article.getTravelBook(context); + void addSavedArticle(@NonNull final TravelArticle article) { + final String travelBook = article.getTravelBook(context); if (travelBook == null) { return; } - SQLiteConnection conn = openConnection(false); - if (conn != null) { - try { - String query = "INSERT INTO " + BOOKMARKS_TABLE_NAME + " (" + - BOOKMARKS_COL_ARTICLE_TITLE + ", " + - BOOKMARKS_COL_LANG + ", " + - BOOKMARKS_COL_IS_PART_OF + ", " + - BOOKMARKS_COL_IMAGE_TITLE + ", " + - BOOKMARKS_COL_TRAVEL_BOOK + ", " + - BOOKMARKS_COL_LAT + ", " + - BOOKMARKS_COL_LON + ", " + - BOOKMARKS_COL_ROUTE_ID + ", " + - BOOKMARKS_COL_CONTENT_JSON + ", " + - BOOKMARKS_COL_CONTENT + ", " + - BOOKMARKS_COL_LAST_MODIFIED + - ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; - conn.execSQL(query, new Object[]{article.title, article.lang, - article.aggregatedPartOf, article.imageTitle, - travelBook, article.lat, article.lon, article.routeId, article.contentsJson, - article.content, article.getFile().lastModified()}); - } finally { - conn.close(); - } - } + context.getTravelHelper().getArticleById(article.generateIdentifier(), article.lang, true, + new TravelHelper.GpxReadCallback() { + @Override + public void onGpxFileReading() { + + } + + @Override + public void onGpxFileRead(@Nullable GPXUtilities.GPXFile gpxFile) { + SQLiteConnection conn = openConnection(false); + if (conn != null) { + try { + String query = "INSERT INTO " + BOOKMARKS_TABLE_NAME + " (" + + BOOKMARKS_COL_ARTICLE_TITLE + ", " + + BOOKMARKS_COL_LANG + ", " + + BOOKMARKS_COL_IS_PART_OF + ", " + + BOOKMARKS_COL_IMAGE_TITLE + ", " + + BOOKMARKS_COL_TRAVEL_BOOK + ", " + + BOOKMARKS_COL_LAT + ", " + + BOOKMARKS_COL_LON + ", " + + BOOKMARKS_COL_ROUTE_ID + ", " + + BOOKMARKS_COL_CONTENT_JSON + ", " + + BOOKMARKS_COL_CONTENT + ", " + + BOOKMARKS_COL_LAST_MODIFIED + ", " + + BOOKMARKS_COL_GPX_GZ + + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + conn.execSQL(query, new Object[]{article.title, article.lang, + article.aggregatedPartOf, article.imageTitle, + travelBook, article.lat, article.lon, article.routeId, article.contentsJson, + article.content, article.getFile().lastModified(), + Algorithms.stringToGzip(GPXUtilities.asString(article.gpxFile))}); + } finally { + conn.close(); + } + } + } + }); } void removeSavedArticle(@NonNull TravelArticle article) { @@ -584,6 +611,15 @@ public class TravelLocalDataHelper { res.file = context.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR + travelBook); res.lastModified = cursor.getLong(cursor.getColumnIndex(BOOKMARKS_COL_LAST_MODIFIED)); } + try { + byte[] blob = cursor.getBlob(cursor.getColumnIndex(BOOKMARKS_COL_GPX_GZ)); + if (blob != null) { + String gpxContent = Algorithms.gzipToString(blob); + res.gpxFile = GPXUtilities.loadGPXFile(new ByteArrayInputStream(gpxContent.getBytes("UTF-8"))); + } + } catch (IOException e) { + LOG.error(e.getMessage(), e); + } return res; } } diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java index cd215fc28c..27ccb89f64 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java @@ -116,48 +116,50 @@ public class TravelObfHelper implements TravelHelper { String lang = app.getLanguage(); List popularArticles = new ArrayList<>(this.popularArticles); int pagesCount; - do { - if (foundAmenities.size() - foundAmenitiesIndex < MAX_POPULAR_ARTICLES_COUNT) { - final LatLon location = app.getMapViewTrackingUtilities().getMapLocation(); - for (final BinaryMapIndexReader reader : getReaders()) { - try { - searchAmenity(foundAmenities, location, reader, searchRadius, -1, ROUTE_ARTICLE); - searchAmenity(foundAmenities, location, reader, searchRadius / 5, 15, ROUTE_TRACK); - } catch (Exception e) { - LOG.error(e.getMessage(), e); - } - } - if (foundAmenities.size() > 0) { - Collections.sort(foundAmenities, new Comparator>() { - @Override - public int compare(Pair article1, Pair article2) { - Amenity amenity1 = (Amenity) article1.second; - double d1 = MapUtils.getDistance(amenity1.getLocation(), location) - / (ROUTE_ARTICLE.equals(amenity1.getSubType()) ? 5 : 1); - Amenity amenity2 = (Amenity) article2.second; - double d2 = MapUtils.getDistance(amenity2.getLocation(), location) - / (ROUTE_ARTICLE.equals(amenity2.getSubType()) ? 5 : 1); - return Double.compare(d1, d2); - } - }); - } - searchRadius *= 2; - } - pagesCount = popularArticles.size() / MAX_POPULAR_ARTICLES_COUNT; - while (foundAmenitiesIndex < foundAmenities.size() - 1) { - Pair amenity = foundAmenities.get(foundAmenitiesIndex); - if (!Algorithms.isEmpty(amenity.second.getName(lang))) { - TravelArticle article = cacheTravelArticles(amenity.first, amenity.second, lang, false, null); - if (article != null && !popularArticles.contains(article)) { - popularArticles.add(article); - if (popularArticles.size() >= (pagesCount + 1) * MAX_POPULAR_ARTICLES_COUNT) { - break; + if (isAnyTravelBookPresent()) { + do { + if (foundAmenities.size() - foundAmenitiesIndex < MAX_POPULAR_ARTICLES_COUNT) { + final LatLon location = app.getMapViewTrackingUtilities().getMapLocation(); + for (final BinaryMapIndexReader reader : getReaders()) { + try { + searchAmenity(foundAmenities, location, reader, searchRadius, -1, ROUTE_ARTICLE); + searchAmenity(foundAmenities, location, reader, searchRadius / 5, 15, ROUTE_TRACK); + } catch (Exception e) { + LOG.error(e.getMessage(), e); } } + if (foundAmenities.size() > 0) { + Collections.sort(foundAmenities, new Comparator>() { + @Override + public int compare(Pair article1, Pair article2) { + Amenity amenity1 = (Amenity) article1.second; + double d1 = MapUtils.getDistance(amenity1.getLocation(), location) + / (ROUTE_ARTICLE.equals(amenity1.getSubType()) ? 5 : 1); + Amenity amenity2 = (Amenity) article2.second; + double d2 = MapUtils.getDistance(amenity2.getLocation(), location) + / (ROUTE_ARTICLE.equals(amenity2.getSubType()) ? 5 : 1); + return Double.compare(d1, d2); + } + }); + } + searchRadius *= 2; } - foundAmenitiesIndex++; - } - } while (popularArticles.size() < (pagesCount + 1) * MAX_POPULAR_ARTICLES_COUNT); + pagesCount = popularArticles.size() / MAX_POPULAR_ARTICLES_COUNT; + while (foundAmenitiesIndex < foundAmenities.size() - 1) { + Pair amenity = foundAmenities.get(foundAmenitiesIndex); + if (!Algorithms.isEmpty(amenity.second.getName(lang))) { + TravelArticle article = cacheTravelArticles(amenity.first, amenity.second, lang, false, null); + if (article != null && !popularArticles.contains(article)) { + popularArticles.add(article); + if (popularArticles.size() >= (pagesCount + 1) * MAX_POPULAR_ARTICLES_COUNT) { + break; + } + } + } + foundAmenitiesIndex++; + } + } while (popularArticles.size() < (pagesCount + 1) * MAX_POPULAR_ARTICLES_COUNT); + } this.popularArticles = popularArticles; return popularArticles; } @@ -667,7 +669,7 @@ public class TravelObfHelper implements TravelHelper { if (article == null && articles == null) { article = findArticleById(articleId, lang, readGpx, callback); } - if (article != null && readGpx && !Algorithms.isEmpty(lang)) { + if (article != null && readGpx && (!Algorithms.isEmpty(lang) || article instanceof TravelGpx)) { readGpxFile(article, callback); } return article; @@ -858,11 +860,7 @@ public class TravelObfHelper implements TravelHelper { @Override public File createGpxFile(@NonNull TravelArticle article) { final GPXFile gpx; - if (article instanceof TravelGpx) { - gpx = buildTravelGpxFile((TravelGpx) article); - } else { - gpx = article.getGpxFile(); - } + gpx = article.getGpxFile(); File file = app.getAppPath(IndexConstants.GPX_TRAVEL_DIR + getGPXName(article)); writeGpxFile(file, gpx); return file; @@ -898,13 +896,17 @@ public class TravelObfHelper implements TravelHelper { @Override protected GPXFile doInBackground(Void... voids) { GPXFile gpxFile = null; - List pointList = getPointList(article); - if (!Algorithms.isEmpty(pointList)) { - gpxFile = new GPXFile(article.getTitle(), article.getLang(), article.getContent()); - gpxFile.metadata.link = TravelArticle.getImageUrl(article.getImageTitle(), false); - for (Amenity amenity : pointList) { - WptPt wptPt = createWptPt(amenity, article.getLang()); - gpxFile.addPoint(wptPt); + if (article instanceof TravelGpx) { + gpxFile = buildTravelGpxFile((TravelGpx) article); + } else { + List pointList = getPointList(article); + if (!Algorithms.isEmpty(pointList)) { + gpxFile = new GPXFile(article.getTitle(), article.getLang(), article.getContent()); + gpxFile.metadata.link = TravelArticle.getImageUrl(article.getImageTitle(), false); + for (Amenity amenity : pointList) { + WptPt wptPt = createWptPt(amenity, article.getLang()); + gpxFile.addPoint(wptPt); + } } } return gpxFile; diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelGpxCard.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelGpxCard.java index be89018bb6..7e07b55be4 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelGpxCard.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelGpxCard.java @@ -7,16 +7,19 @@ import android.widget.TextView; import androidx.annotation.DrawableRes; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.fragment.app.FragmentActivity; import androidx.recyclerview.widget.RecyclerView; import net.osmand.AndroidUtils; +import net.osmand.GPXUtilities; import net.osmand.osm.RouteActivityType; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.track.TrackMenuFragment; import net.osmand.plus.wikivoyage.data.TravelGpx; +import net.osmand.plus.wikivoyage.data.TravelHelper; import net.osmand.plus.wikivoyage.data.TravelLocalDataHelper; import net.osmand.util.Algorithms; @@ -64,8 +67,18 @@ public class TravelGpxCard extends BaseTravelCard { @Override public void onClick(View v) { if (activity != null) { - File file = app.getTravelHelper().createGpxFile(article); - TrackMenuFragment.openTrack(activity, file, null); + app.getTravelHelper().getArticleById(article.generateIdentifier(), null, true, + new TravelHelper.GpxReadCallback() { + @Override + public void onGpxFileReading() { + } + + @Override + public void onGpxFileRead(@Nullable GPXUtilities.GPXFile gpxFile) { + File file = app.getTravelHelper().createGpxFile(article); + TrackMenuFragment.openTrack(activity, file, null); + } + }); } } }; @@ -102,7 +115,6 @@ public class TravelGpxCard extends BaseTravelCard { if (saved) { helper.removeArticleFromSaved(article); } else { - app.getTravelHelper().createGpxFile(article); helper.addArticleToSaved(article); } updateSaveButton(holder);