Logic fix
This commit is contained in:
parent
bc94d1a4c7
commit
ac50aef203
1 changed files with 12 additions and 17 deletions
|
@ -21,17 +21,10 @@ public class DayNightModeAction extends QuickAction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(MapActivity activity) {
|
public void execute(MapActivity activity) {
|
||||||
switch (activity.getMyApplication().getSettings().DAYNIGHT_MODE.get()){
|
if (activity.getMyApplication().getDaynightHelper().isNightMode()) {
|
||||||
case DAY: {
|
|
||||||
activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.NIGHT);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case NIGHT:
|
|
||||||
case AUTO:
|
|
||||||
case SENSOR: {
|
|
||||||
activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.DAY);
|
activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.DAY);
|
||||||
break;
|
} else {
|
||||||
}
|
activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.NIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,18 +40,20 @@ public class DayNightModeAction extends QuickAction {
|
||||||
@Override
|
@Override
|
||||||
public int getIconRes(Context context) {
|
public int getIconRes(Context context) {
|
||||||
if (context instanceof MapActivity
|
if (context instanceof MapActivity
|
||||||
&& !((MapActivity) context).getMyApplication().getDaynightHelper().isNightMode()) {
|
&& ((MapActivity) context).getMyApplication().getDaynightHelper().isNightMode()) {
|
||||||
return R.drawable.ic_action_map_night;
|
|
||||||
}
|
|
||||||
return R.drawable.ic_action_map_day;
|
return R.drawable.ic_action_map_day;
|
||||||
}
|
}
|
||||||
|
return R.drawable.ic_action_map_night;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getActionText(OsmandApplication application) {
|
public String getActionText(OsmandApplication application) {
|
||||||
if (!application.getDaynightHelper().isNightMode()) {
|
if (application.getDaynightHelper().isNightMode()) {
|
||||||
return String.format(application.getString(R.string.quick_action_day_night_mode), DayNightMode.NIGHT.toHumanString(application));
|
return String.format(application.getString(R.string.quick_action_day_night_mode),
|
||||||
|
DayNightMode.DAY.toHumanString(application));
|
||||||
} else {
|
} else {
|
||||||
return String.format(application.getString(R.string.quick_action_day_night_mode), DayNightMode.DAY.toHumanString(application));
|
return String.format(application.getString(R.string.quick_action_day_night_mode),
|
||||||
|
DayNightMode.NIGHT.toHumanString(application));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue