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

View file

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

View file

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