Fix routing

This commit is contained in:
Victor Shcherb 2012-07-05 18:54:29 +02:00
parent 5bc2fc3516
commit 50d63acbf5
2 changed files with 18 additions and 11 deletions

View file

@ -784,18 +784,18 @@ public class BinaryRoutePlanner {
} else { } else {
// the segment was already visited! We need to follow better route if it exists // 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) // 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, // That code is incorrect (when segment is processed itself,
// then it tries to make wrong u-turn) - // 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(segment.getRoad().getName() + " " + next.getRoad().getName());
// System.out.println(next.distanceFromStart + " " + distFromStart); // System.out.println(next.distanceFromStart + " ! " + distFromStart);
// next.distanceFromStart = gDistFromStart; next.distanceFromStart = distFromStart;
// next.parentRoute = segment; next.parentRoute = segment;
// next.parentSegmentEnd = segmentEnd; next.parentSegmentEnd = segmentEnd;
// if (ctx.visitor != null) { if (ctx.visitor != null) {
// ctx.visitor.visitSegment(next, false); ctx.visitor.visitSegment(next, false);
// } }
} }
} }

View file

@ -43,6 +43,7 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.text.format.DateFormat; import android.text.format.DateFormat;
import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityManager;
@ -203,12 +204,18 @@ public class OsmandApplication extends Application {
manager.onLowMemory(); manager.onLowMemory();
} }
@Override @Override
public void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) {
if (prefferedLocale != null && !newConfig.locale.getLanguage().equals(prefferedLocale.getLanguage())) { if (prefferedLocale != null && !newConfig.locale.getLanguage().equals(prefferedLocale.getLanguage())) {
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; newConfig.locale = prefferedLocale;
}
getBaseContext().getResources().updateConfiguration(newConfig, getBaseContext().getResources().getDisplayMetrics());
Locale.setDefault(prefferedLocale); Locale.setDefault(prefferedLocale);
// getBaseContext().getResources().updateConfiguration(newConfig, getBaseContext().getResources().getDisplayMetrics());
} else { } else {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
} }