Merge branch 'r3.7'

This commit is contained in:
Vitaliy 2020-06-03 12:34:47 +03:00
commit 2f43e8bf26
3 changed files with 65 additions and 47 deletions

View file

@ -11,6 +11,7 @@
}, },
"phrase": "Calle de las eras 5, Navacerrada", "phrase": "Calle de las eras 5, Navacerrada",
"results": [ "results": [
<<<<<<< HEAD
"5, Calle de las Eras (Uranización Los Corales), Navacerrada" "5, Calle de las Eras (Uranización Los Corales), Navacerrada"
], ],
"extra-results": [ "extra-results": [
@ -74,6 +75,44 @@
"Travesía de las Huertas, Navacerrada", "Travesía de las Huertas, Navacerrada",
"Vereda de las Encinillas, Navacerrada", "Vereda de las Encinillas, Navacerrada",
"Centro Municipal de Mayores «Navacerrada»", "Centro Municipal de Mayores «Navacerrada»",
=======
"5, Calle de las Eras (Uranización Los Corales), Navacerrada",
"5, Calle Navacerrada (Urb. Las Suertes), Las Suertes",
"50, Calle de Francisco Navacerrada, Salamanca",
"52, Calle de Francisco Navacerrada, Salamanca",
"53, Calle de Francisco Navacerrada, Salamanca",
"54, Calle de Francisco Navacerrada, Salamanca",
"55, Calle de Francisco Navacerrada, Salamanca",
"56, Calle de Francisco Navacerrada, Salamanca",
"57, Calle de Francisco Navacerrada, Salamanca",
"58, Calle de Francisco Navacerrada, Salamanca",
"59, Calle de Francisco Navacerrada, Salamanca",
"Calle del Puerto de Navacerrada, Las Nieves",
"Calle Puerto de Navacerrada, La Poveda",
"Calle del Embalse de Navacerrada, Villa de Vallecas",
"Calle del Puerto de Navacerrada, Puente de Vallecas",
"Calle de Francisco Navacerrada, Salamanca",
"Calle de Navacerrada, Moraleja de Enmedio",
"Calle Navacerrada (Urb. Las Suertes), Las Suertes",
"Calle Puerto de Navacerrada, Roman Candelas",
"Calle Navacerrada, Becerril de la Sierra",
"Carretera de Collado Villalba a Navacerrada, El Baillo y las Hojarascas",
"Calle Navacerrada (Cerceda), El Boalo",
"Calle Navacerrada (El Pedregal), Bustarviejo",
"Calle Navacerrada, Buitrago del Lozoya",
"Carretera de Colmenar Viejo a Navacerrada, Becerril de la Sierra",
"Carretera de Colmenar Viejo a Navacerrada, Manzanares el Real",
"Carretera de Collado Villalba a Navacerrada, Dehesa Boyal",
"Carretera de Collado Villalba a Navacerrada, Polideportivo Dehesa Boyal",
"Carretera de Navacerrada, Jazmines",
"Carretera de Colmenar Viejo a Navacerrada (Cerceda), El Boalo",
"Carretera de Collado Villalba a Navacerrada, Cerca de Cascarrilla",
"Carretera de Navacerrada, El Boalo",
"Carretera de Collado Villalba a Navacerrada, Collado Mediano",
"Camino de Navacerrada (Serranía de la Paloma), Collado Mediano",
"Camino de Los Molinos a Navacerrada, Collado Mediano",
"Carretera de Collado Villalba a Navacerrada, Navacerrada"
>>>>>>> e69e0d95cc... Added search test
], ],
"amenities": [ "amenities": [
{ {

View file

@ -11,9 +11,9 @@ import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.core.os.ConfigurationCompat; import androidx.core.os.ConfigurationCompat;
import androidx.core.os.LocaleListCompat; import androidx.core.os.LocaleListCompat;
import androidx.fragment.app.FragmentActivity;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
import net.osmand.CallbackWithObject;
import net.osmand.plus.settings.backend.ApplicationMode; import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.settings.backend.OsmandSettings;
@ -48,7 +48,6 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
private List<BottomSheetItemWithCompoundButton> languageItems; private List<BottomSheetItemWithCompoundButton> languageItems;
private ArrayList<WikiLanguageItem> languages; private ArrayList<WikiLanguageItem> languages;
private CallbackWithObject<Boolean> languageChangedCallback;
private boolean isGlobalWikiPoiEnabled = false; private boolean isGlobalWikiPoiEnabled = false;
@Override @Override
@ -56,6 +55,7 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
app = requiredMyApplication(); app = requiredMyApplication();
settings = app.getSettings(); settings = app.getSettings();
appMode = settings.getApplicationMode();
initLanguagesData(); initLanguagesData();
} }
@ -192,8 +192,9 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
} }
settings.WIKIPEDIA_POI_ENABLED_LANGUAGES.setStringsListForProfile(appMode, localesForSaving); settings.WIKIPEDIA_POI_ENABLED_LANGUAGES.setStringsListForProfile(appMode, localesForSaving);
settings.GLOBAL_WIKIPEDIA_POI_ENABLED.setModeValue(appMode, isGlobalWikiPoiEnabled); settings.GLOBAL_WIKIPEDIA_POI_ENABLED.setModeValue(appMode, isGlobalWikiPoiEnabled);
if (languageChangedCallback != null) { MapActivity ma = getMapActivity();
languageChangedCallback.processResult(true); if (ma != null) {
WikipediaPoiMenu.updateWikipediaState(ma);
} }
dismiss(); dismiss();
} }
@ -227,12 +228,13 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
} }
} }
public void setAppMode(ApplicationMode appMode) { @Nullable
this.appMode = appMode; private MapActivity getMapActivity() {
} FragmentActivity activity = getActivity();
if (activity instanceof MapActivity) {
public void setLanguageChangedCallback(CallbackWithObject<Boolean> languageChangedCallback) { return (MapActivity) activity;
this.languageChangedCallback = languageChangedCallback; }
return null;
} }
private class WikiLanguageItem implements Comparable<WikiLanguageItem> { private class WikiLanguageItem implements Comparable<WikiLanguageItem> {
@ -276,13 +278,9 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
} }
public static void showInstance(@NonNull MapActivity mapActivity, public static void showInstance(@NonNull MapActivity mapActivity,
@NonNull ApplicationMode appMode, boolean usedOnMap) {
boolean usedOnMap,
CallbackWithObject<Boolean> callback) {
SelectWikiLanguagesBottomSheet fragment = new SelectWikiLanguagesBottomSheet(); SelectWikiLanguagesBottomSheet fragment = new SelectWikiLanguagesBottomSheet();
fragment.setAppMode(appMode);
fragment.setUsedOnMap(usedOnMap); fragment.setUsedOnMap(usedOnMap);
fragment.setLanguageChangedCallback(callback);
fragment.show(mapActivity.getSupportFragmentManager(), SelectWikiLanguagesBottomSheet.TAG); fragment.show(mapActivity.getSupportFragmentManager(), SelectWikiLanguagesBottomSheet.TAG);
} }
} }

View file

@ -38,14 +38,12 @@ public class WikipediaPoiMenu {
private MapActivity mapActivity; private MapActivity mapActivity;
private OsmandApplication app; private OsmandApplication app;
private OsmandSettings settings; private OsmandSettings settings;
private ApplicationMode appMode;
private boolean nightMode; private boolean nightMode;
public WikipediaPoiMenu(MapActivity mapActivity) { public WikipediaPoiMenu(MapActivity mapActivity) {
this.mapActivity = mapActivity; this.mapActivity = mapActivity;
this.app = mapActivity.getMyApplication(); this.app = mapActivity.getMyApplication();
this.settings = app.getSettings(); this.settings = app.getSettings();
this.appMode = settings.getApplicationMode();
this.nightMode = app.getDaynightHelper().isNightModeForMapControls(); this.nightMode = app.getDaynightHelper().isNightModeForMapControls();
} }
@ -59,14 +57,6 @@ public class WikipediaPoiMenu {
adapter.setProfileDependent(true); adapter.setProfileDependent(true);
adapter.setNightMode(nightMode); adapter.setNightMode(nightMode);
final CallbackWithObject<Boolean> callback = new CallbackWithObject<Boolean>() {
@Override
public boolean processResult(Boolean result) {
mapActivity.getDashboard().refreshContent(true);
return true;
}
};
ContextMenuAdapter.OnRowItemClick l = new ContextMenuAdapter.OnRowItemClick() { ContextMenuAdapter.OnRowItemClick l = new ContextMenuAdapter.OnRowItemClick() {
@Override @Override
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> adapter, public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> adapter,
@ -75,11 +65,11 @@ public class WikipediaPoiMenu {
app.runInUIThread(new Runnable() { app.runInUIThread(new Runnable() {
@Override @Override
public void run() { public void run() {
toggleWikipediaPoi(mapActivity, !enabled, callback); toggleWikipediaPoi(mapActivity, !enabled, null);
} }
}); });
} else if (itemId == languageActionStringId) { } else if (itemId == languageActionStringId) {
showLanguagesDialog(mapActivity, appMode, true, callback); SelectWikiLanguagesBottomSheet.showInstance(mapActivity, true);
} }
return false; return false;
} }
@ -230,26 +220,15 @@ public class WikipediaPoiMenu {
return adapter; return adapter;
} }
private static void showLanguagesDialog(@NonNull final MapActivity mapActivity, public static void updateWikipediaState(MapActivity ma) {
@NonNull final ApplicationMode appMode, final OsmandApplication app = ma.getMyApplication();
final boolean usedOnMap, ApplicationMode appMode = app.getSettings().getApplicationMode();
final CallbackWithObject<Boolean> callback) { Bundle wikiPoiSetting = getWikiPoiSettingsForProfile(app, appMode);
final OsmandApplication app = mapActivity.getMyApplication(); if (wikiPoiSetting != null) {
SelectWikiLanguagesBottomSheet.showInstance(mapActivity, appMode, usedOnMap, refreshWikipediaOnMap(ma);
new CallbackWithObject<Boolean>() { } else {
@Override toggleWikipediaPoi(ma, false, null);
public boolean processResult(Boolean result) { }
if (result) {
Bundle wikiPoiSetting = getWikiPoiSettingsForProfile(app, appMode);
if (wikiPoiSetting != null) {
refreshWikipediaOnMap(mapActivity);
} else {
toggleWikipediaPoi(mapActivity, false, callback);
}
}
return true;
}
});
} }
public static String getTranslation(OsmandApplication app, String locale) { public static String getTranslation(OsmandApplication app, String locale) {
@ -305,6 +284,8 @@ public class WikipediaPoiMenu {
} }
if (callback != null) { if (callback != null) {
callback.processResult(enable); callback.processResult(enable);
} else {
mapActivity.getDashboard().refreshContent(true);
} }
mapActivity.refreshMap(); mapActivity.refreshMap();
} }