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",
"results": [
<<<<<<< HEAD
"5, Calle de las Eras (Uranización Los Corales), Navacerrada"
],
"extra-results": [
@ -74,6 +75,44 @@
"Travesía de las Huertas, Navacerrada",
"Vereda de las Encinillas, 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": [
{

View file

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

View file

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