Unbookmarking travel article should hide GPX file

This commit is contained in:
androiddevkotlin 2021-04-12 20:33:04 +03:00
parent ab605a035b
commit 3a5e8c6230
2 changed files with 6 additions and 6 deletions

View file

@ -254,18 +254,17 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme
saveBtn.setOnClickListener(new View.OnClickListener() { saveBtn.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (article != null) { getMyApplication().getTravelHelper().createGpxFile(article);
if (saved) {
GPXFile gpxFile = article.getGpxFile(); GPXFile gpxFile = article.getGpxFile();
if (saved) {
getMyApplication().getSelectedGpxHelper().selectGpxFile(gpxFile, false, true); getMyApplication().getSelectedGpxHelper().selectGpxFile(gpxFile, false, true);
helper.removeArticleFromSaved(article); helper.removeArticleFromSaved(article);
} else { } else {
getMyApplication().getTravelHelper().createGpxFile(article); getMyApplication().getSelectedGpxHelper().selectGpxFile(gpxFile, true, true);
helper.addArticleToSaved(article); helper.addArticleToSaved(article);
} }
updateSaveButton(); updateSaveButton();
} }
}
}); });
} }
} }

View file

@ -104,13 +104,14 @@ public class ArticleTravelCard extends BaseTravelCard {
holder.rightButton.setOnClickListener(new View.OnClickListener() { holder.rightButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (saved) { app.getTravelHelper().createGpxFile(article);
GPXFile gpxFile = article.getGpxFile(); GPXFile gpxFile = article.getGpxFile();
if (saved) {
app.getSelectedGpxHelper().selectGpxFile(gpxFile, false, true); app.getSelectedGpxHelper().selectGpxFile(gpxFile, false, true);
helper.removeArticleFromSaved(article); helper.removeArticleFromSaved(article);
} else { } else {
app.getSelectedGpxHelper().selectGpxFile(gpxFile, true, true);
helper.addArticleToSaved(article); helper.addArticleToSaved(article);
app.getTravelHelper().createGpxFile(article);
} }
updateSaveButton(holder); updateSaveButton(holder);
} }