Changing icon for map mode.
This commit is contained in:
parent
08291f86bb
commit
a6b206ae07
2 changed files with 22 additions and 8 deletions
|
@ -11,7 +11,9 @@ import android.net.ConnectivityManager;
|
|||
import android.net.NetworkInfo;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.StringRes;
|
||||
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.StateChangedListener;
|
||||
|
@ -2526,21 +2528,29 @@ public class OsmandSettings {
|
|||
|
||||
|
||||
public enum DayNightMode {
|
||||
AUTO(R.string.daynight_mode_auto),
|
||||
DAY(R.string.daynight_mode_day),
|
||||
NIGHT(R.string.daynight_mode_night),
|
||||
SENSOR(R.string.daynight_mode_sensor);
|
||||
AUTO(R.string.daynight_mode_auto, R.drawable.ic_action_map_sunst),
|
||||
DAY(R.string.daynight_mode_day, R.drawable.ic_action_map_day),
|
||||
NIGHT(R.string.daynight_mode_night, R.drawable.ic_action_map_night),
|
||||
SENSOR(R.string.daynight_mode_sensor, R.drawable.ic_action_map_sunst);
|
||||
|
||||
private final int key;
|
||||
@DrawableRes
|
||||
private final int drawableRes;
|
||||
|
||||
DayNightMode(int key) {
|
||||
DayNightMode(@StringRes int key, @DrawableRes int drawableRes) {
|
||||
this.key = key;
|
||||
this.drawableRes = drawableRes;
|
||||
}
|
||||
|
||||
public String toHumanString(Context ctx) {
|
||||
return ctx.getString(key);
|
||||
}
|
||||
|
||||
@DrawableRes
|
||||
public int getIconRes() {
|
||||
return drawableRes;
|
||||
}
|
||||
|
||||
public boolean isSensor() {
|
||||
return this == SENSOR;
|
||||
}
|
||||
|
|
|
@ -231,11 +231,10 @@ public class ConfigureMapMenu {
|
|||
.setIcon(R.drawable.ic_world_globe_dark)
|
||||
.setListener(l).createItem());
|
||||
if (TransportRouteHelper.getInstance().routeIsCalculated()) {
|
||||
selected = true;
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.layer_transport_route, activity)
|
||||
.setSelected(true)
|
||||
.setColor(selected ? R.color.osmand_orange : defaultColor)
|
||||
.setColor(R.color.osmand_orange)
|
||||
.setIcon(R.drawable.ic_action_bus_dark)
|
||||
.setListener(l).createItem());
|
||||
}
|
||||
|
@ -316,7 +315,7 @@ public class ConfigureMapMenu {
|
|||
.setTitleId(R.string.map_widget_day_night, activity)
|
||||
.setDescription(getDayNightDescr(activity))
|
||||
.setLayout(R.layout.list_item_single_line_descrition_narrow)
|
||||
.setIcon(R.drawable.ic_action_map_night)
|
||||
.setIcon(getDayNightIcon(activity))
|
||||
.setListener(new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> ad,
|
||||
|
@ -652,6 +651,11 @@ public class ConfigureMapMenu {
|
|||
return activity.getMyApplication().getSettings().DAYNIGHT_MODE.get().toHumanString(activity);
|
||||
}
|
||||
|
||||
@DrawableRes
|
||||
protected int getDayNightIcon(final MapActivity activity) {
|
||||
return activity.getMyApplication().getSettings().DAYNIGHT_MODE.get().getIconRes();
|
||||
}
|
||||
|
||||
protected String getScale(final MapActivity activity) {
|
||||
int scale = (int) (activity.getMyApplication().getSettings().TEXT_SCALE.get() * 100);
|
||||
return scale + " %";
|
||||
|
|
Loading…
Reference in a new issue