This commit is contained in:
androiddevkotlin 2021-04-11 23:01:04 +03:00
parent 1b1132148f
commit 290f3af026
2 changed files with 8 additions and 3 deletions

View file

@ -69,9 +69,9 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme
private static final String SELECTED_LANG_KEY = "selected_lang"; private static final String SELECTED_LANG_KEY = "selected_lang";
private static final String EMPTY_URL = "https://upload.wikimedia.org/wikipedia/commons/thumb/d/d4//"; private static final String EMPTY_URL = "https://upload.wikimedia.org/wikipedia/commons/thumb/d/d4//";
private static final int MENU_ITEM_SHARE = 0; private static final int MENU_ITEM_SHARE = 0;
private TravelArticleIdentifier articleId; private TravelArticleIdentifier articleId;
private ArrayList<String> langs; private ArrayList<String> langs;
private String selectedLang; private String selectedLang;
@ -256,6 +256,8 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme
public void onClick(View view) { public void onClick(View view) {
if (article != null) { if (article != null) {
if (saved) { if (saved) {
GPXFile gpxFile = article.getGpxFile();
getMyApplication().getSelectedGpxHelper().selectGpxFile(gpxFile, false, true);
helper.removeArticleFromSaved(article); helper.removeArticleFromSaved(article);
} else { } else {
getMyApplication().getTravelHelper().createGpxFile(article); getMyApplication().getTravelHelper().createGpxFile(article);

View file

@ -13,6 +13,7 @@ import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso; import com.squareup.picasso.Picasso;
import com.squareup.picasso.RequestCreator; import com.squareup.picasso.RequestCreator;
import net.osmand.GPXUtilities;
import net.osmand.PicassoUtils; import net.osmand.PicassoUtils;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
@ -102,10 +103,12 @@ public class ArticleTravelCard extends BaseTravelCard {
public void onClick(View view) { public void onClick(View view) {
if (article != null) { if (article != null) {
if (saved) { if (saved) {
GPXUtilities.GPXFile gpxFile = article.getGpxFile();
app.getSelectedGpxHelper().selectGpxFile(gpxFile, false, true);
helper.removeArticleFromSaved(article); helper.removeArticleFromSaved(article);
} else { } else {
app.getTravelHelper().createGpxFile(article);
helper.addArticleToSaved(article); helper.addArticleToSaved(article);
app.getTravelHelper().createGpxFile(article);
} }
updateSaveButton(holder); updateSaveButton(holder);
} }