From d407468d91fcc2b3099b652d485edc6658b89260 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Fri, 5 May 2017 19:20:33 +0300 Subject: [PATCH] Fix empty card --- .../net/osmand/plus/mapcontextmenu/MenuBuilder.java | 5 +---- .../plus/mapcontextmenu/builders/cards/ImageCard.java | 3 +++ ...aryImagesCard.java => MapillaryContributeCard.java} | 10 ++++++---- 3 files changed, 10 insertions(+), 8 deletions(-) rename OsmAnd/src/net/osmand/plus/mapillary/{AddMapillaryImagesCard.java => MapillaryContributeCard.java} (66%) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java index 5a13801d1a..1385a3f717 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java @@ -37,12 +37,11 @@ import net.osmand.plus.OsmandSettings.OsmandPreference; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.mapcontextmenu.builders.cards.AbstractCard; -import net.osmand.plus.mapcontextmenu.builders.cards.NoImagesCard; import net.osmand.plus.mapcontextmenu.builders.cards.CardsRowBuilder; import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard; import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard.GetImageCardsTask; import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard.GetImageCardsTask.GetImageCardsListener; -import net.osmand.plus.mapillary.AddMapillaryImagesCard; +import net.osmand.plus.mapcontextmenu.builders.cards.NoImagesCard; import net.osmand.plus.render.RenderingIcons; import net.osmand.util.MapUtils; @@ -312,8 +311,6 @@ public class MenuBuilder { cards.addAll(cardList); if (cardList.size() == 0) { cards.add(new NoImagesCard(app)); - } else { - cards.add(new AddMapillaryImagesCard(app)); } onlinePhotoCardsRow.setCards(cards); onlinePhotoCards = cards; diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/cards/ImageCard.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/cards/ImageCard.java index 544b0caeac..132783ac86 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/cards/ImageCard.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/cards/ImageCard.java @@ -17,6 +17,7 @@ import net.osmand.data.LatLon; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.Version; +import net.osmand.plus.mapillary.MapillaryContributeCard; import net.osmand.plus.mapillary.MapillaryImageCard; import net.osmand.util.Algorithms; @@ -111,6 +112,8 @@ public abstract class ImageCard extends AbstractCard { String type = imageObject.getString("type"); if ("mapillary-photo".equals(type)) { imageCard = new MapillaryImageCard(app, imageObject); + } else if ("mapillary-contribute".equals(type)) { + imageCard = new MapillaryContributeCard(app, imageObject); } else { imageCard = new UrlImageCard(app, imageObject); } diff --git a/OsmAnd/src/net/osmand/plus/mapillary/AddMapillaryImagesCard.java b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryContributeCard.java similarity index 66% rename from OsmAnd/src/net/osmand/plus/mapillary/AddMapillaryImagesCard.java rename to OsmAnd/src/net/osmand/plus/mapillary/MapillaryContributeCard.java index 35fce2e3d1..53ff68ca90 100644 --- a/OsmAnd/src/net/osmand/plus/mapillary/AddMapillaryImagesCard.java +++ b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryContributeCard.java @@ -4,12 +4,14 @@ import android.view.View; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; -import net.osmand.plus.mapcontextmenu.builders.cards.AbstractCard; +import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard; -public class AddMapillaryImagesCard extends AbstractCard { +import org.json.JSONObject; - public AddMapillaryImagesCard(OsmandApplication app) { - super(app); +public class MapillaryContributeCard extends ImageCard { + + public MapillaryContributeCard(OsmandApplication app, JSONObject imageObject) { + super(app, imageObject); } @Override