diff --git a/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java b/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java index 2664898324..7202814bae 100644 --- a/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java +++ b/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java @@ -784,18 +784,18 @@ public class BinaryRoutePlanner { } else { // the segment was already visited! We need to follow better route if it exists // that is very strange situation and almost exception (it can happen when we underestimate distnceToEnd) - if (distFromStart < next.distanceFromStart) { + if (distFromStart < next.distanceFromStart && next.road.id != segment.road.id) { // That code is incorrect (when segment is processed itself, // then it tries to make wrong u-turn) - - // this situation should be very carefully checked in future + // this situation should be very carefully checked in future (seems to be fixed) // System.out.println(segment.getRoad().getName() + " " + next.getRoad().getName()); -// System.out.println(next.distanceFromStart + " " + distFromStart); -// next.distanceFromStart = gDistFromStart; -// next.parentRoute = segment; -// next.parentSegmentEnd = segmentEnd; -// if (ctx.visitor != null) { -// ctx.visitor.visitSegment(next, false); -// } +// System.out.println(next.distanceFromStart + " ! " + distFromStart); + next.distanceFromStart = distFromStart; + next.parentRoute = segment; + next.parentSegmentEnd = segmentEnd; + if (ctx.visitor != null) { + ctx.visitor.visitSegment(next, false); + } } } diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java index 4e3f9eb443..e32cf256b4 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java +++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java @@ -43,6 +43,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.res.Configuration; +import android.os.Build; import android.os.Handler; import android.text.format.DateFormat; import android.view.accessibility.AccessibilityManager; @@ -202,13 +203,19 @@ public class OsmandApplication extends Application { super.onLowMemory(); manager.onLowMemory(); } + + @Override public void onConfigurationChanged(Configuration newConfig) { if (prefferedLocale != null && !newConfig.locale.getLanguage().equals(prefferedLocale.getLanguage())) { - newConfig.locale = prefferedLocale; + super.onConfigurationChanged(newConfig); + // ugly fix ! On devices after 4.0 screen is blinking when you rotate device! + if(Build.VERSION.SDK_INT < 14 ){ + newConfig.locale = prefferedLocale; + } + getBaseContext().getResources().updateConfiguration(newConfig, getBaseContext().getResources().getDisplayMetrics()); Locale.setDefault(prefferedLocale); -// getBaseContext().getResources().updateConfiguration(newConfig, getBaseContext().getResources().getDisplayMetrics()); } else { super.onConfigurationChanged(newConfig); }