Skip to content

Commit

Permalink
Implemented draw image in nearby place marker
Browse files Browse the repository at this point in the history
  • Loading branch information
Corwin-Kh committed Jan 16, 2025
1 parent ec35aa3 commit 0fcc3da
Show file tree
Hide file tree
Showing 8 changed files with 202 additions and 634 deletions.
6 changes: 6 additions & 0 deletions OsmAnd/src/net/osmand/data/NearbyPlacePoint.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.osmand.data;

import android.content.Context;
import android.graphics.Bitmap;

import androidx.annotation.NonNull;

Expand All @@ -15,6 +16,7 @@ public class NearbyPlacePoint implements Serializable, LocationPoint {
private static final long serialVersionUID = 829654300829771466L;

public static final BackgroundType DEFAULT_BACKGROUND_TYPE = BackgroundType.CIRCLE;
public Bitmap imageBitmap;
public String photoTitle;
public String wikiTitle;
public String poitype;
Expand Down Expand Up @@ -123,6 +125,10 @@ public boolean equals(Object o) {
}

NearbyPlacePoint point = (NearbyPlacePoint) o;
if(point.imageBitmap != imageBitmap) {
return false;
}

if (!Algorithms.stringsEqual(photoTitle, point.photoTitle)) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import net.osmand.util.Algorithms
import net.osmand.util.CollectionUtils
import net.osmand.wiki.WikiCoreHelper.OsmandApiFeatureData
import java.util.Collections
import kotlin.math.min

object NearbyPlacesHelper {
private lateinit var app: OsmandApplication
private var lastModifiedTime: Long = 0
private const val PLACES_LIMIT = 10;

fun init(app: OsmandApplication) {
this.app = app
Expand All @@ -24,7 +26,8 @@ object NearbyPlacesHelper {
}

override fun onFinish(result: List<OsmandApiFeatureData>) {
dataCollection = result
val newListSize = min(result.size, PLACES_LIMIT)
dataCollection = result.subList(0, newListSize)
updateLastModifiedTime()
notifyListeners()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
setupNearByCard(view);
NearbyPlacesHelper.INSTANCE.startLoadingNearestPhotos();
view.findViewById(R.id.show_all_btn).setOnClickListener(v -> {
// app.getOsmandMap().getMapLayers().getNearbyPlacesLayer().setCustomMapObjects(app.getFavoritesHelper().getFavouritePoints());
app.getOsmandMap().getMapLayers().getNearbyPlacesLayer().setCustomMapObjects(NearbyPlacesHelper.INSTANCE.getDataCollection());
});
}
Expand Down
257 changes: 0 additions & 257 deletions OsmAnd/src/net/osmand/plus/views/layers/ExploreNearbyPlacesLayer.kt

This file was deleted.

Loading

0 comments on commit 0fcc3da

Please sign in to comment.