Add opening hours for favourites

This commit is contained in:
PavelRatushny 2017-12-08 15:52:59 +02:00
parent 178d193e8a
commit 0573b4c693
2 changed files with 12 additions and 2 deletions

View file

@ -121,7 +121,7 @@ public class AmenityMenuController extends MenuController {
@Override @Override
public OpeningHoursInfo getOpeningHoursInfo() { public OpeningHoursInfo getOpeningHoursInfo() {
return getOpeningHoursInfo(amenity); return processOpeningHours(amenity);
} }
public static String getTypeStr(Amenity amenity) { public static String getTypeStr(Amenity amenity) {
@ -136,7 +136,7 @@ public class AmenityMenuController extends MenuController {
return typeStr; return typeStr;
} }
public static OpeningHoursInfo getOpeningHoursInfo(Amenity amenity) { public static OpeningHoursInfo processOpeningHours(Amenity amenity) {
OpeningHoursParser.OpeningHours openingHours = OpeningHoursParser.parseOpenedHours(amenity.getOpeningHours()); OpeningHoursParser.OpeningHours openingHours = OpeningHoursParser.parseOpenedHours(amenity.getOpeningHours());
if (openingHours == null) { if (openingHours == null) {
return null; return null;

View file

@ -14,6 +14,7 @@ import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.FavoriteImageDrawable; import net.osmand.plus.base.FavoriteImageDrawable;
import net.osmand.plus.mapcontextmenu.MenuController; import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.plus.mapcontextmenu.OpeningHoursInfo;
import net.osmand.plus.mapcontextmenu.builders.FavouritePointMenuBuilder; import net.osmand.plus.mapcontextmenu.builders.FavouritePointMenuBuilder;
import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditor; import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditor;
import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditorFragment; import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditorFragment;
@ -130,4 +131,13 @@ public class FavouritePointMenuController extends MenuController {
addMyLocationToPlainItems(latLon); addMyLocationToPlainItems(latLon);
} }
} }
@Override
public OpeningHoursInfo getOpeningHoursInfo() {
Object originObject = getBuilder().getOriginObject();
if (originObject instanceof Amenity) {
return AmenityMenuController.processOpeningHours((Amenity) originObject);
}
return null;
}
} }