Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-08-31 12:48:37 +02:00
commit 2f7eac35cb
17 changed files with 405 additions and 44 deletions

View file

@ -11,7 +11,9 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import net.osmand.PlatformUtil;
import net.osmand.ResultMatcher;
@ -205,14 +207,16 @@ public class BinaryMapRouteReaderAdapter {
public static class RouteRegion extends BinaryIndexPart {
public int regionsRead;
public List<RouteTypeRule> routeEncodingRules = new ArrayList<BinaryMapRouteReaderAdapter.RouteTypeRule>();
public Map<String, Integer> decodingRules = null;
List<RouteSubregion> subregions = new ArrayList<RouteSubregion>();
List<RouteSubregion> basesubregions = new ArrayList<RouteSubregion>();
List<RouteTypeRule> routeEncodingRules = new ArrayList<BinaryMapRouteReaderAdapter.RouteTypeRule>();
int nameTypeRule = -1;
int refTypeRule = -1;
int destinationTypeRule = -1;
int destinationRefTypeRule = -1;
private RouteRegion referenceRouteRegion;
public String getPartName() {
return "Routing";
@ -223,11 +227,28 @@ public class BinaryMapRouteReaderAdapter {
return OsmandOdb.OsmAndStructure.ROUTINGINDEX_FIELD_NUMBER;
}
public int searchRouteEncodingRule(String tag, String value) {
if(decodingRules == null) {
decodingRules = new LinkedHashMap<String, Integer>();
for(int i = 1; i < routeEncodingRules.size(); i++) {
RouteTypeRule rt = routeEncodingRules.get(i);
String ks = rt.getTag() +"#" + (rt.getValue() == null ? "" : rt.getValue());
decodingRules.put(ks, i);
}
}
String k = tag +"#" + (value == null ? "" : value);
if(decodingRules.containsKey(k)) {
return decodingRules.get(k).intValue();
}
return -1;
}
public RouteTypeRule quickGetEncodingRule(int id) {
return routeEncodingRules.get(id);
}
private void initRouteEncodingRule(int id, String tags, String val) {
public void initRouteEncodingRule(int id, String tags, String val) {
decodingRules = null;
while (routeEncodingRules.size() <= id) {
routeEncodingRules.add(null);
}
@ -291,6 +312,101 @@ public class BinaryMapRouteReaderAdapter {
}
return false;
}
public RouteDataObject adopt(RouteDataObject o) {
if(o.region == this || o.region == referenceRouteRegion) {
return o;
}
if(routeEncodingRules.isEmpty()) {
routeEncodingRules.addAll(o.region.routeEncodingRules);
referenceRouteRegion= o.region;
return o;
}
RouteDataObject rdo = new RouteDataObject(this);
rdo.pointsX = o.pointsX;
rdo.pointsY = o.pointsY;
rdo.id = o.id;
rdo.restrictions = o.restrictions;
if (o.types != null) {
rdo.types = new int[o.types.length];
for (int i = 0; i < o.types.length; i++) {
RouteTypeRule tp = o.region.routeEncodingRules.get(o.types[i]);
int ruleId = searchRouteEncodingRule(tp.getTag(), tp.getValue());
if(ruleId != -1) {
rdo.types[i] = ruleId;
} else {
ruleId = routeEncodingRules.size() ;
initRouteEncodingRule(ruleId, tp.getTag(), tp.getValue());
rdo.types[i] = ruleId;
}
}
}
if (o.pointTypes != null) {
rdo.pointTypes = new int[o.pointTypes.length][];
for (int i = 0; i < o.pointTypes.length; i++) {
if (o.pointTypes[i] != null) {
rdo.pointTypes[i] = new int[o.pointTypes[i].length];
for (int j = 0; j < o.pointTypes[i].length; j++) {
RouteTypeRule tp = o.region.routeEncodingRules.get(o.pointTypes[i][j]);
int ruleId = searchRouteEncodingRule(tp.getTag(), tp.getValue());
if(ruleId != -1) {
rdo.pointTypes[i][j] = ruleId;
} else {
ruleId = routeEncodingRules.size() ;
initRouteEncodingRule(ruleId, tp.getTag(), tp.getValue());
rdo.pointTypes[i][j] = ruleId;
}
}
}
}
}
if (o.nameIds != null) {
rdo.nameIds = new int[o.nameIds.length];
rdo.names = new TIntObjectHashMap<>();
for (int i = 0; i < o.nameIds.length; i++) {
RouteTypeRule tp = o.region.routeEncodingRules.get(o.nameIds[i]);
int ruleId = searchRouteEncodingRule(tp.getTag(), null);
if(ruleId != -1) {
rdo.nameIds[i] = ruleId;
} else {
ruleId = routeEncodingRules.size() ;
initRouteEncodingRule(ruleId, tp.getTag(), null);
rdo.nameIds[i] = ruleId;
}
rdo.names.put(ruleId, o.names.get(o.nameIds[i]));
}
}
rdo.pointNames = o.pointNames;
if (o.pointNameTypes != null) {
rdo.pointNameTypes = new int[o.pointNameTypes.length][];
// rdo.pointNames = new String[o.pointNameTypes.length][];
for (int i = 0; i < o.pointNameTypes.length; i++) {
if (o.pointNameTypes[i] != null) {
rdo.pointNameTypes[i] = new int[o.pointNameTypes[i].length];
// rdo.pointNames[i] = new String[o.pointNameTypes[i].length];
for (int j = 0; j < o.pointNameTypes[i].length; j++) {
RouteTypeRule tp = o.region.routeEncodingRules.get(o.pointNameTypes[i][j]);
int ruleId = searchRouteEncodingRule(tp.getTag(), null);
if(ruleId != -1) {
rdo.pointNameTypes[i][j] = ruleId;
} else {
ruleId = routeEncodingRules.size() ;
initRouteEncodingRule(ruleId, tp.getTag(), tp.getValue());
rdo.pointNameTypes[i][j] = ruleId;
}
// rdo.pointNames[i][j] = o.pointNames[i][j];
}
}
}
}
return rdo;
}
}
// Used in C++
@ -360,7 +476,7 @@ public class BinaryMapRouteReaderAdapter {
protected void readRouteIndex(RouteRegion region) throws IOException {
int routeEncodingRule =1;
int routeEncodingRule = 1;
while(true){
int t = codedIS.readTag();
int tag = WireFormat.getTagFieldNumber(t);

View file

@ -4,6 +4,7 @@ package net.osmand.binary;
import gnu.trove.map.hash.TIntObjectHashMap;
import java.text.MessageFormat;
import java.util.Arrays;
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteRegion;
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule;
@ -63,6 +64,105 @@ public class RouteDataObject {
this.id = copy.id;
}
public boolean compareRoute(RouteDataObject thatObj) {
if (this.id == thatObj.id
&& Arrays.equals(this.pointsX, thatObj.pointsX)
&& Arrays.equals(this.pointsY, thatObj.pointsY)) {
if (this.region == null) {
throw new IllegalStateException("Illegal routing object: " + id);
}
if (thatObj.region == null) {
throw new IllegalStateException("Illegal routing object: " + thatObj.id);
}
boolean equals = true;
equals = equals && Arrays.equals(this.restrictions, thatObj.restrictions);
if (equals) {
if (this.names != null && thatObj.names != null) {
equals = Arrays.equals(this.names.values(), thatObj.names.values());
}
}
if (equals) {
if (this.types == null || thatObj.types == null) {
equals = this.types == thatObj.types;
} else if (types.length != thatObj.types.length) {
equals = false;
} else {
for (int i = 0; i < this.types.length && equals; i++) {
String thisTag = region.routeEncodingRules.get(types[i]).getTag();
String thisValue = region.routeEncodingRules.get(types[i]).getValue();
String thatTag = thatObj.region.routeEncodingRules.get(thatObj.types[i]).getTag();
String thatValue = thatObj.region.routeEncodingRules.get(thatObj.types[i]).getValue();
equals = (thisTag.equals(thatTag) && thisValue.equals(thatValue));
}
}
}
if (equals) {
if (this.nameIds == null || thatObj.nameIds == null) {
equals = this.nameIds == thatObj.nameIds;
} else if (nameIds.length != thatObj.nameIds.length) {
equals = false;
} else {
for (int i = 0; i < this.nameIds.length && equals; i++) {
String thisTag = region.routeEncodingRules.get(nameIds[i]).getTag();
String thisValue = names.get(nameIds[i]);
String thatTag = thatObj.region.routeEncodingRules.get(thatObj.nameIds[i]).getTag();
String thatValue = thatObj.names.get(thatObj.nameIds[i]);
equals = (Algorithms.objectEquals(thisTag, thatTag) && Algorithms.objectEquals(thisValue, thatValue));
}
}
}
if (equals) {
if (this.pointTypes == null || thatObj.pointTypes == null) {
equals = this.pointTypes == thatObj.pointTypes;
} else if (pointTypes.length != thatObj.pointTypes.length) {
equals = false;
} else {
for (int i = 0; i < this.pointTypes.length && equals; i++) {
if (this.pointTypes[i] == null || thatObj.pointTypes[i] == null) {
equals = this.pointTypes[i] == thatObj.pointTypes[i];
} else if (pointTypes[i].length != thatObj.pointTypes[i].length) {
equals = false;
} else {
for (int j = 0; j < this.pointTypes[i].length && equals; j++) {
String thisTag = region.routeEncodingRules.get(pointTypes[i][j]).getTag();
String thisValue = region.routeEncodingRules.get(pointTypes[i][j]).getValue();
String thatTag = thatObj.region.routeEncodingRules.get(thatObj.pointTypes[i][j]).getTag();
String thatValue = thatObj.region.routeEncodingRules.get(thatObj.pointTypes[i][j]).getValue();
equals = (Algorithms.objectEquals(thisTag, thatTag) && Algorithms.objectEquals(thisValue, thatValue));
}
}
}
}
}
if (equals) {
if (this.pointNameTypes == null || thatObj.pointNameTypes == null) {
equals = this.pointNameTypes == thatObj.pointNameTypes;
} else if (pointNameTypes.length != thatObj.pointNameTypes.length) {
equals = false;
} else {
for (int i = 0; i < this.pointNameTypes.length && equals; i++) {
if (this.pointNameTypes[i] == null || thatObj.pointNameTypes[i] == null) {
equals = this.pointNameTypes[i] == thatObj.pointNameTypes[i];
} else if (pointNameTypes[i].length != thatObj.pointNameTypes[i].length) {
equals = false;
} else {
for (int j = 0; j < this.pointNameTypes[i].length && equals; j++) {
String thisTag = region.routeEncodingRules.get(pointNameTypes[i][j]).getTag();
String thisValue = pointNames[i][j];
String thatTag = thatObj.region.routeEncodingRules.get(thatObj.pointNameTypes[i][j]).getTag();
String thatValue = thatObj.pointNames[i][j];
equals = (Algorithms.objectEquals(thisTag, thatTag) && Algorithms.objectEquals(thisValue, thatValue));
}
}
}
}
}
}
return false;
}
public float[] calculateHeightArray() {
if(heightDistanceArray != null) {
return heightDistanceArray;

View file

@ -10,7 +10,7 @@
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="do_not_use_animations">Do not use animations</string>
<string name="do_not_use_animations_descr">It disables animations in app</string>
<string name="do_not_use_animations_descr">Disables animations in the app</string>
<string name="keep_showing_on_map">Keep showing on map</string>
<string name="exit_without_saving">Exit without saving?</string>
<string name="line">Line</string>
@ -133,7 +133,7 @@
<string name="do_not_send_anonymous_app_usage">Do not send anonymous app usage statistics</string>
<string name="do_not_send_anonymous_app_usage_desc">OsmAnd collects information about which parts of the app you open. Your location is never sent, nor is anything you enter into the app or details of areas you view, search, or download.</string>
<string name="do_not_show_startup_messages">Do not show messages at startup</string>
<string name="do_not_show_startup_messages_desc">It displays app discounts &amp; special local events messages</string>
<string name="do_not_show_startup_messages_desc">Suppresses displaying app discounts &amp; special local event messages</string>
<string name="parking_options">Parking options</string>
<string name="full_version_thanks">Thank you for purchasing the full version of OsmAnd!</string>
<string name="routing_attr_relief_smoothness_factor_hills_name">Hilly</string>

View file

@ -22,6 +22,8 @@ import net.osmand.aidl.calculateroute.CalculateRouteParams;
import net.osmand.aidl.gpx.ImportGpxParams;
import net.osmand.aidl.gpx.ShowGpxParams;
import net.osmand.aidl.gpx.StartGpxRecordingParams;
import net.osmand.aidl.gpx.StopGpxRecordingParams;
import net.osmand.aidl.gpx.HideGpxParams;
import net.osmand.aidl.gpx.ASelectedGpxFile;
@ -77,4 +79,7 @@ interface IOsmAndAidlInterface {
boolean removeFavorite(in RemoveFavoriteParams params);
boolean updateFavorite(in UpdateFavoriteParams params);
boolean startGpxRecording(in StartGpxRecordingParams params);
boolean stopGpxRecording(in StopGpxRecordingParams params);
}

View file

@ -13,6 +13,8 @@ import net.osmand.IndexConstants;
import net.osmand.aidl.favorite.AFavorite;
import net.osmand.aidl.favorite.group.AFavoriteGroup;
import net.osmand.aidl.gpx.ASelectedGpxFile;
import net.osmand.aidl.gpx.StartGpxRecordingParams;
import net.osmand.aidl.gpx.StopGpxRecordingParams;
import net.osmand.aidl.maplayer.AMapLayer;
import net.osmand.aidl.maplayer.point.AMapPoint;
import net.osmand.aidl.mapmarker.AMapMarker;
@ -29,9 +31,11 @@ import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dialogs.ConfigureMapMenu;
import net.osmand.plus.helpers.ColorDialogs;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.views.AidlMapLayer;
import net.osmand.plus.views.MapInfoLayer;
import net.osmand.plus.views.OsmandMapLayer;
@ -841,4 +845,24 @@ public class OsmandAidlApi {
app.sendBroadcast(intent);
return true;
}
boolean startGpxRecording(StartGpxRecordingParams params) {
final OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class);
if (plugin != null) {
plugin.startGPXMonitoring(null);
plugin.updateControl();
return true;
}
return false;
}
boolean stopGpxRecording(StopGpxRecordingParams params) {
final OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class);
if (plugin != null) {
plugin.stopRecording();
plugin.updateControl();
return true;
}
return false;
}
}

View file

@ -16,6 +16,8 @@ import net.osmand.aidl.gpx.ASelectedGpxFile;
import net.osmand.aidl.gpx.HideGpxParams;
import net.osmand.aidl.gpx.ImportGpxParams;
import net.osmand.aidl.gpx.ShowGpxParams;
import net.osmand.aidl.gpx.StartGpxRecordingParams;
import net.osmand.aidl.gpx.StopGpxRecordingParams;
import net.osmand.aidl.map.SetMapLocationParams;
import net.osmand.aidl.maplayer.AddMapLayerParams;
import net.osmand.aidl.maplayer.RemoveMapLayerParams;
@ -320,5 +322,23 @@ public class OsmandAidlService extends Service {
return true;
}
}
@Override
public boolean startGpxRecording(StartGpxRecordingParams params) throws RemoteException {
try {
return getApi().startGpxRecording(params);
} catch (Exception e) {
return false;
}
}
@Override
public boolean stopGpxRecording(StopGpxRecordingParams params) throws RemoteException {
try {
return getApi().stopGpxRecording(params);
} catch (Exception e) {
return false;
}
}
};
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.gpx;
parcelable StartGpxRecordingParams;

View file

@ -0,0 +1,40 @@
package net.osmand.aidl.gpx;
import android.os.Parcel;
import android.os.Parcelable;
public class StartGpxRecordingParams implements Parcelable {
public StartGpxRecordingParams() {
}
public StartGpxRecordingParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<StartGpxRecordingParams> CREATOR = new Creator<StartGpxRecordingParams>() {
@Override
public StartGpxRecordingParams createFromParcel(Parcel in) {
return new StartGpxRecordingParams(in);
}
@Override
public StartGpxRecordingParams[] newArray(int size) {
return new StartGpxRecordingParams[size];
}
};
@Override
public void writeToParcel(Parcel out, int flags) {
}
private void readFromParcel(Parcel in) {
}
@Override
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.gpx;
parcelable StopGpxRecordingParams;

View file

@ -0,0 +1,40 @@
package net.osmand.aidl.gpx;
import android.os.Parcel;
import android.os.Parcelable;
public class StopGpxRecordingParams implements Parcelable {
public StopGpxRecordingParams() {
}
public StopGpxRecordingParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<StopGpxRecordingParams> CREATOR = new Creator<StopGpxRecordingParams>() {
@Override
public StopGpxRecordingParams createFromParcel(Parcel in) {
return new StopGpxRecordingParams(in);
}
@Override
public StopGpxRecordingParams[] newArray(int size) {
return new StopGpxRecordingParams[size];
}
};
@Override
public void writeToParcel(Parcel out, int flags) {
}
private void readFromParcel(Parcel in) {
}
@Override
public int describeContents() {
return 0;
}
}

View file

@ -256,19 +256,27 @@ public class OsmandSettings {
}
public boolean isWifiConnected() {
ConnectivityManager mgr = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo ni = mgr.getActiveNetworkInfo();
return ni != null && ni.getType() == ConnectivityManager.TYPE_WIFI;
try {
ConnectivityManager mgr = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo ni = mgr.getActiveNetworkInfo();
return ni != null && ni.getType() == ConnectivityManager.TYPE_WIFI;
} catch (Exception e) {
return false;
}
}
private boolean isInternetConnected() {
ConnectivityManager mgr = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo active = mgr.getActiveNetworkInfo();
if (active == null) {
try {
ConnectivityManager mgr = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo active = mgr.getActiveNetworkInfo();
if (active == null) {
return false;
} else {
NetworkInfo.State state = active.getState();
return state != NetworkInfo.State.DISCONNECTED && state != NetworkInfo.State.DISCONNECTING;
}
} catch (Exception e) {
return false;
} else {
NetworkInfo.State state = active.getState();
return state != NetworkInfo.State.DISCONNECTED && state != NetworkInfo.State.DISCONNECTING;
}
}

View file

@ -6,6 +6,7 @@ import android.database.sqlite.SQLiteOpenHelper;
import android.text.format.DateFormat;
import net.osmand.PlatformUtil;
import net.osmand.data.LatLon;
import net.osmand.plus.GPXDatabase.GpxDataItem;
import net.osmand.plus.GPXUtilities;
import net.osmand.plus.GPXUtilities.GPXFile;
import net.osmand.plus.GPXUtilities.GPXTrackAnalysis;
@ -226,6 +227,11 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
warnings.add(warn);
return warnings;
}
GPXFile gpx = data.get(f);
GPXTrackAnalysis analysis = gpx.getAnalysis(fout.lastModified());
GpxDataItem item = new GpxDataItem(fout, analysis);
ctx.getGpxDatabase().add(item);
}
}
}

View file

@ -479,6 +479,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR
}
misc.addPreference(createCheckBoxPreference(settings.DO_NOT_SHOW_STARTUP_MESSAGES, R.string.do_not_show_startup_messages, R.string.do_not_show_startup_messages_desc));
misc.addPreference(createCheckBoxPreference(settings.DO_NOT_USE_ANIMATIONS, R.string.do_not_use_animations, R.string.do_not_use_animations_descr));
misc.addPreference(createCheckBoxPreference(settings.USE_MAGNETIC_FIELD_SENSOR_COMPASS, R.string.use_magnetic_sensor, R.string.use_magnetic_sensor_descr));
}

View file

@ -51,11 +51,6 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
cat.addPreference(createCheckBoxPreference(settings.USE_FAST_RECALCULATION,
R.string.use_fast_recalculation, R.string.use_fast_recalculation_desc));
cat.addPreference(createCheckBoxPreference(settings.USE_MAGNETIC_FIELD_SENSOR_COMPASS,
R.string.use_magnetic_sensor,
R.string.use_magnetic_sensor_descr));
final CheckBoxPreference openGlRender = createCheckBoxPreference(settings.USE_OPENGL_RENDER, R.string.use_opengl_render,R.string.use_opengl_render_descr);
cat.addPreference(openGlRender);

View file

@ -467,7 +467,7 @@ public class GpxUiHelper {
final ContextMenuItem item = adapter.getItem(position);
GPXInfo info = list.get(position);
udpateGpxInfoView(v, item, info, getDataItem(info), showCurrentGpx && position == 0, app);
updateGpxInfoView(v, item, info, getDataItem(info), showCurrentGpx && position == 0, app);
if (item.getSelected() == null) {
v.findViewById(R.id.check_item).setVisibility(View.GONE);
@ -704,7 +704,7 @@ public class GpxUiHelper {
return dlg;
}
public static void udpateGpxInfoView(View v, ContextMenuItem item, GPXInfo info, GpxDataItem dataItem, boolean currentlyRecordingTrack, OsmandApplication app) {
public static void updateGpxInfoView(View v, ContextMenuItem item, GPXInfo info, GpxDataItem dataItem, boolean currentlyRecordingTrack, OsmandApplication app) {
TextView viewName = ((TextView) v.findViewById(R.id.name));
viewName.setText(item.getTitle().replace("/", "").trim());
ImageView icon = (ImageView) v.findViewById(R.id.icon);

View file

@ -1410,21 +1410,25 @@ public class MeasurementToolFragment extends Fragment {
builder.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
final String name = new SimpleDateFormat("yyyy-MM-dd_HH-mm_EEE", Locale.US).format(new Date());
String fileName = name + GPX_SUFFIX;
File fout = new File(dir, fileName);
int ind = 1;
while (fout.exists()) {
fileName = name + "_" + (++ind) + GPX_SUFFIX;
fout = new File(dir, fileName);
}
SaveType saveType;
if (editingCtx.isInSnapToRoadMode()) {
saveType = SaveType.SNAP_TO_ROAD;
if (showOnMapToggle.isChecked()) {
final String name = new SimpleDateFormat("yyyy-MM-dd_HH-mm_EEE", Locale.US).format(new Date());
String fileName = name + GPX_SUFFIX;
File fout = new File(dir, fileName);
int ind = 1;
while (fout.exists()) {
fileName = name + "_" + (++ind) + GPX_SUFFIX;
fout = new File(dir, fileName);
}
SaveType saveType;
if (editingCtx.isInSnapToRoadMode()) {
saveType = SaveType.SNAP_TO_ROAD;
} else {
saveType = SaveType.LINE;
}
saveNewGpx(dir, fileName, true, saveType, true);
} else {
saveType = SaveType.LINE;
dismiss(mapActivity);
}
saveNewGpx(dir, fileName, showOnMapToggle.isChecked(), saveType, true);
}
});
} else {
@ -1441,12 +1445,7 @@ public class MeasurementToolFragment extends Fragment {
}
builder.setTitle(getString(R.string.exit_without_saving))
.setMessage(getString(R.string.unsaved_changes_will_be_lost))
.setNegativeButton(R.string.shared_string_cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dismiss(mapActivity);
}
});
.setNegativeButton(R.string.shared_string_cancel, null);
builder.show();
}
}

View file

@ -213,7 +213,8 @@ public class AnimateDraggingMapThread {
final float mMoveX = rb.getPixXFromLatLon(startLat, startLon) - rb.getPixXFromLatLon(finalLat, finalLon);
final float mMoveY = rb.getPixYFromLatLon(startLat, startLon) - rb.getPixYFromLatLon(finalLat, finalLon);
final float animationTime = Math.max(450, (Math.abs(mStX) + Math.abs(mStY)) / 1200f * MOVE_MOVE_ANIMATION_TIME);
final boolean doNotUseAnimations = tileView.getSettings().DO_NOT_USE_ANIMATIONS.get();
final float animationTime = doNotUseAnimations ? 0 : Math.max(450, (Math.abs(mStX) + Math.abs(mStY)) / 1200f * MOVE_MOVE_ANIMATION_TIME);
startThreadAnimating(new Runnable() {
@ -221,7 +222,7 @@ public class AnimateDraggingMapThread {
public void run() {
setTargetValues(endZoom, finalLat, finalLon);
if(moveZoom != startZoom){
animatingZoomInThread(startZoom, startZoomFP, moveZoom, startZoomFP,ZOOM_MOVE_ANIMATION_TIME, notifyListener);
animatingZoomInThread(startZoom, startZoomFP, moveZoom, startZoomFP, doNotUseAnimations ? 0 : ZOOM_MOVE_ANIMATION_TIME, notifyListener);
}
if(!stopped){
@ -232,7 +233,7 @@ public class AnimateDraggingMapThread {
}
if (!stopped && (moveZoom != endZoom || startZoomFP != 0)) {
animatingZoomInThread(moveZoom, startZoomFP, endZoom, 0, ZOOM_MOVE_ANIMATION_TIME, notifyListener);
animatingZoomInThread(moveZoom, startZoomFP, endZoom, 0, doNotUseAnimations ? 0 : ZOOM_MOVE_ANIMATION_TIME, notifyListener);
}
tileView.setFractionalZoom(endZoom, 0, notifyListener);