Fix mode icons
This commit is contained in:
parent
a44e52cddf
commit
43293b8535
3 changed files with 25 additions and 11 deletions
|
@ -359,13 +359,16 @@
|
||||||
<color name="route_info_bottom_view_bg_dark">#222526</color>
|
<color name="route_info_bottom_view_bg_dark">#222526</color>
|
||||||
<color name="route_info_divider_light">#e6e6e6</color>
|
<color name="route_info_divider_light">#e6e6e6</color>
|
||||||
<color name="route_info_divider_dark">#2d3133</color>
|
<color name="route_info_divider_dark">#2d3133</color>
|
||||||
<color name="route_info_icon_color_light">#505050</color>
|
<color name="route_info_control_icon_color_light">#505050</color>
|
||||||
<color name="route_info_icon_color_dark">#727272</color>
|
<color name="route_info_control_icon_color_dark">#727272</color>
|
||||||
<color name="route_info_go_btn_inking_light">#4c63e6</color>
|
<color name="route_info_go_btn_inking_light">#4c63e6</color>
|
||||||
<color name="route_info_go_btn_inking_dark">#d28521</color>
|
<color name="route_info_go_btn_inking_dark">#d28521</color>
|
||||||
<color name="route_info_go_btn_bg_light">#6d82fc</color>
|
<color name="route_info_go_btn_bg_light">#6d82fc</color>
|
||||||
<color name="route_info_go_btn_bg_light_p">#4c63e6</color>
|
<color name="route_info_go_btn_bg_light_p">#4c63e6</color>
|
||||||
<color name="route_info_go_btn_bg_dark">#b36a0b</color>
|
<color name="route_info_go_btn_bg_dark">#b36a0b</color>
|
||||||
<color name="route_info_go_btn_bg_dark_p">#d28521</color>
|
<color name="route_info_go_btn_bg_dark_p">#d28521</color>
|
||||||
|
<color name="route_info_checked_mode_icon_color_light">#ff8800</color>
|
||||||
|
<color name="route_info_checked_mode_icon_color_dark">#d28521</color>
|
||||||
|
<color name="route_info_unchecked_mode_icon_color">#727272</color>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -57,7 +57,7 @@ public class AppModeDialog {
|
||||||
final View[] buttons = new View[values.size()];
|
final View[] buttons = new View[values.size()];
|
||||||
int k = 0;
|
int k = 0;
|
||||||
for(ApplicationMode ma : values) {
|
for(ApplicationMode ma : values) {
|
||||||
buttons[k++] = createToggle(a.getLayoutInflater(), (OsmandApplication) a.getApplication(), (LinearLayout) ll.findViewById(R.id.app_modes_content), ma);
|
buttons[k++] = createToggle(a.getLayoutInflater(), (OsmandApplication) a.getApplication(), (LinearLayout) ll.findViewById(R.id.app_modes_content), ma, useMapTheme);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < buttons.length; i++) {
|
for (int i = 0; i < buttons.length; i++) {
|
||||||
updateButtonState((OsmandApplication) a.getApplication(), values, selected, onClickListener, buttons, i,
|
updateButtonState((OsmandApplication) a.getApplication(), values, selected, onClickListener, buttons, i,
|
||||||
|
@ -75,14 +75,19 @@ public class AppModeDialog {
|
||||||
final ApplicationMode mode = visible.get(i);
|
final ApplicationMode mode = visible.get(i);
|
||||||
final boolean checked = selected.contains(mode);
|
final boolean checked = selected.contains(mode);
|
||||||
ImageView iv = (ImageView) tb.findViewById(R.id.app_mode_icon);
|
ImageView iv = (ImageView) tb.findViewById(R.id.app_mode_icon);
|
||||||
|
boolean nightMode;
|
||||||
|
if (useMapTheme) {
|
||||||
|
nightMode = ctx.getDaynightHelper().isNightModeForMapControls();
|
||||||
|
} else {
|
||||||
|
nightMode = !ctx.getSettings().isLightContent();
|
||||||
|
}
|
||||||
if (checked) {
|
if (checked) {
|
||||||
iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), R.color.osmand_orange));
|
iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), nightMode ? R.color.route_info_checked_mode_icon_color_dark : R.color.route_info_checked_mode_icon_color_light));
|
||||||
iv.setContentDescription(String.format("%s %s", mode.toHumanString(ctx), ctx.getString(R.string.item_checked)));
|
iv.setContentDescription(String.format("%s %s", mode.toHumanString(ctx), ctx.getString(R.string.item_checked)));
|
||||||
tb.findViewById(R.id.selection).setVisibility(View.VISIBLE);
|
tb.findViewById(R.id.selection).setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
if (useMapTheme) {
|
if (useMapTheme) {
|
||||||
boolean nightMode = ctx.getDaynightHelper().isNightModeForMapControls();
|
iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), R.color.route_info_unchecked_mode_icon_color));
|
||||||
iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), !nightMode));
|
|
||||||
AndroidUtils.setBackground(ctx, iv, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
AndroidUtils.setBackground(ctx, iv, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||||
} else {
|
} else {
|
||||||
iv.setImageDrawable(ctx.getIconsCache().getThemedIcon(mode.getSmallIconDark()));
|
iv.setImageDrawable(ctx.getIconsCache().getThemedIcon(mode.getSmallIconDark()));
|
||||||
|
@ -119,12 +124,18 @@ public class AppModeDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static private View createToggle(LayoutInflater layoutInflater, OsmandApplication ctx, LinearLayout layout, ApplicationMode mode){
|
static private View createToggle(LayoutInflater layoutInflater, OsmandApplication ctx, LinearLayout layout, ApplicationMode mode, boolean useMapTheme){
|
||||||
int metricsX = (int) ctx.getResources().getDimension(R.dimen.route_info_modes_height);
|
int metricsX = (int) ctx.getResources().getDimension(R.dimen.route_info_modes_height);
|
||||||
int metricsY = (int) ctx.getResources().getDimension(R.dimen.route_info_modes_height);
|
int metricsY = (int) ctx.getResources().getDimension(R.dimen.route_info_modes_height);
|
||||||
View tb = layoutInflater.inflate(R.layout.mode_view, null);
|
View tb = layoutInflater.inflate(R.layout.mode_view, null);
|
||||||
ImageView iv = (ImageView) tb.findViewById(R.id.app_mode_icon);
|
ImageView iv = (ImageView) tb.findViewById(R.id.app_mode_icon);
|
||||||
iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), R.color.osmand_orange));
|
boolean nightMode;
|
||||||
|
if (useMapTheme) {
|
||||||
|
nightMode = ctx.getDaynightHelper().isNightModeForMapControls();
|
||||||
|
} else {
|
||||||
|
nightMode = !ctx.getSettings().isLightContent();
|
||||||
|
}
|
||||||
|
iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), nightMode ? R.color.route_info_checked_mode_icon_color_dark : R.color.route_info_checked_mode_icon_color_light));
|
||||||
iv.setContentDescription(mode.toHumanString(ctx));
|
iv.setContentDescription(mode.toHumanString(ctx));
|
||||||
// tb.setCompoundDrawablesWithIntrinsicBounds(null, ctx.getIconsCache().getIcon(mode.getIconId(), R.color.app_mode_icon_color), null, null);
|
// tb.setCompoundDrawablesWithIntrinsicBounds(null, ctx.getIconsCache().getIcon(mode.getIconId(), R.color.app_mode_icon_color), null, null);
|
||||||
LayoutParams lp = new LinearLayout.LayoutParams(metricsX, metricsY);
|
LayoutParams lp = new LinearLayout.LayoutParams(metricsX, metricsY);
|
||||||
|
|
|
@ -294,7 +294,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
public void updateRouteButtons(View main, boolean routeInfo) {
|
public void updateRouteButtons(View main, boolean routeInfo) {
|
||||||
boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||||
ImageView cancelRouteButton = (ImageView) main.findViewById(R.id.map_cancel_route_button);
|
ImageView cancelRouteButton = (ImageView) main.findViewById(R.id.map_cancel_route_button);
|
||||||
cancelRouteButton.setImageDrawable(app.getIconsCache().getIcon(R.drawable.map_action_cancel, nightMode ? R.color.route_info_icon_color_dark : R.color.route_info_icon_color_light));
|
cancelRouteButton.setImageDrawable(app.getIconsCache().getIcon(R.drawable.map_action_cancel, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light));
|
||||||
AndroidUtils.setBackground(mapActivity, cancelRouteButton, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
AndroidUtils.setBackground(mapActivity, cancelRouteButton, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||||
cancelRouteButton.setOnClickListener(new View.OnClickListener() {
|
cancelRouteButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -304,7 +304,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
});
|
});
|
||||||
|
|
||||||
ImageView waypointsButton = (ImageView) main.findViewById(R.id.map_waypoints_route_button);
|
ImageView waypointsButton = (ImageView) main.findViewById(R.id.map_waypoints_route_button);
|
||||||
waypointsButton.setImageDrawable(app.getIconsCache().getIcon(R.drawable.map_action_flag_dark, nightMode ? R.color.route_info_icon_color_dark : R.color.route_info_icon_color_light));
|
waypointsButton.setImageDrawable(app.getIconsCache().getIcon(R.drawable.map_action_flag_dark, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light));
|
||||||
AndroidUtils.setBackground(mapActivity, waypointsButton, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
AndroidUtils.setBackground(mapActivity, waypointsButton, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||||
waypointsButton.setOnClickListener(new View.OnClickListener() {
|
waypointsButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -315,7 +315,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
ImageView options = (ImageView) main.findViewById(R.id.map_options_route_button);
|
ImageView options = (ImageView) main.findViewById(R.id.map_options_route_button);
|
||||||
options.setImageDrawable(!routeInfo ? app.getIconsCache().getIcon(R.drawable.map_action_settings,
|
options.setImageDrawable(!routeInfo ? app.getIconsCache().getIcon(R.drawable.map_action_settings,
|
||||||
R.color.osmand_orange) : app.getIconsCache().getIcon(R.drawable.map_action_settings, nightMode ? R.color.route_info_icon_color_dark : R.color.route_info_icon_color_light));
|
R.color.osmand_orange) : app.getIconsCache().getIcon(R.drawable.map_action_settings, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light));
|
||||||
AndroidUtils.setBackground(mapActivity, options, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
AndroidUtils.setBackground(mapActivity, options, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||||
options.setOnClickListener(new View.OnClickListener() {
|
options.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue