The "later" button on travel cards hides the card until the application is restarted
This commit is contained in:
parent
846bd3fcfa
commit
5c7b4cf719
3 changed files with 32 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import android.view.ViewGroup;
|
|||
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
|
@ -206,6 +207,22 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
|
|||
addNeededMapsCard();
|
||||
}
|
||||
|
||||
private boolean showUpdateCard() {
|
||||
OsmandSettings settings = getSettings();
|
||||
if (settings != null) {
|
||||
return settings.SHOW_TRAVEL_UPDATE_CARD.get();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean showNeededMapsCard() {
|
||||
OsmandSettings settings = getSettings();
|
||||
if (settings != null) {
|
||||
return settings.SHOW_TRAVEL_NEEDED_MAPS_CARD.get();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void addDownloadUpdateCard() {
|
||||
final OsmandApplication app = getMyApplication();
|
||||
if (app != null && adapter != null) {
|
||||
|
@ -214,7 +231,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 && showUpdateCard())) {
|
||||
boolean showOtherMaps = false;
|
||||
if (selectedTravelBook == null) {
|
||||
List<IndexItem> items = downloadThread.getIndexes().getWikivoyageItems();
|
||||
|
@ -238,6 +255,10 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
|
|||
downloadThread.cancelDownload(mainIndexItem);
|
||||
adapter.updateDownloadUpdateCard(false);
|
||||
} else if (!downloadUpdateCard.isDownload()) {
|
||||
OsmandSettings settings = getSettings();
|
||||
if (settings != null) {
|
||||
settings.SHOW_TRAVEL_UPDATE_CARD.set(false);
|
||||
}
|
||||
removeDownloadUpdateCard();
|
||||
} else if (downloadUpdateCard.isShowOtherMapsBtn()) {
|
||||
Activity activity = getActivity();
|
||||
|
@ -258,7 +279,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 && showNeededMapsCard()) {
|
||||
neededMapsCard = new TravelNeededMapsCard(app, nightMode, neededIndexItems);
|
||||
neededMapsCard.setListener(new TravelNeededMapsCard.CardListener() {
|
||||
@Override
|
||||
|
@ -277,6 +298,10 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
|
|||
adapter.updateNeededMapsCard(false);
|
||||
}
|
||||
} else {
|
||||
OsmandSettings settings = getSettings();
|
||||
if (settings != null) {
|
||||
settings.SHOW_TRAVEL_NEEDED_MAPS_CARD.set(false);
|
||||
}
|
||||
removeNeededMapsCard();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue