Merge pull request #7887 from Dima-1/Issue_7244

Issue #7244 Sunrise/sunset time in the map mode
This commit is contained in:
Hardy 2019-11-09 21:11:51 +01:00 committed by GitHub
commit 5e1062023c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -55,10 +55,12 @@ import net.osmand.render.RenderingRuleProperty;
import net.osmand.render.RenderingRuleStorageProperties; import net.osmand.render.RenderingRuleStorageProperties;
import net.osmand.render.RenderingRulesStorage; import net.osmand.render.RenderingRulesStorage;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import net.osmand.util.SunriseSunset;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import java.io.File; import java.io.File;
import java.text.DateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -581,6 +583,16 @@ public class ConfigureMapMenu {
items[i] = OsmandSettings.DayNightMode.values()[i].toHumanString(activity items[i] = OsmandSettings.DayNightMode.values()[i].toHumanString(activity
.getMyApplication()); .getMyApplication());
} }
SunriseSunset sunriseSunset = activity.getMyApplication().getDaynightHelper().getSunriseSunset();
if (sunriseSunset != null) {
DateFormat dateFormat = DateFormat.getTimeInstance(DateFormat.SHORT);
String sunriseSunsetTime = "\n" + dateFormat.format(activity.getMyApplication()
.getDaynightHelper().getSunriseSunset().getSunrise()) + "/" +
dateFormat.format(activity.getMyApplication()
.getDaynightHelper().getSunriseSunset().getSunset());
items[0] += sunriseSunsetTime;
}
int i = view.getSettings().DAYNIGHT_MODE.get().ordinal(); int i = view.getSettings().DAYNIGHT_MODE.get().ordinal();
bld.setSingleChoiceItems(items, i, new DialogInterface.OnClickListener() { bld.setSingleChoiceItems(items, i, new DialogInterface.OnClickListener() {
@Override @Override