Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-10-12 23:43:59 +02:00
commit bd00c3124f
21 changed files with 69 additions and 26 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 5 KiB

View file

@ -247,6 +247,11 @@
\u2022 GPX split intervals with detailed info about your track\n\n
\u2022 Other improvements and bug fixes\n\n
</string>
<string name="release_2_8">
\u2022 Completely reworked map markers with guidelines and route planning\n\n
\u2022 Measure distance tool offering snap to road feature and saving points as track\n\n
\u2022 OSM Live: bug fixes, fresh data on the server every 30 minutes, updates implemented into the navigation\n\n
</string>
<string name="auto_split_recording_title">Auto-split recordings after gap</string>
<string name="auto_split_recording_descr">Start new segment after gap of 6 min, new track after gap of 2 h, or new file after longer gap if date has changed.</string>
<string name="rendering_attr_contourDensity_description">Contour lines density</string>

View file

@ -1,5 +1,7 @@
package net.osmand.plus;
import android.support.annotation.Nullable;
import net.osmand.IndexConstants;
import net.osmand.plus.GPXUtilities.GPXTrackAnalysis;
import net.osmand.plus.api.SQLiteAPI.SQLiteConnection;
@ -491,6 +493,7 @@ public class GPXDatabase {
return items;
}
@Nullable
public GpxDataItem getItem(File file) {
GpxDataItem result = null;
SQLiteConnection db = openConnection(true);

View file

@ -73,9 +73,9 @@ public class OsmAndLocationProvider implements SensorEventListener {
private static final long STALE_LOCATION_TIMEOUT = 1000 * 60 * 5; // 5 minutes
private static final long STALE_LOCATION_TIMEOUT_FOR_UI = 1000 * 60 * 15; // 15 minutes
private static final int UPDATES_BEFORE_CHECK_LOCATION = 100;
private int updatesCounter;
private int updatesCounterUi;
private static final int REQUESTS_BEFORE_CHECK_LOCATION = 100;
private int locationRequestsCounter;
private int staleLocationRequestsCounter;
private net.osmand.Location cachedLocation;
@ -868,35 +868,33 @@ public class OsmAndLocationProvider implements SensorEventListener {
}
public net.osmand.Location getLastKnownLocation() {
if (location != null && updatesCounter == 0) {
if ((System.currentTimeMillis() - location.getTime()) > STALE_LOCATION_TIMEOUT) {
location = null;
}
if (location != null && locationRequestsCounter == 0
&& System.currentTimeMillis() - location.getTime() > STALE_LOCATION_TIMEOUT) {
location = null;
}
if (updatesCounter == UPDATES_BEFORE_CHECK_LOCATION) {
updatesCounter = 0;
if (locationRequestsCounter == REQUESTS_BEFORE_CHECK_LOCATION) {
locationRequestsCounter = 0;
} else {
updatesCounter++;
locationRequestsCounter++;
}
return location;
}
@Nullable
public net.osmand.Location getLastStaleKnownLocation() {
if (updatesCounterUi == 0) {
net.osmand.Location newLoc = getLastKnownLocation();
if (newLoc == null) {
if (cachedLocation != null && System.currentTimeMillis() - cachedLocation.getTime() > STALE_LOCATION_TIMEOUT_FOR_UI) {
cachedLocation = null;
}
} else {
cachedLocation = newLoc;
net.osmand.Location newLoc = getLastKnownLocation();
if (newLoc == null) {
if (staleLocationRequestsCounter == 0 && cachedLocation != null
&& System.currentTimeMillis() - cachedLocation.getTime() > STALE_LOCATION_TIMEOUT_FOR_UI) {
cachedLocation = null;
}
}
if (updatesCounterUi == UPDATES_BEFORE_CHECK_LOCATION) {
updatesCounterUi = 0;
} else {
updatesCounterUi++;
cachedLocation = newLoc;
}
if (staleLocationRequestsCounter == REQUESTS_BEFORE_CHECK_LOCATION) {
staleLocationRequestsCounter = 0;
} else {
staleLocationRequestsCounter++;
}
return cachedLocation;
}

View file

@ -86,6 +86,10 @@ public abstract class OsmandPlugin {
return active;
}
public boolean isVisible() {
return true;
}
public boolean needsInstallation() {
return installURL != null;
}
@ -127,7 +131,10 @@ public abstract class OsmandPlugin {
public static void initPlugins(OsmandApplication app) {
OsmandSettings settings = app.getSettings();
Set<String> enabledPlugins = settings.getEnabledPlugins();
allPlugins.add(new MapillaryPlugin(app));
enabledPlugins.add(MapillaryPlugin.ID);
allPlugins.add(new OsmandRasterMapsPlugin(app));
allPlugins.add(new OsmandMonitoringPlugin(app));
// allPlugins.add(new OsMoPlugin(app));
@ -141,7 +148,7 @@ public abstract class OsmandPlugin {
// checkMarketPlugin(app, new RoutePointsPlugin(app), false /*FIXME*/, RoutePointsPlugin.ROUTE_POINTS_PLUGIN_COMPONENT, null);
allPlugins.add(new AudioVideoNotesPlugin(app));
checkMarketPlugin(app, new ParkingPositionPlugin(app), false, ParkingPositionPlugin.PARKING_PLUGIN_COMPONENT, null);
allPlugins.add(new DistanceCalculatorPlugin(app));
//allPlugins.add(new DistanceCalculatorPlugin(app));
allPlugins.add(new AccessibilityPlugin(app));
allPlugins.add(new OsmEditingPlugin(app));
allPlugins.add(new OsmandDevelopmentPlugin(app));
@ -303,6 +310,16 @@ public abstract class OsmandPlugin {
return allPlugins;
}
public static List<OsmandPlugin> getVisiblePlugins() {
List<OsmandPlugin> list = new ArrayList<>(allPlugins.size());
for (OsmandPlugin p : allPlugins) {
if (p.isVisible()) {
list.add(p);
}
}
return list;
}
public static List<OsmandPlugin> getEnabledPlugins() {
ArrayList<OsmandPlugin> lst = new ArrayList<OsmandPlugin>(allPlugins.size());
for (OsmandPlugin p : allPlugins) {

View file

@ -76,7 +76,7 @@ public class PluginsActivity extends OsmandListActivity {
protected class PluginsListAdapter extends ArrayAdapter<OsmandPlugin> {
public PluginsListAdapter() {
super(PluginsActivity.this, R.layout.plugins_list_item,
OsmandPlugin.getAvailablePlugins());
OsmandPlugin.getVisiblePlugins());
}
@Override

View file

@ -28,7 +28,7 @@ public class WhatsNewDialogFragment extends DialogFragment {
final OsmandApplication osmandApplication = (OsmandApplication) getActivity().getApplication();
final String appVersion = Version.getAppVersion(osmandApplication);
builder.setTitle(getString(R.string.whats_new) + " " + appVersion)
.setMessage(getString(R.string.release_2_7))
.setMessage(getString(R.string.release_2_8))
.setNegativeButton(R.string.shared_string_close, null);
if (AppInitializer.LATEST_CHANGES_URL != null) {
builder.setPositiveButton(R.string.read_more, new DialogInterface.OnClickListener() {

View file

@ -3,6 +3,8 @@ package net.osmand.plus.mapcontextmenu.controllers;
import net.osmand.NativeLibrary.RenderedObject;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.osm.AbstractPoiType;
import net.osmand.osm.MapPoiTypes;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
@ -12,6 +14,8 @@ import net.osmand.plus.osmedit.OsmEditingPlugin;
import net.osmand.plus.render.RenderingIcons;
import net.osmand.util.Algorithms;
import java.util.Map;
public class RenderedObjectMenuController extends MenuController {
private RenderedObject renderedObject;
@ -85,6 +89,17 @@ public class RenderedObjectMenuController extends MenuController {
@Override
public void addPlainMenuItems(String typeStr, PointDescription pointDescription, final LatLon latLon) {
MapPoiTypes poiTypes = getMapActivity().getMyApplication().getPoiTypes();
for (Map.Entry<String, String> entry : renderedObject.getTags().entrySet()) {
if (entry.getKey().equalsIgnoreCase("maxheight")) {
AbstractPoiType pt = poiTypes.getAnyPoiAdditionalTypeByKey(entry.getKey());
if (pt != null) {
addPlainMenuItem(R.drawable.ic_action_note_dark, pt.getTranslation() + ": " + entry.getValue(), false, false, null);
}
}
}
boolean osmEditingEnabled = OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class) != null;
if (osmEditingEnabled && renderedObject.getId() != null
&& renderedObject.getId() > 0 &&

View file

@ -56,6 +56,11 @@ public class MapillaryPlugin extends OsmandPlugin {
settings = app.getSettings();
}
@Override
public boolean isVisible() {
return false;
}
@Override
public int getLogoResourceId() {
return R.drawable.ic_action_mapillary;

View file

@ -282,7 +282,7 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
List<GpxDisplayGroup> groups = g.getDisplayGroups();
if (groups != null && !groups.isEmpty()) {
GpxDataItem gpxDataItem = view.getApplication().getGpxDatabase().getItem(new File(g.getGpxFile().path));
int color = gpxDataItem.getColor();
int color = gpxDataItem != null ? gpxDataItem.getColor() : 0;
if (color == 0) {
color = g.getModifiableGpxFile().getColor(0);
}