Merge branch 'r1.8' of ssh://github.com/osmandapp/Osmand into r1.8

This commit is contained in:
Victor Shcherb 2014-07-30 23:43:50 +02:00
commit 4ed026d49c
12 changed files with 65 additions and 31 deletions

7
OsmAnd/assets/style.css Normal file
View file

@ -0,0 +1,7 @@
h3 { text-align: center}
h4 { text-align: center}
div {border-width: 1px; padding: 10px;
border: groove; margin-left:auto;margin-right:auto; }
li { text-align:justify;"}
img { max-width: 75%; width: auto; height: auto; }
p.img {text-align: center}

View file

@ -18,7 +18,7 @@
<target name="copy_resources"> <target name="copy_resources">
<copy todir="assets"> <copy todir="assets">
<fileset dir="../../resources/" > <fileset dir="../../resources/" >
<include name="specialphrases/**"/> <include name="specialphrases/**"/>
<include name="voice/**/*.p"/> <include name="voice/**/*.p"/>
@ -34,11 +34,16 @@
<include name="*.xml"/> <include name="*.xml"/>
</fileset> </fileset>
</copy> </copy>
<copy todir="assets/help/"> <sync todir="assets/help/">
<fileset dir="../../help/" > <fileset dir="../../help/" >
<include name="*.html"/> <include name="*.html"/>
<include name="images/**/*.png"/> <include name="images/**/*.png"/>
</fileset> </fileset>
</sync>
<copy todir="assets/help">
<fileset dir="assets/" >
<include name="style.css"/>
</fileset>
</copy> </copy>
<copy todir="${src.absolute.dir}/net/osmand/render/"> <copy todir="${src.absolute.dir}/net/osmand/render/">
<fileset dir="../../resources/rendering_styles/" > <fileset dir="../../resources/rendering_styles/" >

View file

@ -225,7 +225,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
} }
public void hideProgressBar() { public void hideProgressBar() {
getSherlockActivity().setSupportProgressBarIndeterminateVisibility(false); if (getSherlockActivity() != null){
getSherlockActivity().setSupportProgressBarIndeterminateVisibility(false);
}
} }
private void updateSelectionMode(ActionMode m) { private void updateSelectionMode(ActionMode m) {
@ -963,7 +965,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
@Override @Override
protected void onPostExecute(Void result) { protected void onPostExecute(Void result) {
getSherlockActivity().setProgressBarIndeterminateVisibility(false); if (getSherlockActivity() != null){
getSherlockActivity().setProgressBarIndeterminateVisibility(false);
}
if (info.gpx != null){ if (info.gpx != null){
getMyApplication().getSelectedGpxHelper().selectGpxFile(info.gpx, selected, true); getMyApplication().getSelectedGpxHelper().selectGpxFile(info.gpx, selected, true);
listAdapter.notifyDataSetChanged(); listAdapter.notifyDataSetChanged();

View file

@ -343,7 +343,7 @@ public class MapActivity extends AccessibleActivity {
} else if ("google.navigation".equals(scheme) || "osmand.navigation".equals(scheme)) { } else if ("google.navigation".equals(scheme) || "osmand.navigation".equals(scheme)) {
final String schemeSpecificPart = data.getSchemeSpecificPart(); final String schemeSpecificPart = data.getSchemeSpecificPart();
final Matcher matcher = Pattern.compile("q=(.+?),(.+?)").matcher(schemeSpecificPart); final Matcher matcher = Pattern.compile("(?:q|ll)=([\\-0-9.]+),([\\-0-9.]+)(?:.*)").matcher(schemeSpecificPart);
if (matcher.matches()) { if (matcher.matches()) {
try { try {
final double lat = Double.valueOf(matcher.group(1)); final double lat = Double.valueOf(matcher.group(1));

View file

@ -157,7 +157,7 @@ public class StartGPSStatus extends OsmAndAction {
// if (g.activity.length() == 0) { // if (g.activity.length() == 0) {
PackageManager pm = mapActivity.getPackageManager(); PackageManager pm = mapActivity.getPackageManager();
try { try {
String appName = !g.paidAppName.isEmpty() && String appName = !g.paidAppName.equals("") &&
g.installed(mapActivity, g.paidAppName) ? g.paidAppName : g.appName; g.installed(mapActivity, g.paidAppName) ? g.paidAppName : g.appName;
intent = pm.getLaunchIntentForPackage(appName); intent = pm.getLaunchIntentForPackage(appName);
} catch (RuntimeException e) { } catch (RuntimeException e) {

View file

@ -321,6 +321,9 @@ public class GeoIntentActivity extends OsmandListActivity {
matcher = Pattern.compile(pattern).matcher(schemeSpecific); matcher = Pattern.compile(pattern).matcher(schemeSpecific);
} }
final String pattern2 = "([\\-0-9.]+),([\\-0-9.]+)(?:.*)"; //c:geo
final Matcher matcher2 = Pattern.compile(pattern2).matcher(schemeSpecific);
if (matcher.matches()) if (matcher.matches())
{ {
final double lat = Double.valueOf(matcher.group(1)); final double lat = Double.valueOf(matcher.group(1));
@ -333,9 +336,11 @@ public class GeoIntentActivity extends OsmandListActivity {
{ {
return new GeoPointSearch(lat, lon, Integer.valueOf(matcher.group(4))); return new GeoPointSearch(lat, lon, Integer.valueOf(matcher.group(4)));
} }
} } else if (matcher2.matches()) {
else final double lat = Double.valueOf(matcher2.group(1));
{ final double lon = Double.valueOf(matcher2.group(2));
return new GeoPointSearch(lat, lon);
} else {
return null; return null;
} }
} }

View file

@ -274,7 +274,7 @@ public class SearchAddressFragment extends SherlockFragment {
String city = settings.getLastSearchedCityName(); String city = settings.getLastSearchedCityName();
String cityName = !Algorithms.isEmpty(postcode) ? postcode : city; String cityName = !Algorithms.isEmpty(postcode) ? postcode : city;
ai.objectName = settings.getLastSearchedStreet(); ai.objectName = settings.getLastSearchedStreet();
ai.historyName = MessageFormat.format(ctx. getString(R.string.search_history_int_streets), settings.getLastSearchedStreet(), ai.historyName = MessageFormat.format(ctx != null ? ctx.getString(R.string.search_history_int_streets) : "", settings.getLastSearchedStreet(),
settings.getLastSearchedIntersectedStreet(), cityName); settings.getLastSearchedIntersectedStreet(), cityName);
ai.zoom = 17; ai.zoom = 17;
return ai; return ai;
@ -287,7 +287,7 @@ public class SearchAddressFragment extends SherlockFragment {
String cityName = !Algorithms.isEmpty(postcode) ? postcode : city; String cityName = !Algorithms.isEmpty(postcode) ? postcode : city;
String street = settings.getLastSearchedStreet(); String street = settings.getLastSearchedStreet();
ai.objectName = street; ai.objectName = street;
ai.historyName = MessageFormat.format(ctx.getString(R.string.search_history_street), street, cityName); ai.historyName = MessageFormat.format(ctx != null ? ctx.getString(R.string.search_history_street) : "", street, cityName);
ai.zoom = 16; ai.zoom = 16;
return ai; return ai;
} }
@ -301,7 +301,7 @@ public class SearchAddressFragment extends SherlockFragment {
String street = settings.getLastSearchedStreet(); String street = settings.getLastSearchedStreet();
String building = settings.getLastSearchedBuilding(); String building = settings.getLastSearchedBuilding();
ai.objectName = street + " " + building; ai.objectName = street + " " + building;
ai.historyName = MessageFormat.format(ctx.getString(R.string.search_history_building), building, street, ai.historyName = MessageFormat.format(ctx != null ? ctx.getString(R.string.search_history_building) : "", building, street,
cityName); cityName);
ai.zoom = 17; ai.zoom = 17;
return ai; return ai;
@ -310,7 +310,7 @@ public class SearchAddressFragment extends SherlockFragment {
public static AddressInformation buildCity(Context ctx, OsmandSettings settings){ public static AddressInformation buildCity(Context ctx, OsmandSettings settings){
AddressInformation ai = new AddressInformation(); AddressInformation ai = new AddressInformation();
String city = settings.getLastSearchedCityName(); String city = settings.getLastSearchedCityName();
ai.historyName = MessageFormat.format(ctx.getString(R.string.search_history_city), city); ai.historyName = MessageFormat.format(ctx != null ? ctx.getString(R.string.search_history_city) : "", city);
ai.objectName = city; ai.objectName = city;
ai.zoom = 14; ai.zoom = 14;
return ai; return ai;

View file

@ -439,7 +439,7 @@ public class SearchTransportFragment extends SherlockFragment implements SearchA
} }
public LatLon getEndStop(int position){ public LatLon getEndStop(int position){
if(position == -1){ if(position < 0){
return lastKnownMapLocation; return lastKnownMapLocation;
} }
RouteInfoLocation item = intermediateListAdapater.getItem(position); RouteInfoLocation item = intermediateListAdapater.getItem(position);

View file

@ -255,7 +255,7 @@ public class GpxImportHelper {
private String saveImport(final GPXUtilities.GPXFile gpxFile, final String fileName) { private String saveImport(final GPXUtilities.GPXFile gpxFile, final String fileName) {
final String warning; final String warning;
if (gpxFile.isEmpty()) { if (gpxFile.isEmpty() || fileName == null) {
warning = application.getString(R.string.error_reading_gpx); warning = application.getString(R.string.error_reading_gpx);
} else { } else {
final File importDir = application.getAppPath(IndexConstants.GPX_IMPORT_DIR); final File importDir = application.getAppPath(IndexConstants.GPX_IMPORT_DIR);

View file

@ -167,17 +167,23 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
header = getLayoutInflater().inflate(R.layout.osmo_groups_list_header, null); header = getLayoutInflater().inflate(R.layout.osmo_groups_list_header, null);
getExpandableListView().addHeaderView(header); getExpandableListView().addHeaderView(header);
CompoundButton trackr = (CompoundButton) header.findViewById(R.id.enable_tracker); CompoundButton trackr = (CompoundButton) header.findViewById(R.id.enable_tracker);
trackr.setChecked(osMoPlugin.getTracker().isEnabledTracker()); if(osMoPlugin != null && osMoPlugin.getTracker() != null){
trackr.setChecked(osMoPlugin.getTracker().isEnabledTracker());
}
trackr.setOnCheckedChangeListener(new OnCheckedChangeListener() { trackr.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked) { if(isChecked) {
osMoPlugin.getTracker().enableTracker(); if (osMoPlugin != null && osMoPlugin.getTracker() != null){
osMoPlugin.getTracker().enableTracker();
}
app.startNavigationService(NavigationService.USED_BY_LIVE); app.startNavigationService(NavigationService.USED_BY_LIVE);
app.getSettings().SERVICE_OFF_INTERVAL.set(0); app.getSettings().SERVICE_OFF_INTERVAL.set(0);
} else { } else {
osMoPlugin.getTracker().disableTracker(); if (osMoPlugin != null && osMoPlugin.getTracker() != null){
osMoPlugin.getTracker().disableTracker();
}
if (app.getNavigationService() != null) { if (app.getNavigationService() != null) {
app.getNavigationService().stopIfNeeded(app,NavigationService.USED_BY_LIVE); app.getNavigationService().stopIfNeeded(app,NavigationService.USED_BY_LIVE);
} }
@ -449,8 +455,10 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
if(device != null) { if(device != null) {
Location location = device.getLastLocation(); Location location = device.getLastLocation();
MapActivity.getMapViewTrackingUtilities().setMapLinkedToLocation(false); MapActivity.getMapViewTrackingUtilities().setMapLinkedToLocation(false);
app.getSettings().setMapLocationToShow(location.getLatitude(), location.getLongitude(), app.getSettings().getLastKnownMapZoom(), if (location != null){
null, device.getVisibleName(), device); app.getSettings().setMapLocationToShow(location.getLatitude(), location.getLongitude(), app.getSettings().getLastKnownMapZoom(),
null, device.getVisibleName(), device);
}
OsMoPositionLayer.setFollowTrackerId(device); OsMoPositionLayer.setFollowTrackerId(device);
MapActivity.launchMapActivityMoveToTop(OsMoGroupsActivity.this); MapActivity.launchMapActivityMoveToTop(OsMoGroupsActivity.this);
} }
@ -496,17 +504,19 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
Builder bld = new AlertDialog.Builder(this); Builder bld = new AlertDialog.Builder(this);
bld.setTitle(R.string.osmo_group); bld.setTitle(R.string.osmo_group);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
setFields(sb, R.string.osmo_group_name, group.name); if (group != null){
if(group.description != null) { setFields(sb, R.string.osmo_group_name, group.name);
setFields(sb, R.string.osmo_group_description, group.description); if(group.description != null) {
setFields(sb, R.string.osmo_group_description, group.description);
}
if(group.expireTime != 0) {
setFields(sb, R.string.osmo_expire_group, new Date(group.expireTime).toString());
}
if(group.policy != null) {
setFields(sb, R.string.osmo_group_policy, group.policy);
}
setFields(sb, R.string.osmo_connect_to_group_id, group.groupId);
} }
if(group.expireTime != 0) {
setFields(sb, R.string.osmo_expire_group, new Date(group.expireTime).toString());
}
if(group.policy != null) {
setFields(sb, R.string.osmo_group_policy, group.policy);
}
setFields(sb, R.string.osmo_connect_to_group_id, group.groupId);
ScrollView sv = new ScrollView(this); ScrollView sv = new ScrollView(this);
TextView tv = new TextView(this); TextView tv = new TextView(this);
sv.addView(tv); sv.addView(tv);

View file

@ -390,7 +390,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
r.setMinZoom(Integer.parseInt(minZoom.getText().toString())); r.setMinZoom(Integer.parseInt(minZoom.getText().toString()));
r.setMaxZoom(Integer.parseInt(maxZoom.getText().toString())); r.setMaxZoom(Integer.parseInt(maxZoom.getText().toString()));
r.setEllipticYTile(elliptic.isChecked()); r.setEllipticYTile(elliptic.isChecked());
r.setUrlToLoad(urlToLoad.getText().toString().isEmpty() ? null : urlToLoad.getText().toString().replace("{$x}", "{1}") r.setUrlToLoad(urlToLoad.getText().toString().equals("") ? null : urlToLoad.getText().toString().replace("{$x}", "{1}")
.replace("{$y}", "{2}").replace("{$z}", "{0}")); .replace("{$y}", "{2}").replace("{$z}", "{0}"));
if (r != null && r.getName().length() > 0) { if (r != null && r.getName().length() > 0) {
if (settings.installTileSource(r)) { if (settings.installTileSource(r)) {

View file

@ -54,6 +54,9 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
try { try {
for (int i = 0; i < objects.size(); i++) { for (int i = 0; i < objects.size(); i++) {
TransportStop n = objects.get(i); TransportStop n = objects.get(i);
if (n.getLocation() == null){
continue;
}
int x = (int) tb.getPixXFromLatLon(n.getLocation().getLatitude(), n.getLocation().getLongitude()); int x = (int) tb.getPixXFromLatLon(n.getLocation().getLatitude(), n.getLocation().getLongitude());
int y = (int) tb.getPixYFromLatLon(n.getLocation().getLatitude(), n.getLocation().getLongitude()); int y = (int) tb.getPixYFromLatLon(n.getLocation().getLatitude(), n.getLocation().getLongitude());
if (Math.abs(x - ex) <= radius && Math.abs(y - ey) <= radius) { if (Math.abs(x - ex) <= radius && Math.abs(y - ey) <= radius) {