Full Tile support in Api

This commit is contained in:
mar-v-in 2015-01-09 22:57:04 +01:00
parent c7e910af4b
commit 8ab6a25cfd
4 changed files with 39 additions and 12 deletions

View File

@ -37,11 +37,8 @@ public class MarkerOptions implements SafeParcelable {
* This is a IBinder to the remote BitmapDescriptor created using BitmapDescriptorFactory
*/
@SafeParceled(5)
private IBinder icon;
/**
* The real BitmapDescriptor. Not transferred through Parcel.
*/
private BitmapDescriptor iconDescriptor;
private IBinder iconBinder;
private BitmapDescriptor icon;
@SafeParceled(6)
private float anchorU = 0.5F;
@SafeParceled(7)
@ -167,10 +164,10 @@ public class MarkerOptions implements SafeParcelable {
* custom icon is set.
*/
public BitmapDescriptor getIcon() {
if (iconDescriptor == null && icon != null) {
iconDescriptor = new BitmapDescriptor(ObjectWrapper.asInterface(icon));
if (icon == null && iconBinder != null) {
icon = new BitmapDescriptor(ObjectWrapper.asInterface(iconBinder));
}
return iconDescriptor;
return icon;
}
/**
@ -234,8 +231,8 @@ public class MarkerOptions implements SafeParcelable {
* @return the object for which the method was called, with the new icon set.
*/
public MarkerOptions icon(BitmapDescriptor icon) {
this.iconDescriptor = icon;
this.icon = icon == null ? null : icon.getRemoteObject().asBinder();
this.icon = icon;
this.iconBinder = icon == null ? null : icon.getRemoteObject().asBinder();
return this;
}

View File

@ -0,0 +1,3 @@
package com.google.android.gms.maps.model;
parcelable Tile;

View File

@ -16,19 +16,33 @@
package com.google.android.gms.maps.model;
import android.os.IBinder;
import android.os.Parcel;
import android.os.RemoteException;
import com.google.android.gms.maps.model.internal.ITileProviderDelegate;
import org.microg.safeparcel.SafeParcelUtil;
import org.microg.safeparcel.SafeParcelable;
import org.microg.safeparcel.SafeParceled;
/**
* Defines options for a TileOverlay.
*/
public class TileOverlayOptions implements SafeParcelable {
@SafeParceled(1)
private final int versionCode = 1;
/**
* This is a IBinder to the {@link #tileProvider}, built using {@link ITileProviderDelegate}.
*/
@SafeParceled(2)
private IBinder tileProviderBinder;
private TileProvider tileProvider;
@SafeParceled(3)
private boolean visible = true;
private boolean fadeIn = true;
@SafeParceled(4)
private float zIndex;
@SafeParceled(5)
private boolean fadeIn = true;
/**
* Creates a new set of tile overlay options.
@ -97,8 +111,14 @@ public class TileOverlayOptions implements SafeParcelable {
* @param tileProvider the {@link TileProvider} to use for this tile overlay.
* @return the object for which the method was called, with the new tile provider set.
*/
public TileOverlayOptions tileProvider(TileProvider tileProvider) {
public TileOverlayOptions tileProvider(final TileProvider tileProvider) {
this.tileProvider = tileProvider;
this.tileProviderBinder = new ITileProviderDelegate.Stub() {
@Override
public Tile getTile(int x, int y, int zoom) throws RemoteException {
return tileProvider.getTile(x, y, zoom);
}
};
return this;
}

View File

@ -0,0 +1,7 @@
package com.google.android.gms.maps.model.internal;
import com.google.android.gms.maps.model.Tile;
interface ITileProviderDelegate {
Tile getTile(int x, int y, int zoom);
}