Skip to content

Commit

Permalink
feat(android): expose ImageOverlay image getter
Browse files Browse the repository at this point in the history
  • Loading branch information
m1ga committed Jan 31, 2025
1 parent 8680f7b commit a478b1d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion android/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 5.6.1
version: 5.6.2
apiversion: 4
architectures: arm64-v8a armeabi-v7a x86 x86_64
description: External version of Map module using native Google Maps library
Expand Down
15 changes: 15 additions & 0 deletions android/src/ti/map/ImageOverlayProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,21 @@

package ti.map;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import com.google.android.gms.maps.model.BitmapDescriptor;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.GroundOverlay;
import com.google.android.gms.maps.model.GroundOverlayOptions;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import java.io.IOException;
import java.net.URL;
import org.appcelerator.kroll.KrollDict;
import org.appcelerator.kroll.KrollProxy;
import org.appcelerator.kroll.annotations.Kroll;
import org.appcelerator.kroll.common.Log;
import org.appcelerator.kroll.common.TiMessenger;
import org.appcelerator.titanium.view.TiDrawableReference;

@Kroll.proxy(creatableInModule = MapModule.class)
Expand Down Expand Up @@ -46,6 +52,15 @@ public void handleCreationDict(KrollDict dict)
}
}

@Kroll.setProperty
public void setImage(Object image)
{
TiDrawableReference source = TiDrawableReference.fromObject(this, image);
if (!source.isTypeNull()) {
groundOverlay.setImage(BitmapDescriptorFactory.fromBitmap(source.getBitmap()));
}
}

public GroundOverlay getGroundOverlay()
{
return groundOverlay;
Expand Down

0 comments on commit a478b1d

Please sign in to comment.