Change button icon color on tap in wikipedia context menu

This commit is contained in:
Alexander Sytnyk 2018-01-12 11:51:33 +02:00
parent c88a7a8a64
commit 48010fa99f
2 changed files with 6 additions and 3 deletions

View file

@ -234,8 +234,11 @@ public class AmenityMenuBuilder extends MenuBuilder {
}); });
button.setAllCaps(true); button.setAllCaps(true);
button.setText(R.string.context_menu_read_full_article); 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); Drawable normal = app.getIconsCache().getIcon(R.drawable.ic_action_read_text,
button.setCompoundDrawablesWithIntrinsicBounds(compoundDrawable, null, null, null); 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)); button.setCompoundDrawablePadding(dpToPx(8f));
llText.addView(button); llText.addView(button);
} }

View file

@ -73,7 +73,7 @@ public class AmenityMenuController extends MenuController {
} }
}; };
leftTitleButtonController.caption = getMapActivity().getString(R.string.context_menu_read_article); 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); openingHoursInfo = processOpeningHours(amenity);