- correcting sunrisesunset call (the timezone offset)
- added info about android bug for the hack git-svn-id: https://osmand.googlecode.com/svn/trunk@866 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
1780d25c8d
commit
f3b66e956a
2 changed files with 9 additions and 8 deletions
|
@ -38,6 +38,7 @@ public class RegionAddressRepositoryBinary implements RegionAddressRepository {
|
||||||
this.file = file;
|
this.file = file;
|
||||||
this.region = name;
|
this.region = name;
|
||||||
//This is hack, as collator seems to be broken for "cs"-Czech country, things like Z-ž don't match, and "cz" fixes this
|
//This is hack, as collator seems to be broken for "cs"-Czech country, things like Z-ž don't match, and "cz" fixes this
|
||||||
|
//Android issue: http://code.google.com/p/android/issues/detail?id=13423
|
||||||
if ("cs".equals(Locale.getDefault().getLanguage())) {
|
if ("cs".equals(Locale.getDefault().getLanguage())) {
|
||||||
this.collator = Collator.getInstance(new Locale("cz", Locale.getDefault().getCountry(),Locale.getDefault().getVariant()));
|
this.collator = Collator.getInstance(new Locale("cz", Locale.getDefault().getCountry(),Locale.getDefault().getVariant()));
|
||||||
//hack end
|
//hack end
|
||||||
|
|
|
@ -8,7 +8,6 @@ import net.osmand.LogUtil;
|
||||||
import net.osmand.OsmandSettings;
|
import net.osmand.OsmandSettings;
|
||||||
import net.osmand.OsmandSettings.DayNightMode;
|
import net.osmand.OsmandSettings.DayNightMode;
|
||||||
import net.osmand.SunriseSunset;
|
import net.osmand.SunriseSunset;
|
||||||
import net.osmand.render.RendererRegistry;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
@ -22,16 +21,17 @@ import android.location.LocationManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to help determine if we want to render day or night map - it uses the
|
* Class to help determine if we want to render day or night map - it uses the
|
||||||
* DayNightMode enumeration for its behavior - it uses the
|
* DayNightMode enumeration for its behavior<BR>
|
||||||
* {@link RendererRegistry} to check if the night part is present - it uses the
|
* - it uses the LightSensor and needs calls from MapActivity on onPause and onResume to
|
||||||
* LightSensor and needs calls from MapActivity on onPause and onResume to
|
* register/unregister the sensor listener<BR>
|
||||||
* register/unregister the sensor listener - it uses the {@link SunriseSunset}
|
* - it uses the {@link SunriseSunset} and {@link LocationManager} to find
|
||||||
* and {@link LocationManager} to find out about sunset/sunrise and use it
|
* out about sunset/sunrise and use it
|
||||||
*
|
*
|
||||||
* Note: the usage of SunriseSunset is not optimized in any way, it is
|
* Note: the usage of SunriseSunset is not optimized in any way, it is
|
||||||
* recalculated on each demand. If this way it would be resource consuming, some
|
* recalculated on each demand. If this way it would be resource consuming, some
|
||||||
* recalculation threshold could be specified to recalculate the sun-rise/set
|
* recalculation threshold could be specified to recalculate the sun-rise/set
|
||||||
* only sometimes. Note2: the light sensor threshold is hard coded to
|
* only sometimes.<BR>
|
||||||
|
* Note2: the light sensor threshold is hard coded to
|
||||||
* {@link SensorManager#LIGHT_CLOUDY} and could be made customizable
|
* {@link SensorManager#LIGHT_CLOUDY} and could be made customizable
|
||||||
*
|
*
|
||||||
* @author pavol.zibrita
|
* @author pavol.zibrita
|
||||||
|
@ -80,7 +80,7 @@ public class DayNightHelper implements SensorEventListener {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
SunriseSunset daynightSwitch = new SunriseSunset(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude(),
|
SunriseSunset daynightSwitch = new SunriseSunset(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude(),
|
||||||
new Date(), TimeZone.getDefault().getRawOffset());
|
new Date(), TimeZone.getDefault().getRawOffset()/3600000);
|
||||||
boolean daytime = daynightSwitch.isDaytime();
|
boolean daytime = daynightSwitch.isDaytime();
|
||||||
log.debug("Sunrise/sunset setting to day: " + daytime); //$NON-NLS-1$
|
log.debug("Sunrise/sunset setting to day: " + daytime); //$NON-NLS-1$
|
||||||
if (daytime) {
|
if (daytime) {
|
||||||
|
|
Loading…
Reference in a new issue