Create read article button

This commit is contained in:
PavelRatushny 2017-12-15 16:50:00 +02:00
parent 5bcf02dfed
commit 79436d2759
2 changed files with 13 additions and 1 deletions

View file

@ -9,6 +9,7 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="context_menu_read_article">Read article</string>
<string name="context_menu_points_of_group">All points of group</string>
<string name="opened_from">Opened from</string>
<string name="opened_till">Opened till</string>

View file

@ -21,6 +21,7 @@ import net.osmand.plus.mapcontextmenu.builders.AmenityMenuBuilder;
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController.TransportStopRoute;
import net.osmand.plus.render.RenderingIcons;
import net.osmand.plus.resources.TransportIndexRepository;
import net.osmand.plus.views.POIMapLayer;
import net.osmand.plus.views.TransportStopsLayer;
import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
@ -38,7 +39,7 @@ public class AmenityMenuController extends MenuController {
private Amenity amenity;
private List<TransportStopRoute> routes = new ArrayList<>();
public AmenityMenuController(MapActivity mapActivity, PointDescription pointDescription, Amenity amenity) {
public AmenityMenuController(final MapActivity mapActivity, PointDescription pointDescription, final Amenity amenity) {
super(new AmenityMenuBuilder(mapActivity, amenity), pointDescription, mapActivity);
this.amenity = amenity;
if (amenity.getType().getKeyName().equals("transportation")) {
@ -56,6 +57,16 @@ public class AmenityMenuController extends MenuController {
processTransportStop();
}
}
if (amenity.getType().isWiki()) {
leftTitleButtonController = new TitleButtonController() {
@Override
public void buttonPressed() {
POIMapLayer.showWikipediaDialog(mapActivity, mapActivity.getMyApplication(), amenity);
}
};
leftTitleButtonController.caption = getMapActivity().getString(R.string.context_menu_read_article);
leftTitleButtonController.leftIcon = getIcon(R.drawable.ic_action_note_dark, isLight() ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n);
}
}
@Override