From 48010fa99f13d000015ad8bac10eafdf14f2bd30 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Fri, 12 Jan 2018 11:51:33 +0200 Subject: [PATCH] Change button icon color on tap in wikipedia context menu --- .../plus/mapcontextmenu/builders/AmenityMenuBuilder.java | 7 +++++-- .../mapcontextmenu/controllers/AmenityMenuController.java | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java index ce158b58b1..6fec9e2f51 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java @@ -234,8 +234,11 @@ public class AmenityMenuBuilder extends MenuBuilder { }); button.setAllCaps(true); button.setText(R.string.context_menu_read_full_article); - Drawable compoundDrawable = app.getIconsCache().getIcon(R.drawable.ic_action_read_text, light ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n); - button.setCompoundDrawablesWithIntrinsicBounds(compoundDrawable, null, null, null); + Drawable normal = app.getIconsCache().getIcon(R.drawable.ic_action_read_text, + light ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n); + Drawable pressed = app.getIconsCache().getIcon(R.drawable.ic_action_read_text, + light ? R.color.ctx_menu_controller_button_text_color_light_p : R.color.ctx_menu_controller_button_text_color_dark_p); + button.setCompoundDrawablesWithIntrinsicBounds(AndroidUtils.createStateListDrawable(normal, pressed), null, null, null); button.setCompoundDrawablePadding(dpToPx(8f)); llText.addView(button); } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java index ec3460ba28..1fdef001f4 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java @@ -73,7 +73,7 @@ public class AmenityMenuController extends MenuController { } }; leftTitleButtonController.caption = getMapActivity().getString(R.string.context_menu_read_article); - leftTitleButtonController.leftIcon = getIcon(R.drawable.ic_action_read_text, isLight() ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n); + leftTitleButtonController.updateStateListDrawableIcon(R.drawable.ic_action_read_text, true); } openingHoursInfo = processOpeningHours(amenity);