Merge pull request #5511 from osmandapp/fix_later_btn

The "later" button on travel cards hides the card until the applicati…
This commit is contained in:
Alexey 2018-05-29 13:01:45 +03:00 committed by GitHub
commit a1ff735b31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View file

@ -177,6 +177,8 @@ public class AppInitializer implements IProgress {
startPrefs.edit().putString(VERSION_INSTALLED, Version.getFullVersion(app)).commit();
appVersionChanged = true;
}
app.getSettings().SHOW_TRAVEL_UPDATE_CARD.set(true);
app.getSettings().SHOW_TRAVEL_NEEDED_MAPS_CARD.set(true);
initSettings = true;
}

View file

@ -3006,6 +3006,9 @@ public class OsmandSettings {
public final OsmandPreference<String> SELECTED_TRAVEL_BOOK = new StringPreference("selected_travel_book", "").makeGlobal();
public final OsmandPreference<Boolean> SHOW_TRAVEL_UPDATE_CARD = new BooleanPreference("show_travel_update_card", true).makeGlobal();
public final OsmandPreference<Boolean> SHOW_TRAVEL_NEEDED_MAPS_CARD = new BooleanPreference("show_travel_needed_maps_card", true).makeGlobal();
public final ListStringPreference TRANSPORT_DEFAULT_SETTINGS =
(ListStringPreference) new ListStringPreference("transport_default_settings", "transportStops", ",").makeProfile();

View file

@ -214,7 +214,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
boolean outdated = mainIndexItem != null && mainIndexItem.isOutdated();
File selectedTravelBook = app.getTravelDbHelper().getSelectedTravelBook();
if (selectedTravelBook == null || outdated) {
if (selectedTravelBook == null || (outdated && app.getSettings().SHOW_TRAVEL_UPDATE_CARD.get())) {
boolean showOtherMaps = false;
if (selectedTravelBook == null) {
List<IndexItem> items = downloadThread.getIndexes().getWikivoyageItems();
@ -238,6 +238,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
downloadThread.cancelDownload(mainIndexItem);
adapter.updateDownloadUpdateCard(false);
} else if (!downloadUpdateCard.isDownload()) {
app.getSettings().SHOW_TRAVEL_UPDATE_CARD.set(false);
removeDownloadUpdateCard();
} else if (downloadUpdateCard.isShowOtherMapsBtn()) {
Activity activity = getActivity();
@ -258,7 +259,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
private void addNeededMapsCard() {
final OsmandApplication app = getMyApplication();
if (app != null && !neededIndexItems.isEmpty() && adapter != null) {
if (app != null && !neededIndexItems.isEmpty() && adapter != null && app.getSettings().SHOW_TRAVEL_NEEDED_MAPS_CARD.get()) {
neededMapsCard = new TravelNeededMapsCard(app, nightMode, neededIndexItems);
neededMapsCard.setListener(new TravelNeededMapsCard.CardListener() {
@Override
@ -277,6 +278,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
adapter.updateNeededMapsCard(false);
}
} else {
app.getSettings().SHOW_TRAVEL_NEEDED_MAPS_CARD.set(false);
removeNeededMapsCard();
}
}