Alexey Kulish 2016-04-20 10:40:29 +03:00
parent a8c7f15ffd
commit ecde022694
3 changed files with 13 additions and 10 deletions

View file

@ -419,6 +419,7 @@ public class MapWidgetRegistry {
final int[] menuTitleIds = r.getMessageIds();
final int[] menuItemIds = r.getItemIds();
int checkedId = r.getItemId();
boolean selected = r.visibleCollapsed(mode) || r.visible(mode);
if (menuIconIds != null && menuTitleIds != null && menuItemIds != null
&& menuIconIds.length == menuTitleIds.length && menuIconIds.length == menuItemIds.length) {
for (int i = 0; i < menuIconIds.length; i++) {
@ -427,7 +428,7 @@ public class MapWidgetRegistry {
int id = menuItemIds[i];
MenuItem menuItem = menu.add(R.id.single_selection_group, id, i, titleId)
.setChecked(id == checkedId);
menuItem.setIcon(menuItem.isChecked()
menuItem.setIcon(menuItem.isChecked() && selected
? ic.getIcon(iconId, R.color.osmand_orange) : ic.getThemedIcon(iconId));
}
menu.setGroupCheckable(R.id.single_selection_group, true, true);

View file

@ -260,6 +260,7 @@ public class RouteInfoWidgetsFactory {
@Override
public boolean updateInfo(DrawSettings drawSettings) {
setIcons(showArrival.get() ? time : timeToGo, showArrival.get() ? timeN : timeToGoN);
int time = 0;
if (routingHelper != null && routingHelper.isRouteCalculated()) {
//boolean followingMode = routingHelper.isFollowingMode();
@ -621,6 +622,7 @@ public class RouteInfoWidgetsFactory {
@Override
public boolean updateInfo(DrawSettings drawSettings) {
boolean relative = showRelativeBearing.get();
setIcons(relative ? relativeBearingResId : bearingResId, relative ? relativeBearingNightResId : bearingNightResId);
setContentTitle(relative ? R.string.map_widget_bearing : R.string.map_widget_magnetic_bearing);
int b = getBearing(relative);
if (distChanged(cachedDegrees, b)) {

View file

@ -84,10 +84,15 @@ public class TextInfoWidget {
topImageView.invalidate();
}
public void setIcons(int widgetDayIcon, int widgetNightIcon) {
dayIcon = widgetDayIcon;
nightIcon = widgetNightIcon;
setImageDrawable(!isNight ? dayIcon : nightIcon);
public boolean setIcons(int widgetDayIcon, int widgetNightIcon) {
if (dayIcon != widgetDayIcon || nightIcon != widgetNightIcon) {
dayIcon = widgetDayIcon;
nightIcon = widgetNightIcon;
setImageDrawable(!isNight ? dayIcon : nightIcon);
return true;
} else {
return false;
}
}
public boolean isNight() {
@ -210,9 +215,4 @@ public class TextInfoWidget {
tv.setTextColor(textColor);
tv.setTypeface(Typeface.DEFAULT, textBold ? Typeface.BOLD : Typeface.NORMAL);
}
}