Fix empty card

This commit is contained in:
Alexey Kulish 2017-05-05 19:20:33 +03:00
parent 36750a3dc8
commit d407468d91
3 changed files with 10 additions and 8 deletions

View file

@ -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;

View file

@ -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);
}

View file

@ -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