Merge branch 'r3.7' into searchRefactor
|
@ -15,7 +15,6 @@
|
||||||
"Calle de las Eras (Uranización Los Corales), Navacerrada [[5, STREET, 0.310, 70.15 km]]"
|
"Calle de las Eras (Uranización Los Corales), Navacerrada [[5, STREET, 0.310, 70.15 km]]"
|
||||||
],
|
],
|
||||||
"extra-results": [
|
"extra-results": [
|
||||||
|
|
||||||
"5, Calle Navacerrada (Urb. Las Suertes), Las Suertes [[4, HOUSE, 0.430, 60.50 km]]",
|
"5, Calle Navacerrada (Urb. Las Suertes), Las Suertes [[4, HOUSE, 0.430, 60.50 km]]",
|
||||||
"50, Calle de Francisco Navacerrada, Salamanca [[4, HOUSE, 0.430, 26.37 km]]",
|
"50, Calle de Francisco Navacerrada, Salamanca [[4, HOUSE, 0.430, 26.37 km]]",
|
||||||
"52, Calle de Francisco Navacerrada, Salamanca [[4, HOUSE, 0.430, 26.36 km]]",
|
"52, Calle de Francisco Navacerrada, Salamanca [[4, HOUSE, 0.430, 26.36 km]]",
|
||||||
|
|
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.9 KiB |
|
@ -26,9 +26,7 @@ import java.text.DecimalFormatSymbols;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import static net.osmand.data.PointDescription.getLocationOlcName;
|
import static net.osmand.data.PointDescription.getLocationOlcName;
|
||||||
|
@ -276,27 +274,13 @@ public class OsmAndFormatter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<MetricsConstants, String> getDistanceData(OsmandApplication app, float meters) {
|
|
||||||
Map<MetricsConstants, String> results = new LinkedHashMap<>();
|
|
||||||
|
|
||||||
String kilometersAndMeters = getFormattedDistance(meters, app, true, MetricsConstants.KILOMETERS_AND_METERS);
|
|
||||||
String milesAndFeet = getFormattedDistance(meters, app, true, MetricsConstants.MILES_AND_FEET);
|
|
||||||
String milesAndMeters = getFormattedDistance(meters, app, true, MetricsConstants.MILES_AND_METERS);
|
|
||||||
String milesAndYards = getFormattedDistance(meters, app, true, MetricsConstants.MILES_AND_YARDS);
|
|
||||||
String nauticalMiles = getFormattedDistance(meters, app, true, MetricsConstants.NAUTICAL_MILES);
|
|
||||||
|
|
||||||
results.put(MetricsConstants.KILOMETERS_AND_METERS, kilometersAndMeters);
|
|
||||||
results.put(MetricsConstants.MILES_AND_FEET, milesAndFeet);
|
|
||||||
results.put(MetricsConstants.MILES_AND_METERS, milesAndMeters);
|
|
||||||
results.put(MetricsConstants.MILES_AND_YARDS, milesAndYards);
|
|
||||||
results.put(MetricsConstants.NAUTICAL_MILES, nauticalMiles);
|
|
||||||
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getFormattedAlt(double alt, OsmandApplication ctx) {
|
public static String getFormattedAlt(double alt, OsmandApplication ctx) {
|
||||||
OsmandSettings settings = ctx.getSettings();
|
OsmandSettings settings = ctx.getSettings();
|
||||||
MetricsConstants mc = settings.METRIC_SYSTEM.get();
|
MetricsConstants mc = settings.METRIC_SYSTEM.get();
|
||||||
|
return getFormattedAlt(alt, ctx, mc);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getFormattedAlt(double alt, OsmandApplication ctx, MetricsConstants mc) {
|
||||||
boolean useFeet = (mc == MetricsConstants.MILES_AND_FEET) || (mc == MetricsConstants.MILES_AND_YARDS);
|
boolean useFeet = (mc == MetricsConstants.MILES_AND_FEET) || (mc == MetricsConstants.MILES_AND_YARDS);
|
||||||
if (!useFeet) {
|
if (!useFeet) {
|
||||||
return ((int) (alt + 0.5)) + " " + ctx.getString(R.string.m);
|
return ((int) (alt + 0.5)) + " " + ctx.getString(R.string.m);
|
||||||
|
|
|
@ -1990,7 +1990,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unlock() {
|
public void unlock() {
|
||||||
changeKeyguardFlags(true, false);
|
changeKeyguardFlags(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -118,9 +118,11 @@ public class LockHelper implements SensorEventListener {
|
||||||
|
|
||||||
private void lock() {
|
private void lock() {
|
||||||
releaseWakeLocks();
|
releaseWakeLocks();
|
||||||
int unlockTime = turnScreenOnTime.get();
|
|
||||||
if (lockUIAdapter != null) {
|
if (lockUIAdapter != null) {
|
||||||
if (!(useSystemScreenTimeout.get() && turnScreenOnPowerButton.get()) && unlockTime != 0) {
|
boolean useSystemTimeout = useSystemScreenTimeout.get();
|
||||||
|
boolean usePowerButton = useSystemTimeout && turnScreenOnPowerButton.get()
|
||||||
|
|| !useSystemTimeout && turnScreenOnTime.get() == 0 && turnScreenOnPowerButton.get();
|
||||||
|
if (!usePowerButton) {
|
||||||
lockUIAdapter.lock();
|
lockUIAdapter.lock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1316,7 +1316,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
int iconId = menu.getRightIconId();
|
int iconId = menu.getRightIconId();
|
||||||
int sizeId = menu.isBigRightIcon() ? R.dimen.context_menu_big_icon_size : R.dimen.standard_icon_size;
|
int sizeId = menu.isBigRightIcon() ? R.dimen.context_menu_big_icon_size : R.dimen.standard_icon_size;
|
||||||
if (menu.getPointDescription().isFavorite() || menu.getPointDescription().isWpt()) {
|
if (menu.getPointDescription().isFavorite() || menu.getPointDescription().isWpt()) {
|
||||||
sizeId = R.dimen.favorites_icon_size;
|
sizeId = R.dimen.favorites_my_places_icon_size;
|
||||||
}
|
}
|
||||||
int iconViewSize = getResources().getDimensionPixelSize(sizeId);
|
int iconViewSize = getResources().getDimensionPixelSize(sizeId);
|
||||||
ViewGroup.LayoutParams params = iconView.getLayoutParams();
|
ViewGroup.LayoutParams params = iconView.getLayoutParams();
|
||||||
|
|
|
@ -58,11 +58,13 @@ import java.util.Calendar;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class AmenityMenuBuilder extends MenuBuilder {
|
public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
|
|
||||||
|
@ -529,9 +531,16 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
if ("ele".equals(key)) {
|
if ("ele".equals(key)) {
|
||||||
try {
|
try {
|
||||||
float distance = Float.parseFloat(vl);
|
float distance = Float.parseFloat(vl);
|
||||||
vl = OsmAndFormatter.getFormattedDistance(distance, app, true, metricSystem);
|
vl = OsmAndFormatter.getFormattedAlt(distance, app, metricSystem);
|
||||||
Map<MetricsConstants, String> distanceData = OsmAndFormatter.getDistanceData(app, distance);
|
String collapsibleVal;
|
||||||
collapsableView = getDistanceCollapsableView(new LinkedHashSet<>(distanceData.values()));
|
if (metricSystem == MetricsConstants.MILES_AND_FEET || metricSystem == MetricsConstants.MILES_AND_YARDS) {
|
||||||
|
collapsibleVal = OsmAndFormatter.getFormattedAlt(distance, app, MetricsConstants.KILOMETERS_AND_METERS);
|
||||||
|
} else {
|
||||||
|
collapsibleVal = OsmAndFormatter.getFormattedAlt(distance, app, MetricsConstants.MILES_AND_FEET);
|
||||||
|
}
|
||||||
|
Set<String> elevationData = new HashSet<>();
|
||||||
|
elevationData.add(collapsibleVal);
|
||||||
|
collapsableView = getDistanceCollapsableView(elevationData);
|
||||||
collapsable = true;
|
collapsable = true;
|
||||||
} catch (NumberFormatException ex) {
|
} catch (NumberFormatException ex) {
|
||||||
LOG.error(ex);
|
LOG.error(ex);
|
||||||
|
|
|
@ -206,7 +206,7 @@ public class FavouritesLayer extends OsmandMapLayer implements ContextMenuLayer.
|
||||||
|
|
||||||
private int getSmallIconId(String layer, int iconId) {
|
private int getSmallIconId(String layer, int iconId) {
|
||||||
String iconName = view.getResources().getResourceEntryName(iconId);
|
String iconName = view.getResources().getResourceEntryName(iconId);
|
||||||
return view.getResources().getIdentifier("map_" + iconName + "_" + layer + "_small"
|
return view.getResources().getIdentifier("ic_" + iconName + "_" + layer + "_small"
|
||||||
, "drawable", view.getContext().getPackageName());
|
, "drawable", view.getContext().getPackageName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
||||||
|
return (MapActivity) activity;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
public void setLanguageChangedCallback(CallbackWithObject<Boolean> languageChangedCallback) {
|
|
||||||
this.languageChangedCallback = languageChangedCallback;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,27 +220,16 @@ 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) {
|
|
||||||
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);
|
Bundle wikiPoiSetting = getWikiPoiSettingsForProfile(app, appMode);
|
||||||
if (wikiPoiSetting != null) {
|
if (wikiPoiSetting != null) {
|
||||||
refreshWikipediaOnMap(mapActivity);
|
refreshWikipediaOnMap(ma);
|
||||||
} else {
|
} else {
|
||||||
toggleWikipediaPoi(mapActivity, false, callback);
|
toggleWikipediaPoi(ma, false, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getTranslation(OsmandApplication app, String locale) {
|
public static String getTranslation(OsmandApplication app, String locale) {
|
||||||
String translation = app.getLangTranslation(locale);
|
String translation = app.getLangTranslation(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();
|
||||||
}
|
}
|
||||||
|
|