0
0
Fork 0
mirror of https://github.com/YTVanced/VancedMicroG synced 2024-11-24 12:15:12 +00:00

Start conversion to vtm

This commit is contained in:
mar-v-in 2015-01-09 17:02:40 +01:00
parent 27866d08cf
commit 21e603b1e7
93 changed files with 1737 additions and 3300 deletions

View file

@ -9,9 +9,18 @@ buildscript {
apply plugin: 'com.android.application'
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile 'com.android.support:support-v4:21.0.2'
compile 'com.android.support:appcompat-v7:21.0.2'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'org.oscim:vtm-android:0.6.0-SNAPSHOT'
compile 'org.oscim:vtm-extras:0.6.0-SNAPSHOT'
compile 'org.oscim:vtm-themes:0.6.0-SNAPSHOT'
compile project(':GmsApi')
compile project(':UnifiedNlpLib')
}
@ -31,6 +40,7 @@ android {
java.srcDirs = ['src']
aidl.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}

View file

@ -1,6 +0,0 @@
package com.google.android.auth;
interface IAuthManagerService {
Bundle getToken(String accountName, String scope, in Bundle extras);
Bundle clearToken(String token, in Bundle extras);
}

View file

@ -1,5 +0,0 @@
package com.google.android.gms.common.internal;
interface IGmsCallbacks {
void onPostInitComplete(int statusCode, IBinder binder, in Bundle params);
}

View file

@ -1,30 +0,0 @@
package com.google.android.gms.common.internal;
import com.google.android.gms.common.internal.IGmsCallbacks;
interface IGmsServiceBroker {
void getPlusService(IGmsCallbacks callback, int code, String str1, String str2, in String[] paramArrayOfString, String str3, in Bundle params);
void getPanoramaService(IGmsCallbacks callback, int code, String str, in Bundle params);
void getAppDataSearchService(IGmsCallbacks callback, int code, String str);
void getWalletService(IGmsCallbacks callback, int code);
void getPeopleService(IGmsCallbacks callback, int code, String str, in Bundle params);
void getReportingService(IGmsCallbacks callback, int code, String str, in Bundle params);
void getLocationService(IGmsCallbacks callback, int code, String str, in Bundle params);
void getGoogleLocationManagerService(IGmsCallbacks callback, int code, String str, in Bundle params);
void getGamesService(IGmsCallbacks callback, int code, String str1, String str2, in String[] args, String str3, IBinder binder, String str4, in Bundle params);
void getAppStateService(IGmsCallbacks callback, int code, String str1, String str2, in String[] args);
void getPlayLogService(IGmsCallbacks callback, int code, String str, in Bundle params);
void getAdMobService(IGmsCallbacks callback, int code, String str, in Bundle params);
void getDroidGuardService(IGmsCallbacks callback, int code, String str, in Bundle params);
void getLockboxService(IGmsCallbacks callback, int code, String str, in Bundle params);
void getCastMirroringService(IGmsCallbacks callback, int code, String str, in Bundle params);
void getNetworkQualityService(IGmsCallbacks callback, int code, String str, in Bundle params);
void getGoogleIdentityService(IGmsCallbacks callback, int code, String str, in Bundle params);
void getGoogleFeedbackService(IGmsCallbacks callback, int code, String str, in Bundle params);
void getCastService(IGmsCallbacks callback, int code, String str, IBinder binder, in Bundle params);
void getDriveService(IGmsCallbacks callback, int code, String str1, in String[] args, String str2, in Bundle params);
void getLightweightAppDataSearchService(IGmsCallbacks callback, int code, String str);
void getSearchAdministrationService(IGmsCallbacks callback, int code, String str);
void getAutoBackupService(IGmsCallbacks callback, int code, String str, in Bundle params);
void getAddressService(IGmsCallbacks callback, int code, String str);
}

View file

@ -1,24 +0,0 @@
/*
* Copyright (c) 2014 μg Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.gms.common.safeparcel;
import android.os.Parcelable;
public interface SafeParcelable extends Parcelable {
public static final String NULL = "SAFE_PARCELABLE_NULL_STRING";
int SAFE_PARCEL_MAGIC = 20293;
}

View file

@ -1,131 +0,0 @@
/*
* Copyright (c) 2014 μg Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.gms.common.safeparcel;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
public class SafeReader {
public static int halfOf(int i) {
return i & 0xFFFF;
}
public static int readSingleInt(Parcel parcel) {
return parcel.readInt();
}
private static int readStart(Parcel parcel, int first) {
if ((first & 0xFFFF0000) != -65536)
return first >> 16 & 0xFFFF;
return parcel.readInt();
}
private static void readStart(Parcel parcel, int position, int length) {
int i = readStart(parcel, position);
if (i != length)
throw new ReadException("Expected size " + length + " got " + i + " (0x" + Integer.toHexString(i) + ")", parcel);
}
public static int readStart(Parcel parcel) {
int first = readSingleInt(parcel);
int length = readStart(parcel, first);
int start = parcel.dataPosition();
if (halfOf(first) != SafeParcelable.SAFE_PARCEL_MAGIC)
throw new ReadException("Expected object header. Got 0x" + Integer.toHexString(first), parcel);
int end = start + length;
if ((end < start) || (end > parcel.dataSize()))
throw new ReadException("Size read is invalid start=" + start + " end=" + end, parcel);
return end;
}
public static int readInt(Parcel parcel, int position) {
readStart(parcel, position, 4);
return parcel.readInt();
}
public static byte readByte(Parcel parcel, int position) {
readStart(parcel, position, 4);
return (byte) parcel.readInt();
}
public static short readShort(Parcel parcel, int position) {
readStart(parcel, position, 4);
return (short) parcel.readInt();
}
public static boolean readBool(Parcel parcel, int position) {
readStart(parcel, position, 4);
return parcel.readInt() != 0;
}
public static long readLong(Parcel parcel, int position) {
readStart(parcel, position, 8);
return parcel.readLong();
}
public static float readFloat(Parcel parcel, int position) {
readStart(parcel, position, 4);
return parcel.readFloat();
}
public static double readDouble(Parcel parcel, int position) {
readStart(parcel, position, 8);
return parcel.readDouble();
}
public static String readString(Parcel parcel, int position) {
int length = readStart(parcel, position);
int start = parcel.dataPosition();
if (length == 0)
return null;
String string = parcel.readString();
parcel.setDataPosition(start + length);
return string;
}
public static IBinder readBinder(Parcel parcel, int position) {
int length = readStart(parcel, position);
int start = parcel.dataPosition();
if (length == 0)
return null;
IBinder binder = parcel.readStrongBinder();
parcel.setDataPosition(start + length);
return binder;
}
public static <T extends Parcelable> T readParcelable(Parcel parcel, int position, Parcelable.Creator<T> creator) {
int length = readStart(parcel, position);
int start = parcel.dataPosition();
if (length == 0)
return null;
T t = creator.createFromParcel(parcel);
parcel.setDataPosition(start + length);
return t;
}
public static void skip(Parcel parcel, int position) {
int i = readStart(parcel, position);
parcel.setDataPosition(parcel.dataPosition() + i);
}
public static class ReadException extends RuntimeException {
public ReadException(String message, Parcel parcel) {
super(message);
}
}
}

View file

@ -1,228 +0,0 @@
/*
* Copyright (c) 2014 μg Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.gms.common.safeparcel;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.List;
public class SafeWriter {
private static void writeStart(Parcel parcel, int position, int length) {
if (length >= 65535) {
parcel.writeInt(0xFFFF0000 | position);
parcel.writeInt(length);
} else {
parcel.writeInt(length << 16 | position);
}
}
public static int writeStart(Parcel parcel) {
return writeStart(parcel, SafeParcelable.SAFE_PARCEL_MAGIC);
}
private static int writeStart(Parcel parcel, int position) {
parcel.writeInt(0xFFFF0000 | position);
parcel.writeInt(0);
return parcel.dataPosition();
}
public static void writeEnd(Parcel parcel, int start) {
int end = parcel.dataPosition();
int length = end - start;
parcel.setDataPosition(start - 4);
parcel.writeInt(length);
parcel.setDataPosition(end);
}
public static void write(Parcel parcel, int position, boolean val) {
writeStart(parcel, position, 4);
parcel.writeInt(val ? 1 : 0);
}
public static void write(Parcel parcel, int position, byte val) {
writeStart(parcel, position, 4);
parcel.writeInt(val);
}
public static void write(Parcel parcel, int position, short val) {
writeStart(parcel, position, 4);
parcel.writeInt(val);
}
public static void write(Parcel parcel, int position, int val) {
writeStart(parcel, position, 4);
parcel.writeInt(val);
}
public static void write(Parcel parcel, int position, long val) {
writeStart(parcel, position, 8);
parcel.writeLong(val);
}
public static void write(Parcel parcel, int position, float val) {
writeStart(parcel, position, 4);
parcel.writeFloat(val);
}
public static void write(Parcel parcel, int position, double val) {
writeStart(parcel, position, 8);
parcel.writeDouble(val);
}
public static void write(Parcel parcel, int position, String val, boolean mayNull) {
if (val == null) {
if (mayNull) {
writeStart(parcel, position, 0);
}
} else {
int start = writeStart(parcel, position);
parcel.writeString(val);
writeEnd(parcel, start);
}
}
public static void write(Parcel parcel, int position, Parcelable val, int flags, boolean mayNull) {
if (val == null) {
if (mayNull) {
writeStart(parcel, position, 0);
}
} else {
int start = writeStart(parcel, position);
val.writeToParcel(parcel, flags);
writeEnd(parcel, start);
}
}
public static void write(Parcel parcel, int position, Bundle val, boolean mayNull) {
if (val == null) {
if (mayNull) {
writeStart(parcel, position, 0);
}
} else {
int start = writeStart(parcel, position);
parcel.writeBundle(val);
writeEnd(parcel, start);
}
}
public static void write(Parcel parcel, int position, byte[] val, boolean mayNull) {
if (val == null) {
if (mayNull) {
writeStart(parcel, position, 0);
}
} else {
int start = writeStart(parcel, position);
parcel.writeByteArray(val);
writeEnd(parcel, start);
}
}
public static void write(Parcel parcel, int position, String[] val, boolean mayNull) {
if (val == null) {
if (mayNull) {
writeStart(parcel, position, 0);
}
} else {
int start = writeStart(parcel, position);
parcel.writeStringArray(val);
writeEnd(parcel, start);
}
}
public static void writeStringList(Parcel parcel, int position, List<String> val, boolean mayNull) {
if (val == null) {
if (mayNull) {
writeStart(parcel, position, 0);
}
} else {
int start = writeStart(parcel, position);
parcel.writeStringList(val);
writeEnd(parcel, start);
}
}
private static <T extends Parcelable> void writeArrayPart(Parcel parcel, T val, int flags) {
int before = parcel.dataPosition();
parcel.writeInt(1);
int start = parcel.dataPosition();
val.writeToParcel(parcel, flags);
int end = parcel.dataPosition();
parcel.setDataPosition(before);
parcel.writeInt(end - start);
parcel.setDataPosition(end);
}
public static <T extends Parcelable> void write(Parcel parcel, int position, T[] val, int flags, boolean mayNull) {
if (val == null) {
if (mayNull) {
writeStart(parcel, position, 0);
}
} else {
int start = writeStart(parcel, position);
parcel.writeInt(val.length);
for (T t : val) {
if (t == null) {
parcel.writeInt(0);
} else {
writeArrayPart(parcel, t, flags);
}
}
writeEnd(parcel, start);
}
}
public static void write(Parcel parcel, int position, Parcel val, boolean mayNull) {
if (val == null) {
if (mayNull) {
writeStart(parcel, position, 0);
}
} else {
int start = writeStart(parcel, position);
parcel.appendFrom(val, 0, val.dataSize());
writeEnd(parcel, start);
}
}
public static void write(Parcel parcel, int position, List val, boolean mayNull) {
if (val == null) {
if (mayNull) {
writeStart(parcel, position, 0);
}
} else {
int start = writeStart(parcel, position);
parcel.writeList(val);
writeEnd(parcel, start);
}
}
public static void write(Parcel parcel, int position, IBinder val, boolean mayNull) {
if (val == null) {
if (mayNull) {
writeStart(parcel, position, 0);
}
} else {
int start = writeStart(parcel, position);
parcel.writeStrongBinder(val);
writeEnd(parcel, start);
}
}
}

View file

@ -1,4 +0,0 @@
package com.google.android.gms.dynamic;
interface IObjectWrapper {
}

View file

@ -1,64 +0,0 @@
/*
* Copyright (c) 2014 μg Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.gms.dynamic;
import android.os.IBinder;
import android.view.View;
import java.lang.reflect.Field;
public class ObjectWrapper<T> extends IObjectWrapper.Stub {
private final T t;
public ObjectWrapper(T t) {
this.t = t;
}
public static Object unwrap(IObjectWrapper obj) {
if (obj == null) {
return null;
}
if (obj instanceof ObjectWrapper) {
return ((ObjectWrapper) obj).t;
}
IBinder binder = obj.asBinder();
Field[] fields = binder.getClass().getDeclaredFields();
if (fields.length != 1) {
throw new IllegalArgumentException("The concrete class implementing IObjectWrapper must have exactly *one* declared private field for the wrapped object. Preferably, this is an instance of the ObjectWrapper<T> class.");
}
Field field = fields[0];
if (!field.isAccessible()) {
field.setAccessible(true);
try {
Object wrapped = field.get(binder);
return wrapped;
} catch (NullPointerException localNullPointerException) {
throw new IllegalArgumentException("Binder object is null.", localNullPointerException);
} catch (IllegalArgumentException localIllegalArgumentException) {
throw new IllegalArgumentException("remoteBinder is the wrong class.", localIllegalArgumentException);
} catch (IllegalAccessException localIllegalAccessException) {
throw new IllegalArgumentException("Could not access the field in remoteBinder.", localIllegalAccessException);
}
} else {
throw new IllegalArgumentException("The concrete class implementing IObjectWrapper must have exactly one declared *private* field for the wrapped object. Preferably, this is an instance of the ObjectWrapper<T> class.");
}
}
public static <T> ObjectWrapper<T> wrap(T t) {
return new ObjectWrapper<T>(t);
}
}

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location;
parcelable Geofence;

View file

@ -1,45 +0,0 @@
/*
* Copyright (c) 2014 μg Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.gms.location;
import android.os.Parcel;
import com.google.android.gms.common.safeparcel.SafeParcelable;
public class Geofence implements SafeParcelable{
public static Creator<Geofence> CREATOR = new Creator<Geofence>() {
@Override
public Geofence createFromParcel(Parcel source) {
return new Geofence();
}
@Override
public Geofence[] newArray(int size) {
return new Geofence[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
}
}

View file

@ -1,4 +0,0 @@
package com.google.android.gms.location.internal;
interface IGeofencerCallbacks {
}

View file

@ -1,8 +0,0 @@
package com.google.android.gms.location.internal;
import com.google.android.gms.location.Geofence;
import com.google.android.gms.location.internal.IGeofencerCallbacks;
interface IGoogleLocationManagerService {
void addGeofences(in List<com.google.android.gms.location.Geofence> geofences, in PendingIntent pendingIntent, IGeofencerCallbacks callback, String str);
}

View file

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

View file

@ -1,152 +0,0 @@
/*
* Copyright (c) 2014 μg Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.gms.maps;
import android.os.Parcel;
import com.google.android.gms.common.safeparcel.SafeParcelable;
import com.google.android.gms.common.safeparcel.SafeReader;
import com.google.android.gms.common.safeparcel.SafeWriter;
import com.google.android.gms.maps.model.CameraPosition;
public class GoogleMapOptions implements SafeParcelable {
private int versionCode;
private int zOrderOnTop;
private boolean useViewLifecycleInFragment;
private int mapType;
private CameraPosition camera;
private boolean zoomControlsEnabled;
private boolean compassEnabled;
private boolean scrollGesturesEnabled;
private boolean zoomGesturesEnabled;
private boolean tiltGesturesEnabled;
private boolean rotateGesturesEnabled;
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
int start = SafeWriter.writeStart(dest);
SafeWriter.write(dest, 1, versionCode);
SafeWriter.write(dest, 2, zOrderOnTop);
SafeWriter.write(dest, 3, useViewLifecycleInFragment);
SafeWriter.write(dest, 4, mapType);
SafeWriter.write(dest, 5, camera, flags, false);
SafeWriter.write(dest, 6, zoomControlsEnabled);
SafeWriter.write(dest, 7, compassEnabled);
SafeWriter.write(dest, 8, scrollGesturesEnabled);
SafeWriter.write(dest, 9, zoomGesturesEnabled);
SafeWriter.write(dest, 10, tiltGesturesEnabled);
SafeWriter.write(dest, 11, rotateGesturesEnabled);
SafeWriter.writeEnd(dest, start);
}
public GoogleMapOptions() {
}
private GoogleMapOptions(Parcel in) {
int end = SafeReader.readStart(in);
while (in.dataPosition() < end) {
int position = SafeReader.readSingleInt(in);
switch (SafeReader.halfOf(position)) {
case 1:
versionCode = SafeReader.readInt(in, position);
break;
case 2:
zOrderOnTop = SafeReader.readInt(in, position);
break;
case 3:
useViewLifecycleInFragment = SafeReader.readBool(in, position);
break;
case 4:
mapType = SafeReader.readInt(in, position);
break;
case 5:
camera = SafeReader.readParcelable(in, position, CameraPosition.CREATOR);
break;
case 6:
zoomControlsEnabled = SafeReader.readBool(in, position);
break;
case 7:
compassEnabled = SafeReader.readBool(in, position);
break;
case 8:
scrollGesturesEnabled = SafeReader.readBool(in, position);
break;
case 9:
zoomGesturesEnabled = SafeReader.readBool(in, position);
break;
case 10:
tiltGesturesEnabled = SafeReader.readBool(in, position);
break;
case 11:
rotateGesturesEnabled = SafeReader.readBool(in, position);
break;
default:
SafeReader.skip(in, position);
}
}
if (in.dataPosition() > end) {
throw new SafeReader.ReadException("Overread allowed size end=" + end, in);
}
}
public int getMapType() {
return mapType;
}
public CameraPosition getCamera() {
return camera;
}
public boolean isZoomControlsEnabled() {
return zoomControlsEnabled;
}
public boolean isCompassEnabled() {
return compassEnabled;
}
public boolean isScrollGesturesEnabled() {
return scrollGesturesEnabled;
}
public boolean isZoomGesturesEnabled() {
return zoomGesturesEnabled;
}
public boolean isTiltGesturesEnabled() {
return tiltGesturesEnabled;
}
public boolean isRotateGesturesEnabled() {
return rotateGesturesEnabled;
}
public static Creator<GoogleMapOptions> CREATOR = new Creator<GoogleMapOptions>() {
public GoogleMapOptions createFromParcel(Parcel source) {
return new GoogleMapOptions(source);
}
public GoogleMapOptions[] newArray(int size) {
return new GoogleMapOptions[size];
}
};
}

View file

@ -1,20 +0,0 @@
package com.google.android.gms.maps.internal;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
interface ICameraUpdateFactoryDelegate {
IObjectWrapper zoomIn();
IObjectWrapper zoomOut();
IObjectWrapper scrollBy(float x, float y);
IObjectWrapper zoomTo(float zoom);
IObjectWrapper zoomBy(float zoomDelta);
IObjectWrapper zoomByWithFocus(float zoomDelta, int x, int y);
IObjectWrapper newCameraPosition(in CameraPosition cameraPosition);
IObjectWrapper newLatLng(in LatLng latLng);
IObjectWrapper newLatLngZoom(in LatLng latLng, float zoom);
IObjectWrapper newLatLngBounds(in LatLngBounds bounds, int i);
IObjectWrapper newLatLngBoundsWithSize(in LatLngBounds bounds, int i1, int i2, int i3);
}

View file

@ -1,6 +0,0 @@
package com.google.android.gms.maps.internal;
interface ICancelableCallback {
void onFinish();
void onCancel();
}

View file

@ -1,17 +0,0 @@
package com.google.android.gms.maps.internal;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.android.gms.maps.GoogleMapOptions;
import com.google.android.gms.maps.internal.IMapFragmentDelegate;
import com.google.android.gms.maps.internal.IMapViewDelegate;
import com.google.android.gms.maps.internal.ICameraUpdateFactoryDelegate;
import com.google.android.gms.maps.model.internal.IBitmapDescriptorFactoryDelegate;
interface ICreator {
void init(IObjectWrapper resources);
IMapFragmentDelegate newMapFragmentDelegate(IObjectWrapper activity);
IMapViewDelegate newMapViewDelegate(IObjectWrapper context, in GoogleMapOptions options);
ICameraUpdateFactoryDelegate newCameraUpdateFactoryDelegate();
IBitmapDescriptorFactoryDelegate newBitmapDescriptorFactoryDelegate();
void initV2(IObjectWrapper resources, int flags);
}

View file

@ -1,91 +0,0 @@
package com.google.android.gms.maps.internal;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.internal.ICancelableCallback;
import com.google.android.gms.maps.internal.ILocationSourceDelegate;
import com.google.android.gms.maps.internal.IUiSettingsDelegate;
import com.google.android.gms.maps.internal.IProjectionDelegate;
import com.google.android.gms.maps.internal.IOnCameraChangeListener;
import com.google.android.gms.maps.internal.IOnMapClickListener;
import com.google.android.gms.maps.internal.IOnMapLongClickListener;
import com.google.android.gms.maps.internal.IOnMarkerClickListener;
import com.google.android.gms.maps.internal.IOnMarkerDragListener;
import com.google.android.gms.maps.internal.IOnInfoWindowClickListener;
import com.google.android.gms.maps.internal.IInfoWindowAdapter;
import com.google.android.gms.maps.internal.IOnMapLoadedCallback;
import com.google.android.gms.maps.internal.IOnMyLocationChangeListener;
import com.google.android.gms.maps.internal.IOnMyLocationButtonClickListener;
import com.google.android.gms.maps.internal.ISnapshotReadyCallback;
import com.google.android.gms.maps.model.CircleOptions;
import com.google.android.gms.maps.model.GroundOverlayOptions;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.PolygonOptions;
import com.google.android.gms.maps.model.PolylineOptions;
import com.google.android.gms.maps.model.TileOverlayOptions;
import com.google.android.gms.maps.model.internal.IPolylineDelegate;
import com.google.android.gms.maps.model.internal.IPolygonDelegate;
import com.google.android.gms.maps.model.internal.IMarkerDelegate;
import com.google.android.gms.maps.model.internal.ICircleDelegate;
import com.google.android.gms.maps.model.internal.IGroundOverlayDelegate;
import com.google.android.gms.maps.model.internal.ITileOverlayDelegate;
interface IGoogleMapDelegate {
CameraPosition getCameraPosition();
float getMaxZoomLevel();
float getMinZoomLevel();
void moveCamera(IObjectWrapper cameraUpdate);
void animateCamera(IObjectWrapper cameraUpdate);
void animateCameraWithCallback(IObjectWrapper cameraUpdate, ICancelableCallback callback);
void animateCameraWithDurationAndCallback(IObjectWrapper cameraUpdate, int duration, ICancelableCallback callback);
void stopAnimation();
IPolylineDelegate addPolyline(in PolylineOptions options);
IPolygonDelegate addPolygon(in PolygonOptions options);
IMarkerDelegate addMarker(in MarkerOptions options);
IGroundOverlayDelegate addGroundOverlay(in GroundOverlayOptions options);
ITileOverlayDelegate addTileOverlay(in TileOverlayOptions options);
void clear();
int getMapType();
void setMapType(int type);
boolean isTrafficEnabled();
void setTrafficEnabled(boolean traffic);
boolean isIndoorEnabled();
void setIndoorEnabled(boolean indoor);
boolean isMyLocationEnabled();
void setMyLocationEnabled(boolean myLocation);
Location getMyLocation();
void setLocationSource(ILocationSourceDelegate locationSource);
IUiSettingsDelegate getUiSettings();
IProjectionDelegate getProjection();
void setOnCameraChangeListener(IOnCameraChangeListener listener);
void setOnMapClickListener(IOnMapClickListener listener);
void setOnMapLongClickListener(IOnMapLongClickListener listener);
void setOnMarkerClickListener(IOnMarkerClickListener listener);
void setOnMarkerDragListener(IOnMarkerDragListener listener);
void setOnInfoWindowClickListener(IOnInfoWindowClickListener listener);
void setInfoWindowAdapter(IInfoWindowAdapter adapter);
IObjectWrapper getTestingHelper();
ICircleDelegate addCircle(in CircleOptions options);
void setOnMyLocationChangeListener(IOnMyLocationChangeListener listener);
void setOnMyLocationButtonClickListener(IOnMyLocationButtonClickListener listener);
void snapshot(ISnapshotReadyCallback callback, IObjectWrapper bitmap);
void setPadding(int left, int top, int right, int bottom);
boolean isBuildingsEnabled();
void setBuildingsEnabled(boolean buildings);
void setOnMapLoadedCallback(IOnMapLoadedCallback callback);
}

View file

@ -1,9 +0,0 @@
package com.google.android.gms.maps.internal;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.android.gms.maps.model.internal.IMarkerDelegate;
interface IInfoWindowAdapter {
IObjectWrapper getInfoWindow(IMarkerDelegate marker);
IObjectWrapper getInfoContents(IMarkerDelegate marker);
}

View file

@ -1,4 +0,0 @@
package com.google.android.gms.maps.internal;
interface ILocationSourceDelegate {
}

View file

@ -1,19 +0,0 @@
package com.google.android.gms.maps.internal;
import com.google.android.gms.maps.internal.IGoogleMapDelegate;
import com.google.android.gms.maps.GoogleMapOptions;
import com.google.android.gms.dynamic.IObjectWrapper;
interface IMapFragmentDelegate {
IGoogleMapDelegate getMap();
void onInflate(IObjectWrapper activity, in GoogleMapOptions options, in Bundle savedInstanceState);
void onCreate(in Bundle savedInstanceState);
IObjectWrapper onCreateView(IObjectWrapper layoutInflate, IObjectWrapper container, in Bundle savedInstanceState);
void onResume();
void onPause();
void onDestroyView();
void onDestroy();
void onLowMemory();
void onSaveInstanceState(inout Bundle outState);
boolean isReady();
}

View file

@ -1,15 +0,0 @@
package com.google.android.gms.maps.internal;
import com.google.android.gms.maps.internal.IGoogleMapDelegate;
import com.google.android.gms.dynamic.IObjectWrapper;
interface IMapViewDelegate {
IGoogleMapDelegate getMap();
void onCreate(in Bundle savedInstanceState);
void onResume();
void onPause();
void onDestroy();
void onLowMemory();
void onSaveInstanceState(inout Bundle outState);
IObjectWrapper getView();
}

View file

@ -1,4 +0,0 @@
package com.google.android.gms.maps.internal;
interface IOnCameraChangeListener {
}

View file

@ -1,7 +0,0 @@
package com.google.android.gms.maps.internal;
import com.google.android.gms.maps.model.internal.IMarkerDelegate;
interface IOnInfoWindowClickListener {
void onInfoWindowClick(IMarkerDelegate marker);
}

View file

@ -1,7 +0,0 @@
package com.google.android.gms.maps.internal;
import com.google.android.gms.maps.model.LatLng;
interface IOnMapClickListener {
void onMapClick(in LatLng latLng);
}

View file

@ -1,4 +0,0 @@
package com.google.android.gms.maps.internal;
interface IOnMapLoadedCallback {
}

View file

@ -1,7 +0,0 @@
package com.google.android.gms.maps.internal;
import com.google.android.gms.maps.model.LatLng;
interface IOnMapLongClickListener {
void onMapLongClick(in LatLng latLng);
}

View file

@ -1,7 +0,0 @@
package com.google.android.gms.maps.internal;
import com.google.android.gms.maps.model.internal.IMarkerDelegate;
interface IOnMarkerClickListener {
boolean onMarkerClick(IMarkerDelegate marker);
}

View file

@ -1,4 +0,0 @@
package com.google.android.gms.maps.internal;
interface IOnMarkerDragListener {
}

View file

@ -1,4 +0,0 @@
package com.google.android.gms.maps.internal;
interface IOnMyLocationButtonClickListener {
}

View file

@ -1,4 +0,0 @@
package com.google.android.gms.maps.internal;
interface IOnMyLocationChangeListener {
}

View file

@ -1,11 +0,0 @@
package com.google.android.gms.maps.internal;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.VisibleRegion;
interface IProjectionDelegate {
LatLng fromScreenLocation(IObjectWrapper obj);
IObjectWrapper toScreenLocation(in LatLng latLng);
VisibleRegion getVisibleRegion();
}

View file

@ -1,4 +0,0 @@
package com.google.android.gms.maps.internal;
interface ISnapshotReadyCallback {
}

View file

@ -1,19 +0,0 @@
package com.google.android.gms.maps.internal;
interface IUiSettingsDelegate {
void setZoomControlsEnabled(boolean zoom);
void setCompassEnabled(boolean compass);
void setMyLocationButtonEnabled(boolean locationButton);
void setScrollGesturesEnabled(boolean scrollGestures);
void setZoomGesturesEnabled(boolean zoomGestures);
void setTiltGesturesEnabled(boolean tiltGestures);
void setRotateGesturesEnabled(boolean rotateGestures);
void setAllGesturesEnabled(boolean gestures);
boolean isZoomControlsEnabled();
boolean isCompassEnabled();
boolean isMyLocationButtonEnabled();
boolean isScrollGesturesEnabled();
boolean isZoomGesturesEnabled();
boolean isTiltGesturesEnabled();
boolean isRotateGesturesEnabled();
}

View file

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

View file

@ -1,116 +0,0 @@
/*
* Copyright (c) 2014 μg Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.gms.maps.model;
import android.os.Parcel;
import com.google.android.gms.common.safeparcel.SafeParcelable;
import com.google.android.gms.common.safeparcel.SafeReader;
import com.google.android.gms.common.safeparcel.SafeWriter;
import java.util.Arrays;
public class CameraPosition implements SafeParcelable {
public static Creator<CameraPosition> CREATOR = new Creator<CameraPosition>() {
public CameraPosition createFromParcel(Parcel source) {
return new CameraPosition(source);
}
public CameraPosition[] newArray(int size) {
return new CameraPosition[size];
}
};
private int versionCode;
public LatLng target;
public float zoom;
public float tilt;
public float bearing;
private CameraPosition(Parcel in) {
int end = SafeReader.readStart(in);
while (in.dataPosition() < end) {
int position = SafeReader.readSingleInt(in);
switch (SafeReader.halfOf(position)) {
case 1:
versionCode = SafeReader.readInt(in, position);
break;
case 2:
target = SafeReader.readParcelable(in, position, LatLng.CREATOR);
break;
case 3:
zoom = SafeReader.readFloat(in, position);
break;
case 4:
tilt = SafeReader.readFloat(in, position);
break;
case 5:
bearing = SafeReader.readFloat(in, position);
break;
default:
SafeReader.skip(in, position);
}
}
if (in.dataPosition() > end) {
throw new SafeReader.ReadException("Overread allowed size end=" + end, in);
}
}
public CameraPosition(int versionCode, LatLng target, float zoom, float tilt, float bearing) {
this.versionCode = versionCode;
if (target == null) {
throw new NullPointerException("null camera target");
}
this.target = target;
this.zoom = zoom;
if (tilt < 0 || 90 < tilt) {
throw new IllegalArgumentException("Tilt needs to be between 0 and 90 inclusive");
}
this.tilt = tilt;
if (bearing <= 0) {
bearing += 360;
}
this.bearing = bearing % 360;
}
public CameraPosition(LatLng target, float zoom, float tilt, float bearing) {
this(1, target, zoom, tilt, bearing);
}
@Override
public int hashCode() {
return Arrays.hashCode(new Object[]{target, zoom, tilt, bearing});
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
int i = SafeWriter.writeStart(dest);
SafeWriter.write(dest, 1, versionCode);
SafeWriter.write(dest, 2, target, flags, false);
SafeWriter.write(dest, 3, zoom);
SafeWriter.write(dest, 4, tilt);
SafeWriter.write(dest, 5, bearing);
SafeWriter.writeEnd(dest, i);
}
public static CameraPosition create(LatLng latLng) {
return new CameraPosition(latLng, 0, 0, 0);
}
}

View file

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

View file

@ -1,102 +0,0 @@
/*
* Copyright (c) 2014 μg Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.gms.maps.model;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.android.gms.common.safeparcel.SafeReader;
import com.google.android.gms.common.safeparcel.SafeWriter;
public class CircleOptions implements Parcelable {
public static Creator<CircleOptions> CREATOR = new Creator<CircleOptions>() {
public CircleOptions createFromParcel(Parcel source) {
return new CircleOptions(source);
}
public CircleOptions[] newArray(int size) {
return new CircleOptions[size];
}
};
private int versionCode;
private LatLng center;
private double radius;
private float strokeWidth;
private int strokeColor;
private int fillColor;
private float zIndex;
private boolean visisble;
public CircleOptions() {
}
private CircleOptions(Parcel in) {
int end = SafeReader.readStart(in);
while (in.dataPosition() < end) {
int position = SafeReader.readSingleInt(in);
switch (SafeReader.halfOf(position)) {
case 1:
versionCode = SafeReader.readInt(in, position);
break;
case 2:
center = SafeReader.readParcelable(in, position, LatLng.CREATOR);
break;
case 3:
radius = SafeReader.readDouble(in, position);
break;
case 4:
strokeWidth = SafeReader.readFloat(in, position);
break;
case 5:
strokeColor = SafeReader.readInt(in, position);
break;
case 6:
fillColor = SafeReader.readInt(in, position);
break;
case 7:
zIndex = SafeReader.readFloat(in, position);
break;
case 8:
visisble = SafeReader.readBool(in, position);
break;
default:
SafeReader.skip(in, position);
}
}
if (in.dataPosition() > end) {
throw new SafeReader.ReadException("Overread allowed size end=" + end, in);
}
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
int start = SafeWriter.writeStart(dest);
SafeWriter.write(dest, 1, versionCode);
SafeWriter.write(dest, 2, center, flags, false);
SafeWriter.write(dest, 3, radius);
SafeWriter.write(dest, 4, strokeWidth);
SafeWriter.write(dest, 5, strokeColor);
SafeWriter.write(dest, 6, fillColor);
SafeWriter.write(dest, 7, zIndex);
SafeWriter.write(dest, 8, visisble);
SafeWriter.writeEnd(dest, start);
}
}

View file

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

View file

@ -1,124 +0,0 @@
/*
* Copyright (c) 2014 μg Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.gms.maps.model;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.android.gms.common.safeparcel.SafeReader;
import com.google.android.gms.common.safeparcel.SafeWriter;
import com.google.android.gms.dynamic.IObjectWrapper;
import org.microg.gms.maps.bitmap.BitmapDescriptor;
public class GroundOverlayOptions implements Parcelable {
public static Creator<GroundOverlayOptions> CREATOR = new Creator<GroundOverlayOptions>() {
public GroundOverlayOptions createFromParcel(Parcel source) {
return new GroundOverlayOptions(source);
}
public GroundOverlayOptions[] newArray(int size) {
return new GroundOverlayOptions[size];
}
};
private int versionCode;
private BitmapDescriptor wrappedImage;
private LatLng location;
private float width;
private float height;
private LatLngBounds bounds;
private float bearing;
private float zIndex;
private boolean visible;
private float transparency;
private float anchorU;
private float anchorV;
public GroundOverlayOptions() {
}
private GroundOverlayOptions(Parcel in) {
int end = SafeReader.readStart(in);
while (in.dataPosition() < end) {
int position = SafeReader.readSingleInt(in);
switch (SafeReader.halfOf(position)) {
case 1:
versionCode = SafeReader.readInt(in, position);
break;
case 2:
wrappedImage = new BitmapDescriptor(IObjectWrapper.Stub.asInterface(SafeReader.readBinder(in, position)));
break;
case 3:
location = SafeReader.readParcelable(in, position, LatLng.CREATOR);
break;
case 4:
width = SafeReader.readFloat(in, position);
break;
case 5:
height = SafeReader.readFloat(in, position);
break;
case 6:
bounds = SafeReader.readParcelable(in, position, LatLngBounds.CREATOR);
break;
case 7:
bearing = SafeReader.readFloat(in, position);
break;
case 8:
zIndex = SafeReader.readFloat(in, position);
break;
case 9:
visible = SafeReader.readBool(in, position);
break;
case 10:
transparency = SafeReader.readFloat(in, position);
break;
case 11:
anchorU = SafeReader.readFloat(in, position);
break;
case 12:
anchorV = SafeReader.readFloat(in, position);
break;
default:
SafeReader.skip(in, position);
}
}
if (in.dataPosition() > end) {
throw new SafeReader.ReadException("Overread allowed size end=" + end, in);
}
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
int start = SafeWriter.writeStart(dest);
SafeWriter.write(dest, 1, versionCode);
SafeWriter.write(dest, 2, wrappedImage.getRemoteObject().asBinder(), false);
SafeWriter.write(dest, 3, location, flags, false);
SafeWriter.write(dest, 4, width);
SafeWriter.write(dest, 5, height);
SafeWriter.write(dest, 6, bounds, flags, false);
SafeWriter.write(dest, 7, bearing);
SafeWriter.write(dest, 8, zIndex);
SafeWriter.write(dest, 9, visible);
SafeWriter.write(dest, 10, transparency);
SafeWriter.write(dest, 11, anchorU);
SafeWriter.write(dest, 12, anchorV);
SafeWriter.writeEnd(dest, start);
}
}

View file

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

View file

@ -1,110 +0,0 @@
/*
* Copyright (c) 2014 μg Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.gms.maps.model;
import android.os.Parcel;
import com.google.android.gms.common.safeparcel.SafeParcelable;
import com.google.android.gms.common.safeparcel.SafeReader;
import com.google.android.gms.common.safeparcel.SafeWriter;
import com.google.android.maps.GeoPoint;
public class LatLng implements SafeParcelable {
public static Creator<LatLng> CREATOR = new Creator<LatLng>() {
public LatLng createFromParcel(Parcel source) {
return new LatLng(source);
}
public LatLng[] newArray(int size) {
return new LatLng[size];
}
};
public double latitude;
public double longitude;
private int versionCode;
public LatLng(int versionCode, double latitude, double longitude) {
this.versionCode = versionCode;
this.latitude = Math.max(-90, Math.min(90, latitude));
if ((-180 <= longitude) && (longitude < 180)) {
this.longitude = longitude;
} else {
this.longitude = ((360 + (longitude - 180) % 360) % 360 - 180);
}
}
private LatLng(Parcel in) {
int end = SafeReader.readStart(in);
while (in.dataPosition() < end) {
int position = SafeReader.readSingleInt(in);
switch (SafeReader.halfOf(position)) {
case 1:
versionCode = SafeReader.readInt(in, position);
break;
case 2:
latitude = SafeReader.readDouble(in, position);
break;
case 3:
longitude = SafeReader.readDouble(in, position);
break;
default:
SafeReader.skip(in, position);
}
}
if (in.dataPosition() > end) {
throw new SafeReader.ReadException("Overread allowed size end=" + end, in);
}
}
public LatLng(double latitude, double longitude) {
this(1, latitude, longitude);
}
public LatLng(GeoPoint geoPoint) {
this(((double) geoPoint.getLatitudeE6()) / 1E6, ((double) geoPoint.getLongitudeE6()) / 1E6);
}
@Override
public final int hashCode() {
long lat = Double.doubleToLongBits(latitude);
int tmp = 31 + (int) (lat ^ lat >>> 32);
long lon = Double.doubleToLongBits(longitude);
return tmp * 31 + (int) (lon ^ lon >>> 32);
}
@Override
public String toString() {
return "lat/lng: (" + latitude + "," + longitude + ")";
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
int start = SafeWriter.writeStart(dest);
SafeWriter.write(dest, 1, versionCode);
SafeWriter.write(dest, 2, latitude);
SafeWriter.write(dest, 3, longitude);
SafeWriter.writeEnd(dest, start);
}
public GeoPoint toGeoPoint() {
return new GeoPoint((int) (latitude * 1E6F), (int) (longitude * 1E6F));
}
}

View file

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

View file

@ -1,84 +0,0 @@
/*
* Copyright (c) 2014 μg Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.gms.maps.model;
import android.os.Parcel;
import com.google.android.gms.common.safeparcel.SafeParcelable;
import com.google.android.gms.common.safeparcel.SafeReader;
import com.google.android.gms.common.safeparcel.SafeWriter;
public class LatLngBounds implements SafeParcelable {
public static Creator<LatLngBounds> CREATOR = new Creator<LatLngBounds>() {
public LatLngBounds createFromParcel(Parcel source) {
return new LatLngBounds(source);
}
public LatLngBounds[] newArray(int size) {
return new LatLngBounds[size];
}
};
private int versionCode;
public LatLng southWest;
public LatLng northEast;
public LatLngBounds(int versionCode, LatLng southWest, LatLng northEast) {
this.versionCode = versionCode;
this.southWest = southWest;
this.northEast = northEast;
}
public LatLngBounds(LatLng southWest, LatLng northEast) {
this(1, southWest, northEast);
}
private LatLngBounds(Parcel in) {
int end = SafeReader.readStart(in);
while (in.dataPosition() < end) {
int position = SafeReader.readSingleInt(in);
switch (SafeReader.halfOf(position)) {
case 1:
versionCode = SafeReader.readInt(in, position);
break;
case 2:
southWest = SafeReader.readParcelable(in, position, LatLng.CREATOR);
break;
case 3:
northEast = SafeReader.readParcelable(in, position, LatLng.CREATOR);
break;
default:
SafeReader.skip(in, position);
}
}
if (in.dataPosition() > end) {
throw new SafeReader.ReadException("Overread allowed size end=" + end, in);
}
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
int start = SafeWriter.writeStart(dest);
SafeWriter.write(dest, 1, versionCode);
SafeWriter.write(dest, 2, southWest, flags, false);
SafeWriter.write(dest, 3, northEast, flags, false);
SafeWriter.writeEnd(dest, start);
}
}

View file

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

View file

@ -1,174 +0,0 @@
/*
* Copyright (c) 2014 μg Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.gms.maps.model;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.android.gms.common.safeparcel.SafeReader;
import com.google.android.gms.dynamic.ObjectWrapper;
import org.microg.gms.maps.bitmap.BitmapDescriptor;
public class MarkerOptions implements Parcelable {
private int versionCode = 1;
private LatLng position;
private String title;
private String snippet;
private BitmapDescriptor icon;
private float anchorU = 0.5F;
private float anchorV = 1F;
private boolean draggable;
private boolean visible;
private boolean flat;
private float rotation = 0F;
private float infoWindowAnchorU = 0F;
private float infoWindowAnchorV = 1F;
private float alpha = 1F;
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
}
public MarkerOptions() {
}
private MarkerOptions(Parcel in) {
int end = SafeReader.readStart(in);
while (in.dataPosition() < end) {
int position = SafeReader.readSingleInt(in);
switch (SafeReader.halfOf(position)) {
case 1:
this.versionCode = SafeReader.readInt(in, position);
break;
case 2:
this.position = SafeReader.readParcelable(in, position, LatLng.CREATOR);
break;
case 3:
this.title = SafeReader.readString(in, position);
break;
case 4:
this.snippet = SafeReader.readString(in, position);
break;
case 5:
IBinder icon = SafeReader.readBinder(in, position);
this.icon = icon == null ? null : new BitmapDescriptor(ObjectWrapper.asInterface(icon));
break;
case 6:
this.anchorU = SafeReader.readFloat(in, position);
break;
case 7:
this.anchorV = SafeReader.readFloat(in, position);
break;
case 8:
this.draggable = SafeReader.readBool(in, position);
break;
case 9:
this.visible = SafeReader.readBool(in, position);
break;
case 10:
this.flat = SafeReader.readBool(in, position);
break;
case 11:
this.rotation = SafeReader.readFloat(in, position);
break;
case 12:
this.infoWindowAnchorU = SafeReader.readFloat(in, position);
break;
case 13:
this.infoWindowAnchorV = SafeReader.readFloat(in, position);
break;
case 14:
this.rotation = SafeReader.readFloat(in, position);
break;
default:
SafeReader.skip(in, position);
break;
}
}
if (in.dataPosition() > end) {
throw new SafeReader.ReadException("Overread allowed size end=" + end, in);
}
}
public LatLng getPosition() {
return position;
}
public String getTitle() {
return title;
}
public String getSnippet() {
return snippet;
}
public BitmapDescriptor getIcon() {
return icon;
}
public float getAnchorU() {
return anchorU;
}
public float getAnchorV() {
return anchorV;
}
public boolean isDraggable() {
return draggable;
}
public boolean isVisible() {
return visible;
}
public boolean isFlat() {
return flat;
}
public float getRotation() {
return rotation;
}
public float getInfoWindowAnchorU() {
return infoWindowAnchorU;
}
public float getInfoWindowAnchorV() {
return infoWindowAnchorV;
}
public float getAlpha() {
return alpha;
}
public static Creator<MarkerOptions> CREATOR = new Creator<MarkerOptions>() {
public MarkerOptions createFromParcel(Parcel source) {
return new MarkerOptions(source);
}
public MarkerOptions[] newArray(int size) {
return new MarkerOptions[size];
}
};
}

View file

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

View file

@ -1,48 +0,0 @@
/*
* Copyright (c) 2014 μg Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.gms.maps.model;
import android.os.Parcel;
import android.os.Parcelable;
public class PolygonOptions implements Parcelable {
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
}
public PolygonOptions() {
}
private PolygonOptions(Parcel in) {
}
public static Creator<PolygonOptions> CREATOR = new Creator<PolygonOptions>() {
public PolygonOptions createFromParcel(Parcel source) {
return new PolygonOptions(source);
}
public PolygonOptions[] newArray(int size) {
return new PolygonOptions[size];
}
};
}

View file

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

View file

@ -1,61 +0,0 @@
/*
* Copyright (c) 2014 μg Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.gms.maps.model;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.ArrayList;
import java.util.List;
public class PolylineOptions implements Parcelable {
private int versionCode;
private List<LatLng> points;
private float width;
private int color;
private float zIndex;
private boolean visible;
private boolean geodesic;
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
// TODO
}
public PolylineOptions() {
}
private PolylineOptions(Parcel in) {
// TODO
}
public static Creator<PolylineOptions> CREATOR = new Creator<PolylineOptions>() {
public PolylineOptions createFromParcel(Parcel source) {
return new PolylineOptions(source);
}
public PolylineOptions[] newArray(int size) {
return new PolylineOptions[size];
}
};
}

View file

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

View file

@ -1,48 +0,0 @@
/*
* Copyright (c) 2014 μg Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.gms.maps.model;
import android.os.Parcel;
import android.os.Parcelable;
public class TileOverlayOptions implements Parcelable {
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
}
public TileOverlayOptions() {
}
private TileOverlayOptions(Parcel in) {
}
public static Creator<TileOverlayOptions> CREATOR = new Creator<TileOverlayOptions>() {
public TileOverlayOptions createFromParcel(Parcel source) {
return new TileOverlayOptions(source);
}
public TileOverlayOptions[] newArray(int size) {
return new TileOverlayOptions[size];
}
};
}

View file

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

View file

@ -1,105 +0,0 @@
/*
* Copyright (c) 2014 μg Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.gms.maps.model;
import android.os.Parcel;
import com.google.android.gms.common.safeparcel.SafeParcelable;
import com.google.android.gms.common.safeparcel.SafeReader;
import com.google.android.gms.common.safeparcel.SafeWriter;
public class VisibleRegion implements SafeParcelable {
private int versionCode;
private LatLng nearLeft;
private LatLng nearRight;
private LatLng farLeft;
private LatLng farRight;
private LatLngBounds bounds;
public VisibleRegion(int versionCode, LatLng nearLeft, LatLng nearRight, LatLng farLeft, LatLng farRight, LatLngBounds bounds) {
this.versionCode = versionCode;
this.nearLeft = nearLeft;
this.nearRight = nearRight;
this.farLeft = farLeft;
this.farRight = farRight;
this.bounds = bounds;
}
public VisibleRegion(LatLng nearLeft, LatLng nearRight, LatLng farLeft, LatLng farRight, LatLngBounds bounds) {
this(1, nearLeft, nearRight, farLeft, farRight, bounds);
}
public VisibleRegion(Parcel in) {
int end = SafeReader.readStart(in);
while (in.dataPosition() < end) {
int position = SafeReader.readSingleInt(in);
switch (SafeReader.halfOf(position)) {
case 1:
this.versionCode = SafeReader.readInt(in, position);
break;
case 2:
this.nearLeft = SafeReader.readParcelable(in, position, LatLng.CREATOR);
break;
case 3:
this.nearRight = SafeReader.readParcelable(in, position, LatLng.CREATOR);
break;
case 4:
this.farLeft = SafeReader.readParcelable(in, position, LatLng.CREATOR);
break;
case 5:
this.farRight = SafeReader.readParcelable(in, position, LatLng.CREATOR);
break;
case 6:
this.bounds = SafeReader.readParcelable(in, position, LatLngBounds.CREATOR);
break;
default:
SafeReader.skip(in, position);
break;
}
}
if (in.dataPosition() > end) {
throw new SafeReader.ReadException("Overread allowed size end=" + end, in);
}
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
int start = SafeWriter.writeStart(dest);
SafeWriter.write(dest, 1, versionCode);
SafeWriter.write(dest, 2, nearLeft, flags, false);
SafeWriter.write(dest, 3, nearRight, flags, false);
SafeWriter.write(dest, 4, farLeft, flags, false);
SafeWriter.write(dest, 5, farRight, flags, false);
SafeWriter.write(dest, 6, bounds, flags, false);
SafeWriter.writeEnd(dest, start);
}
public static Creator<VisibleRegion> CREATOR = new Creator<VisibleRegion>() {
public VisibleRegion createFromParcel(Parcel source) {
return new VisibleRegion(source);
}
public VisibleRegion[] newArray(int size) {
return new VisibleRegion[size];
}
};
}

View file

@ -1,14 +0,0 @@
package com.google.android.gms.maps.model.internal;
import android.graphics.Bitmap;
import com.google.android.gms.dynamic.IObjectWrapper;
interface IBitmapDescriptorFactoryDelegate {
IObjectWrapper fromResource(int resourceId);
IObjectWrapper fromAsset(String assetName);
IObjectWrapper fromFile(String fileName);
IObjectWrapper defaultMarker();
IObjectWrapper defaultMarkerWithHue(float hue);
IObjectWrapper fromBitmap(in Bitmap bitmap);
IObjectWrapper fromPath(String absolutePath);
}

View file

@ -1,24 +0,0 @@
package com.google.android.gms.maps.model.internal;
import com.google.android.gms.maps.model.LatLng;
interface ICircleDelegate {
void remove();
String getId();
void setCenter(in LatLng center);
LatLng getCenter();
void setRadius(double radius);
double getRadius();
void setStrokeWidth(float width);
float getStrokeWidth();
void setStrokeColor(int color);
int getStrokeColor();
void setFillColor(int color);
int getFillColor();
void setZIndex(float zIndex);
float getZIndex();
void setVisible(boolean visible);
boolean isVisible();
boolean equalsRemote(ICircleDelegate other);
int hashCodeRemote();
}

View file

@ -1,29 +0,0 @@
package com.google.android.gms.maps.model.internal;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
interface IGroundOverlayDelegate {
void remove();
String getId();
void setPosition(in LatLng pos);
LatLng getPosition();
void setDimension(float dimension);
void setDimensions(float width, float height);
float getWidth();
float getHeight();
void setPositionFromBounds(in LatLngBounds bounds);
LatLngBounds getBounds();
void setBearing(float bearing);
float getBearing();
void setZIndex(float zIndex);
float getZIndex();
void setVisible(boolean visible);
boolean isVisible();
void setTransparency(float transparency);
float getTransparency();
boolean equalsRemote(IGroundOverlayDelegate other);
int hashCodeRemote();
void todo(IObjectWrapper obj);
}

View file

@ -1,33 +0,0 @@
package com.google.android.gms.maps.model.internal;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.android.gms.maps.model.LatLng;
interface IMarkerDelegate {
void remove();
String getId();
void setPosition(in LatLng pos);
LatLng getPosition();
void setTitle(String title);
String getTitle();
void setSnippet(String snippet);
String getSnippet();
void setDraggable(boolean drag);
boolean isDraggable();
void showInfoWindow();
void hideInfoWindow();
boolean isInfoWindowShown();
void setVisible(boolean visible);
boolean isVisible();
boolean equalsRemote(IMarkerDelegate other);
int hashCodeRemote();
void setIcon(IObjectWrapper obj);
void setAnchor(float x, float y);
void setFlat(boolean flat);
boolean isFlat();
void setRotation(float rotation);
float getRotation();
void setInfoWindowAnchor(float x, float y);
void setAlpha(float alpha);
float getAlpha();
}

View file

@ -1,27 +0,0 @@
package com.google.android.gms.maps.model.internal;
import com.google.android.gms.maps.model.LatLng;
interface IPolygonDelegate {
void remove();
String getId();
void setPoints(in List<LatLng> points);
List<LatLng> getPoints();
void setHoles(in List holes);
List getHoles();
void setStrokeWidth(float width);
float getStrokeWidth();
void setStrokeColor(int color);
int getStrokeColor();
void setFillColor(int color);
int getFillColor();
void setZIndex(float zIndex);
float getZIndex();
void setVisible(boolean visible);
boolean isVisible();
void setGeodesic(boolean geod);
boolean isGeodesic();
boolean equalsRemote(IPolygonDelegate other);
int hashCodeRemote();
}

View file

@ -1,22 +0,0 @@
package com.google.android.gms.maps.model.internal;
import com.google.android.gms.maps.model.LatLng;
interface IPolylineDelegate {
void remove();
String getId();
void setPoints(in List<LatLng> points);
List<LatLng> getPoints();
void setWidth(float width);
float getWidth();
void setColor(int color);
int getColor();
void setZIndex(float zIndex);
float getZIndex();
void setVisible(boolean visible);
boolean isVisible();
void setGeodesic(boolean geod);
boolean isGeodesic();
boolean equalsRemote(IPolylineDelegate other);
int hashCodeRemote();
}

View file

@ -1,4 +0,0 @@
package com.google.android.gms.maps.model.internal;
interface ITileOverlayDelegate {
}

View file

@ -1,8 +0,0 @@
package com.google.android.gms.plus.internal;
import com.google.android.gms.dynamic.IObjectWrapper;
interface IPlusOneButtonCreator {
IObjectWrapper create(IObjectWrapper context, int size, int annotation, String url, int activityRequestCode);
IObjectWrapper createForAccount(IObjectWrapper context, int size, int annotation, String url, String account);
}

View file

@ -26,7 +26,7 @@ import android.util.Log;
import com.google.android.gms.location.Geofence;
import com.google.android.gms.location.internal.IGeofencerCallbacks;
import com.google.android.gms.location.internal.IGoogleLocationManagerService;
import org.microg.gms.AbstractGmsServiceBroker;
import com.google.android.gms.common.AbstractGmsServiceBroker;
import com.google.android.gms.common.internal.IGmsCallbacks;
import java.util.List;

View file

@ -1,145 +0,0 @@
/*
* Copyright (c) 2014 μg Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.microg.gms;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import com.google.android.gms.common.internal.IGmsCallbacks;
import com.google.android.gms.common.internal.IGmsServiceBroker;
public abstract class AbstractGmsServiceBroker extends IGmsServiceBroker.Stub {
@Override
public void getPlusService(IGmsCallbacks callback, int versionCode, String packageName, String str2, String[] paramArrayOfString, String str3, Bundle params) throws RemoteException {
throw new IllegalArgumentException("Plus service not supported");
}
@Override
public void getPanoramaService(IGmsCallbacks callback, int versionCode, String packageName, Bundle params) throws RemoteException {
throw new IllegalArgumentException("Panorama service not supported");
}
@Override
public void getAppDataSearchService(IGmsCallbacks callback, int versionCode, String packageName) throws RemoteException {
throw new IllegalArgumentException("App Data Search service not supported");
}
@Override
public void getWalletService(IGmsCallbacks callback, int versionCode) throws RemoteException {
throw new IllegalArgumentException("Wallet service not supported");
}
@Override
public void getPeopleService(IGmsCallbacks callback, int versionCode, String packageName, Bundle params) throws RemoteException {
throw new IllegalArgumentException("People service not supported");
}
@Override
public void getReportingService(IGmsCallbacks callback, int versionCode, String packageName, Bundle params) throws RemoteException {
throw new IllegalArgumentException("Reporting service not supported");
}
@Override
public void getLocationService(IGmsCallbacks callback, int versionCode, String packageName, Bundle params) throws RemoteException {
throw new IllegalArgumentException("Location service not supported");
}
@Override
public void getGoogleLocationManagerService(IGmsCallbacks callback, int versionCode, String packageName, Bundle params) throws RemoteException {
throw new IllegalArgumentException("Google Location Manager service not supported");
}
@Override
public void getGamesService(IGmsCallbacks callback, int versionCode, String packageName, String str2, String[] args, String str3, IBinder binder, String str4, Bundle params) throws RemoteException {
throw new IllegalArgumentException("Games service not supported");
}
@Override
public void getAppStateService(IGmsCallbacks callback, int versionCode, String packageName, String str2, String[] args) throws RemoteException {
throw new IllegalArgumentException("App State service not supported");
}
@Override
public void getPlayLogService(IGmsCallbacks callback, int versionCode, String packageName, Bundle params) throws RemoteException {
throw new IllegalArgumentException("Play Log service not supported");
}
@Override
public void getAdMobService(IGmsCallbacks callback, int versionCode, String packageName, Bundle params) throws RemoteException {
throw new IllegalArgumentException("AdMob service not supported");
}
@Override
public void getDroidGuardService(IGmsCallbacks callback, int versionCode, String packageName, Bundle params) throws RemoteException {
throw new IllegalArgumentException("DroidGuard service not supported");
}
@Override
public void getLockboxService(IGmsCallbacks callback, int versionCode, String packageName, Bundle params) throws RemoteException {
throw new IllegalArgumentException("Lockbox service not supported");
}
@Override
public void getCastMirroringService(IGmsCallbacks callback, int versionCode, String packageName, Bundle params) throws RemoteException {
throw new IllegalArgumentException("Cast Mirroring service not supported");
}
@Override
public void getNetworkQualityService(IGmsCallbacks callback, int versionCode, String packageName, Bundle params) throws RemoteException {
throw new IllegalArgumentException("Network Quality service not supported");
}
@Override
public void getGoogleIdentityService(IGmsCallbacks callback, int versionCode, String packageName, Bundle params) throws RemoteException {
throw new IllegalArgumentException("Google Identity service not supported");
}
@Override
public void getGoogleFeedbackService(IGmsCallbacks callback, int versionCode, String packageName, Bundle params) throws RemoteException {
throw new IllegalArgumentException("Google Feedback service not supported");
}
@Override
public void getCastService(IGmsCallbacks callback, int versionCode, String packageName, IBinder binder, Bundle params) throws RemoteException {
throw new IllegalArgumentException("Cast service not supported");
}
@Override
public void getDriveService(IGmsCallbacks callback, int versionCode, String packageName, String[] args, String str2, Bundle params) throws RemoteException {
throw new IllegalArgumentException("Drive service not supported");
}
@Override
public void getLightweightAppDataSearchService(IGmsCallbacks callback, int versionCode, String packageName) throws RemoteException {
throw new IllegalArgumentException("Lightweight App Data Search service not supported");
}
@Override
public void getSearchAdministrationService(IGmsCallbacks callback, int versionCode, String packageName) throws RemoteException {
throw new IllegalArgumentException("Search Administration service not supported");
}
@Override
public void getAutoBackupService(IGmsCallbacks callback, int versionCode, String packageName, Bundle params) throws RemoteException {
throw new IllegalArgumentException("Auto Backup service not supported");
}
@Override
public void getAddressService(IGmsCallbacks callback, int versionCode, String packageName) throws RemoteException {
throw new IllegalArgumentException("Address service not supported");
}
}

View file

@ -0,0 +1,143 @@
package org.microg.gms.maps;
import android.content.Context;
import android.graphics.BitmapFactory;
import android.view.View;
import com.google.android.gms.R;
import org.microg.gms.maps.bitmap.DefaultBitmapDescriptor;
import org.microg.gms.maps.camera.CameraUpdate;
import org.microg.gms.maps.markup.Markup;
import org.oscim.android.MapView;
import org.oscim.android.cache.TileCache;
import org.oscim.android.canvas.AndroidBitmap;
import org.oscim.core.MapPosition;
import org.oscim.layers.marker.ItemizedLayer;
import org.oscim.layers.marker.MarkerItem;
import org.oscim.layers.marker.MarkerSymbol;
import org.oscim.layers.tile.buildings.BuildingLayer;
import org.oscim.layers.tile.vector.VectorTileLayer;
import org.oscim.layers.tile.vector.labeling.LabelLayer;
import org.oscim.map.Layers;
import org.oscim.map.Map;
import org.oscim.map.Viewport;
import org.oscim.theme.VtmThemes;
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
public class BackendMap {
private final Context context;
private final MapView mapView;
private final BuildingLayer buildings;
private final VectorTileLayer baseLayer;
private final OSciMap4TileSource tileSource;
private final TileCache cache;
private final ItemizedLayer<MarkerItem> items;
public BackendMap(Context context) {
this.context = context;
mapView = new MapView(new ContextContainer(context));
// TODO: Use a shared tile cache (provider?)
cache = new TileCache(context, null, "tile.db");
cache.setCacheSize(512 * (1 << 10));
tileSource = new OSciMap4TileSource();
tileSource.setCache(cache);
baseLayer = mapView.map().setBaseMap(tileSource);
Layers layers = mapView.map().layers();
layers.add(buildings = new BuildingLayer(mapView.map(), baseLayer));
layers.add(new LabelLayer(mapView.map(), baseLayer));
layers.add(items = new ItemizedLayer<>(mapView.map(), new MarkerSymbol(new AndroidBitmap(BitmapFactory
.decodeResource(ResourcesContainer.get(), R.drawable.maps_default_marker)), 0.5F, 1)));
mapView.map().setTheme(VtmThemes.DEFAULT);
}
public void setInputListener(Map.InputListener listener) {
mapView.map().input.bind(listener);
}
public Viewport getViewport() {
return mapView.map().viewport();
}
public void destroy() {
//mapView.map().destroy();
}
public void onResume() {
/*try {
Method onResume = MapView.class.getDeclaredMethod("onResume");
onResume.setAccessible(true);
onResume.invoke(mapView);
} catch (Exception e) {
e.printStackTrace();
}*/
}
public void onPause() {
/*try {
Method onPause = MapView.class.getDeclaredMethod("onPause");
onPause.setAccessible(true);
onPause.invoke(mapView);
} catch (Exception e) {
e.printStackTrace();
}*/
}
public MapPosition getMapPosition() {
return mapView.map().getMapPosition();
}
public View getView() {
return mapView;
}
public boolean hasBuilding() {
return mapView.map().layers().contains(buildings);
}
public void setBuildings(boolean buildingsEnabled) {
if (!hasBuilding() && buildingsEnabled) {
mapView.map().layers().add(buildings);
} else if (hasBuilding() && !buildingsEnabled) {
mapView.map().layers().remove(buildings);
}
redraw();
}
public void redraw() {
mapView.map().render();
}
public void applyCameraUpdate(CameraUpdate cameraUpdate) {
cameraUpdate.apply(mapView.map());
}
public void applyCameraUpdateAnimated(CameraUpdate cameraUpdate, int durationMs) {
cameraUpdate.applyAnimated(mapView.map(), durationMs);
}
public void stopAnimation() {
mapView.map().animator().cancel();
}
public <T extends Markup> T add(T markup) {
items.addItem(markup.getMarkerItem(context));
redraw();
return markup;
}
public void clear() {
items.removeAllItems();
redraw();
}
public void remove(Markup markup) {
items.removeItem(items.getByUid(markup.getId()));
redraw();
}
public void update(Markup markup) {
// TODO: keep order
items.removeItem(items.getByUid(markup.getId()));
items.addItem(markup.getMarkerItem(context));
redraw();
}
}

View file

@ -0,0 +1,532 @@
package org.microg.gms.maps;
import android.annotation.TargetApi;
import android.content.*;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.AssetManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.DatabaseErrorHandler;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.UserHandle;
import android.view.Display;
import android.view.ViewDebug;
import java.io.*;
/**
* A hacked Context that allows access to gms resources but feels like the remote context for everything else.
*/
public class ContextContainer extends Context {
private Context original;
public ContextContainer(Context original) {
this.original = original;
}
@Override
public AssetManager getAssets() {
return ResourcesContainer.get().getAssets();
}
@Override
public Resources getResources() {
return ResourcesContainer.get();
}
@Override
public PackageManager getPackageManager() {
return original.getPackageManager();
}
@Override
public ContentResolver getContentResolver() {
return original.getContentResolver();
}
@Override
public Looper getMainLooper() {
return original.getMainLooper();
}
@Override
public Context getApplicationContext() {
return original.getApplicationContext();
}
@Override
public void setTheme(int i) {
original.setTheme(i);
}
@Override
@ViewDebug.ExportedProperty(
deepExport = true
)
public Resources.Theme getTheme() {
return original.getTheme();
}
@Override
public ClassLoader getClassLoader() {
return original.getClassLoader();
}
@Override
public String getPackageName() {
return original.getPackageName();
}
@Override
public ApplicationInfo getApplicationInfo() {
return original.getApplicationInfo();
}
@Override
public String getPackageResourcePath() {
return original.getPackageResourcePath();
}
@Override
public String getPackageCodePath() {
return original.getPackageCodePath();
}
@Override
public SharedPreferences getSharedPreferences(String s, int i) {
return original.getSharedPreferences(s, i);
}
@Override
public FileInputStream openFileInput(String s) throws FileNotFoundException {
return original.openFileInput(s);
}
@Override
public FileOutputStream openFileOutput(String s, int i) throws FileNotFoundException {
return original.openFileOutput(s, i);
}
@Override
public boolean deleteFile(String s) {
return original.deleteFile(s);
}
@Override
public File getFileStreamPath(String s) {
return original.getFileStreamPath(s);
}
@Override
public File getFilesDir() {
return original.getFilesDir();
}
@Override
@TargetApi(21)
public File getNoBackupFilesDir() {
return original.getNoBackupFilesDir();
}
@Override
public File getExternalFilesDir(String s) {
return original.getExternalFilesDir(s);
}
@Override
@TargetApi(19)
public File[] getExternalFilesDirs(String s) {
return original.getExternalFilesDirs(s);
}
@Override
public File getObbDir() {
return original.getObbDir();
}
@Override
@TargetApi(19)
public File[] getObbDirs() {
return original.getObbDirs();
}
@Override
public File getCacheDir() {
return original.getCacheDir();
}
@Override
@TargetApi(21)
public File getCodeCacheDir() {
return original.getCodeCacheDir();
}
@Override
public File getExternalCacheDir() {
return original.getExternalCacheDir();
}
@Override
@TargetApi(19)
public File[] getExternalCacheDirs() {
return original.getExternalCacheDirs();
}
@Override
@TargetApi(21)
public File[] getExternalMediaDirs() {
return original.getExternalMediaDirs();
}
@Override
public String[] fileList() {
return original.fileList();
}
@Override
public File getDir(String s, int i) {
return original.getDir(s, i);
}
@Override
public SQLiteDatabase openOrCreateDatabase(String s, int i,
SQLiteDatabase.CursorFactory cursorFactory) {
return original.openOrCreateDatabase(s, i, cursorFactory);
}
@Override
public SQLiteDatabase openOrCreateDatabase(String s, int i,
SQLiteDatabase.CursorFactory cursorFactory,
DatabaseErrorHandler databaseErrorHandler) {
return original.openOrCreateDatabase(s, i, cursorFactory, databaseErrorHandler);
}
@Override
public boolean deleteDatabase(String s) {
return original.deleteDatabase(s);
}
@Override
public File getDatabasePath(String s) {
return original.getDatabasePath(s);
}
@Override
public String[] databaseList() {
return original.databaseList();
}
@Override
@Deprecated
public Drawable getWallpaper() {
return original.getWallpaper();
}
@Override
@Deprecated
public Drawable peekWallpaper() {
return original.peekWallpaper();
}
@Override
@Deprecated
public int getWallpaperDesiredMinimumWidth() {
return original.getWallpaperDesiredMinimumWidth();
}
@Override
@Deprecated
public int getWallpaperDesiredMinimumHeight() {
return original.getWallpaperDesiredMinimumHeight();
}
@Override
@Deprecated
public void setWallpaper(Bitmap bitmap) throws IOException {
original.setWallpaper(bitmap);
}
@Override
@Deprecated
public void setWallpaper(InputStream inputStream) throws IOException {
original.setWallpaper(inputStream);
}
@Override
@Deprecated
public void clearWallpaper() throws IOException {
original.clearWallpaper();
}
@Override
public void startActivity(Intent intent) {
original.startActivity(intent);
}
@Override
public void startActivity(Intent intent, Bundle bundle) {
original.startActivity(intent, bundle);
}
@Override
public void startActivities(Intent[] intents) {
original.startActivities(intents);
}
@Override
public void startActivities(Intent[] intents, Bundle bundle) {
original.startActivities(intents, bundle);
}
@Override
public void startIntentSender(IntentSender intentSender, Intent intent, int i, int i1, int i2)
throws IntentSender.SendIntentException {
original.startIntentSender(intentSender, intent, i, i1, i2);
}
@Override
public void startIntentSender(IntentSender intentSender, Intent intent, int i, int i1, int i2,
Bundle bundle) throws IntentSender.SendIntentException {
original.startIntentSender(intentSender, intent, i, i1, i2, bundle);
}
@Override
public void sendBroadcast(Intent intent) {
original.sendBroadcast(intent);
}
@Override
public void sendBroadcast(Intent intent, String s) {
original.sendBroadcast(intent, s);
}
@Override
public void sendOrderedBroadcast(Intent intent, String s) {
original.sendOrderedBroadcast(intent, s);
}
@Override
public void sendOrderedBroadcast(Intent intent, String s,
BroadcastReceiver broadcastReceiver, Handler handler, int i, String s1,
Bundle bundle) {
original.sendOrderedBroadcast(intent, s, broadcastReceiver, handler, i, s1, bundle);
}
@Override
@TargetApi(17)
public void sendBroadcastAsUser(Intent intent, UserHandle userHandle) {
original.sendBroadcastAsUser(intent, userHandle);
}
@Override
@TargetApi(17)
public void sendBroadcastAsUser(Intent intent, UserHandle userHandle, String s) {
original.sendBroadcastAsUser(intent, userHandle, s);
}
@Override
@TargetApi(17)
public void sendOrderedBroadcastAsUser(Intent intent, UserHandle userHandle, String s,
BroadcastReceiver broadcastReceiver, Handler handler, int i, String s1,
Bundle bundle) {
original.sendOrderedBroadcastAsUser(intent, userHandle, s, broadcastReceiver, handler, i,
s1,
bundle);
}
@Override
@Deprecated
public void sendStickyBroadcast(Intent intent) {
original.sendStickyBroadcast(intent);
}
@Override
@Deprecated
public void sendStickyOrderedBroadcast(Intent intent,
BroadcastReceiver broadcastReceiver, Handler handler, int i, String s,
Bundle bundle) {
original.sendStickyOrderedBroadcast(intent, broadcastReceiver, handler, i, s, bundle);
}
@Override
@Deprecated
public void removeStickyBroadcast(Intent intent) {
original.removeStickyBroadcast(intent);
}
@Override
@Deprecated
@TargetApi(17)
public void sendStickyBroadcastAsUser(Intent intent, UserHandle userHandle) {
original.sendStickyBroadcastAsUser(intent, userHandle);
}
@Override
@Deprecated
@TargetApi(17)
public void sendStickyOrderedBroadcastAsUser(Intent intent, UserHandle userHandle,
BroadcastReceiver broadcastReceiver, Handler handler, int i, String s,
Bundle bundle) {
original.sendStickyOrderedBroadcastAsUser(intent, userHandle, broadcastReceiver, handler, i,
s,
bundle);
}
@Override
@Deprecated
@TargetApi(17)
public void removeStickyBroadcastAsUser(Intent intent, UserHandle userHandle) {
original.removeStickyBroadcastAsUser(intent, userHandle);
}
@Override
public Intent registerReceiver(BroadcastReceiver broadcastReceiver,
IntentFilter intentFilter) {
return original.registerReceiver(broadcastReceiver, intentFilter);
}
@Override
public Intent registerReceiver(BroadcastReceiver broadcastReceiver,
IntentFilter intentFilter, String s, Handler handler) {
return original.registerReceiver(broadcastReceiver, intentFilter, s, handler);
}
@Override
public void unregisterReceiver(BroadcastReceiver broadcastReceiver) {
original.unregisterReceiver(broadcastReceiver);
}
@Override
public ComponentName startService(Intent intent) {
return original.startService(intent);
}
@Override
public boolean stopService(Intent intent) {
return original.stopService(intent);
}
@Override
public boolean bindService(Intent intent, ServiceConnection serviceConnection, int i) {
return original.bindService(intent, serviceConnection, i);
}
@Override
public void unbindService(ServiceConnection serviceConnection) {
original.unbindService(serviceConnection);
}
@Override
public boolean startInstrumentation(ComponentName componentName, String s, Bundle bundle) {
return original.startInstrumentation(componentName, s, bundle);
}
@Override
public Object getSystemService(String s) {
return original.getSystemService(s);
}
@Override
public int checkPermission(String s, int i, int i1) {
return original.checkPermission(s, i, i1);
}
@Override
public int checkCallingPermission(String s) {
return original.checkCallingPermission(s);
}
@Override
public int checkCallingOrSelfPermission(String s) {
return original.checkCallingOrSelfPermission(s);
}
@Override
public void enforcePermission(String s, int i, int i1, String s1) {
original.enforcePermission(s, i, i1, s1);
}
@Override
public void enforceCallingPermission(String s, String s1) {
original.enforceCallingPermission(s, s1);
}
@Override
public void enforceCallingOrSelfPermission(String s, String s1) {
original.enforceCallingOrSelfPermission(s, s1);
}
@Override
public void grantUriPermission(String s, Uri uri, int i) {
original.grantUriPermission(s, uri, i);
}
@Override
public void revokeUriPermission(Uri uri, int i) {
original.revokeUriPermission(uri, i);
}
@Override
public int checkUriPermission(Uri uri, int i, int i1, int i2) {
return original.checkUriPermission(uri, i, i1, i2);
}
@Override
public int checkCallingUriPermission(Uri uri, int i) {
return original.checkCallingUriPermission(uri, i);
}
@Override
public int checkCallingOrSelfUriPermission(Uri uri, int i) {
return original.checkCallingOrSelfUriPermission(uri, i);
}
@Override
public int checkUriPermission(Uri uri, String s, String s1, int i, int i1, int i2) {
return original.checkUriPermission(uri, s, s1, i, i1, i2);
}
@Override
public void enforceUriPermission(Uri uri, int i, int i1, int i2, String s) {
original.enforceUriPermission(uri, i, i1, i2, s);
}
@Override
public void enforceCallingUriPermission(Uri uri, int i, String s) {
original.enforceCallingUriPermission(uri, i, s);
}
@Override
public void enforceCallingOrSelfUriPermission(Uri uri, int i, String s) {
original.enforceCallingOrSelfUriPermission(uri, i, s);
}
@Override
public void enforceUriPermission(Uri uri, String s, String s1, int i, int i1, int i2,
String s2) {
original.enforceUriPermission(uri, s, s1, i, i1, i2, s2);
}
@Override
public Context createPackageContext(String s, int i)
throws PackageManager.NameNotFoundException {
return original.createPackageContext(s, i);
}
@Override
public Context createConfigurationContext(Configuration configuration) {
return original.createConfigurationContext(configuration);
}
@Override
public Context createDisplayContext(Display display) {
return original.createDisplayContext(display);
}
}

View file

@ -0,0 +1,66 @@
package org.microg.gms.maps;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import org.oscim.core.BoundingBox;
import org.oscim.core.GeoPoint;
import org.oscim.core.MapPosition;
public class GmsMapsTypeHelper {
public static android.graphics.Point toPoint(org.oscim.core.Point in) {
return new android.graphics.Point((int) in.getX(), (int) in.getY());
}
public static GeoPoint fromLatLng(LatLng latLng) {
return new GeoPoint(latLng.latitude, latLng.longitude);
}
public static LatLng toLatLng(GeoPoint geoPoint) {
return new LatLng(geoPoint.getLatitude(), geoPoint.getLongitude());
}
public static LatLngBounds toLatLngBounds(BoundingBox box) {
return new LatLngBounds(new LatLng(box.getMinLatitude(), box.getMinLongitude()),
new LatLng(box.getMaxLatitude(), box.getMaxLongitude()));
}
public static org.oscim.core.Point fromPoint(android.graphics.Point point) {
return new org.oscim.core.Point(point.x, point.y);
}
public static CameraPosition toCameraPosition(MapPosition mapPosition) {
return new CameraPosition(new LatLng(mapPosition.getLatitude(), mapPosition.getLongitude()),
toZoom(mapPosition.getScale()), mapPosition.getTilt(),
toBearing(mapPosition.getBearing()));
}
public static MapPosition fromCameraPosition(CameraPosition cameraPosition) {
MapPosition mapPosition = new MapPosition(cameraPosition.target.latitude,
cameraPosition.target.longitude, fromZoom(cameraPosition.zoom));
mapPosition.setTilt(cameraPosition.tilt);
mapPosition.setBearing(fromBearing(cameraPosition.bearing));
return mapPosition;
}
public static BoundingBox fromLatLngBounds(LatLngBounds bounds) {
return new BoundingBox(bounds.southWest.latitude, bounds.southWest.longitude,
bounds.northEast.latitude, bounds.northEast.longitude);
}
public static float fromBearing(float bearing) {
return -bearing;
}
public static float toBearing(float bearing) {
return -bearing;
}
public static double fromZoom(float zoom) {
return Math.pow(2, zoom);
}
public static float toZoom(double scale) {
return (float) (Math.log(scale) / Math.log(2));
}
}

View file

@ -1,601 +1,334 @@
/*
* Copyright (c) 2014 μg Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.microg.gms.maps;
import android.app.Activity;
import android.content.Context;
import android.graphics.Point;
import android.location.Location;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.RemoteException;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.android.gms.dynamic.ObjectWrapper;
import com.google.android.gms.maps.GoogleMapOptions;
import com.google.android.gms.maps.internal.*;
import com.google.android.gms.maps.model.*;
import com.google.android.gms.maps.model.internal.*;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import org.microg.gms.maps.camera.CameraUpdate;
import org.microg.gms.maps.camera.CameraUpdateFactoryImpl;
import org.microg.gms.maps.markup.*;
import org.oscim.event.Event;
import org.oscim.event.MotionEvent;
import org.oscim.map.Map;
public class GoogleMapImpl {
private static final String TAG = GoogleMapImpl.class.getName();
public class GoogleMapImpl extends IGoogleMapDelegate.Stub
implements UiSettingsImpl.UiSettingsListener, Map.InputListener, Markup.MarkupListener {
private static final String TAG = "GoogleMapImpl";
public static final int MAP_TYPE_NONE = 0;
public static final int MAP_TYPE_NORMAL = 1;
public static final int MAP_TYPE_SATELLITE = 2;
public static final int MAP_TYPE_TERRAIN = 3;
public static final int MAP_TYPE_HYBRID = 4;
private final GoogleMapOptions options;
private final Context context;
private final BackendMap backendMap;
private final UiSettingsImpl uiSettings;
private final ProjectionImpl projection;
private final ViewGroup view;
private final GoogleMapOptions options;
private final Delegate delegate = new Delegate();
private final UiSettings uiSettings = new UiSettings();
private final Projection projection = new Projection();
private MapView mapView;
private Context context;
private InfoWindow infoWindow;
private int markerCounter = 0;
private IOnCameraChangeListener cameraChangeListener;
private IOnMapClickListener mapClickListener;
private IOnMapLoadedCallback mapLoadedCallback;
private IOnMapLongClickListener mapLongClickListener;
private IOnMarkerClickListener markerClickListener;
private IOnMarkerDragListener markerDragListener;
private IOnInfoWindowClickListener infoWindowClickListener;
private int mapType = 1;
private IInfoWindowAdapter infoWindowAdapter;
public GoogleMapImpl(LayoutInflater inflater, GoogleMapOptions options) {
context = inflater.getContext();
this.view = new RelativeLayout(context);
try {
mapView = (MapView) Class.forName("com.google.android.maps.MapView").getConstructor(Context.class, String.class).newInstance(context, null);
prepareMapView();
view.addView(mapView);
} catch (Exception e) {
Log.d(TAG, "Sorry, can't create legacy MapView");
}
backendMap = new BackendMap(context);
backendMap.setInputListener(this);
uiSettings = new UiSettingsImpl(this);
projection = new ProjectionImpl(backendMap.getViewport());
this.options = options;
}
private void prepareMapView() {
mapView.getOverlays().add(new com.google.android.maps.Overlay() {
@Override
public boolean onTap(com.google.android.maps.GeoPoint p, MapView mapView)
{
Log.d(TAG, "onClick");
IOnMapClickListener listener = mapClickListener;
if (listener != null) {
try {
listener.onMapClick(new LatLng(p));
} catch (RemoteException e) {
Log.w(TAG, e);
}
return true;
}
return false;
}
});
// TODO: this is actually never called
mapView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
Log.d(TAG, "onLongClick");
IOnMapLongClickListener listener = mapLongClickListener;
if (listener != null) {
try {
// TODO: Handle LatLng right
listener.onMapLongClick(new LatLng(0, 0));
} catch (RemoteException e) {
Log.w(TAG, e);
}
return true;
}
return false;
}
});
public void onDestroy() {
backendMap.destroy();
}
public void onCreate(Bundle savedInstanceState) {
if (options != null) {
try {
delegate.animateCamera(new CameraUpdateFactoryImpl().newCameraPosition(options.getCamera()));
delegate.setMapType(options.getMapType());
uiSettings.setCompassEnabled(options.isCompassEnabled());
uiSettings.setZoomControlsEnabled(options.isZoomControlsEnabled());
uiSettings.setRotateGesturesEnabled(options.isRotateGesturesEnabled());
uiSettings.setScrollGesturesEnabled(options.isScrollGesturesEnabled());
uiSettings.setTiltGesturesEnabled(options.isTiltGesturesEnabled());
uiSettings.setZoomGesturesEnabled(options.isZoomGesturesEnabled());
} catch (RemoteException ignored) {
// It's not remote...
}
public void onResume() {
backendMap.onResume();
}
public void onPause() {
backendMap.onPause();
}
public View getView() {
return backendMap.getView();
}
private String getNextMarkerId() {
return "m" + markerCounter++;
}
/*
Camera
*/
@Override
public CameraPosition getCameraPosition() throws RemoteException {
return GmsMapsTypeHelper.toCameraPosition(backendMap.getMapPosition());
}
@Override
public float getMaxZoomLevel() throws RemoteException {
return 0;
}
@Override
public float getMinZoomLevel() throws RemoteException {
return 0;
}
@Override
public void moveCamera(IObjectWrapper cameraUpdate) throws RemoteException {
CameraUpdate camUpdate = (CameraUpdate) ObjectWrapper.unwrap(cameraUpdate);
backendMap.applyCameraUpdate(camUpdate);
}
@Override
public void animateCamera(IObjectWrapper cameraUpdate) throws RemoteException {
CameraUpdate camUpdate = (CameraUpdate) ObjectWrapper.unwrap(cameraUpdate);
backendMap.applyCameraUpdateAnimated(camUpdate, 1000);
}
@Override
public void animateCameraWithCallback(IObjectWrapper cameraUpdate, ICancelableCallback callback)
throws RemoteException {
CameraUpdate camUpdate = (CameraUpdate) ObjectWrapper.unwrap(cameraUpdate);
backendMap.applyCameraUpdateAnimated(camUpdate, 1000);
}
@Override
public void animateCameraWithDurationAndCallback(IObjectWrapper cameraUpdate, int duration,
ICancelableCallback callback) throws RemoteException {
CameraUpdate camUpdate = (CameraUpdate) ObjectWrapper.unwrap(cameraUpdate);
backendMap.applyCameraUpdateAnimated(camUpdate, duration);
}
@Override
public IProjectionDelegate getProjection() throws RemoteException {
return projection;
}
@Override
public void stopAnimation() throws RemoteException {
backendMap.stopAnimation();
}
/*
Markers, polylines, polygons, overlays, etc
*/
@Override
public ICircleDelegate addCircle(CircleOptions options) throws RemoteException {
return new CircleImpl(options); // TODO
}
@Override
public IPolylineDelegate addPolyline(PolylineOptions options) throws RemoteException {
return new PolylineImpl(options); // TODO
}
@Override
public IPolygonDelegate addPolygon(PolygonOptions options) throws RemoteException {
return new PolygonImpl(options); // TODO
}
@Override
public IMarkerDelegate addMarker(MarkerOptions options) throws RemoteException {
return backendMap.add(new MarkerImpl(getNextMarkerId(), options, this));
}
@Override
public IGroundOverlayDelegate addGroundOverlay(GroundOverlayOptions options)
throws RemoteException {
return new GroundOverlayImpl(options); // TODO
}
@Override
public ITileOverlayDelegate addTileOverlay(TileOverlayOptions options) throws RemoteException {
return new TileOverlayImpl(); // TODO
}
@Override
public void setInfoWindowAdapter(IInfoWindowAdapter adapter) throws RemoteException {
}
@Override
public void clear() throws RemoteException {
backendMap.clear();
}
@Override
public void update(Markup markup) {
backendMap.update(markup);
}
@Override
public void remove(Markup markup) {
backendMap.remove(markup);
}
/*
Map options
*/
@Override
public int getMapType() throws RemoteException {
return 0;
}
@Override
public void setMapType(int type) throws RemoteException {
}
@Override
public boolean isTrafficEnabled() throws RemoteException {
return false;
}
@Override
public void setTrafficEnabled(boolean traffic) throws RemoteException {
Log.w(TAG, "Traffic not yet supported");
}
@Override
public boolean isIndoorEnabled() throws RemoteException {
return false;
}
@Override
public void setIndoorEnabled(boolean indoor) throws RemoteException {
Log.w(TAG, "Indoor not yet supported");
}
@Override
public boolean isMyLocationEnabled() throws RemoteException {
return false;
}
@Override
public void setMyLocationEnabled(boolean myLocation) throws RemoteException {
Log.w(TAG, "MyLocation not yet supported");
}
@Override
public boolean isBuildingsEnabled() throws RemoteException {
return backendMap.hasBuilding();
}
@Override
public void setBuildingsEnabled(boolean buildingsEnabled) throws RemoteException {
backendMap.setBuildings(buildingsEnabled);
}
/*
Ui Settings
*/
@Override
public IUiSettingsDelegate getUiSettings() throws RemoteException {
return uiSettings;
}
@Override
public void onUiSettingsChanged(UiSettingsImpl settings) throws RemoteException {
if (settings.isCompassEnabled()) {
Log.w(TAG, "Compass not yet supported");
}
if (savedInstanceState != null) {
savedInstanceState.setClassLoader(GoogleMapImpl.class.getClassLoader());
mapView.onRestoreInstanceState(savedInstanceState);
if (settings.isMyLocationButtonEnabled()) {
Log.w(TAG, "MyLocationButton not yet supported");
}
if (settings.isZoomControlsEnabled()) {
Log.w(TAG, "ZoomControls not yet supported");
}
}
public IOnMarkerClickListener getMarkerClickListener() {
return markerClickListener;
/*
Listener and callback setters
*/
@Override
public void setOnCameraChangeListener(IOnCameraChangeListener listener) throws RemoteException {
}
public IOnInfoWindowClickListener getInfoWindowClickListener() {
return infoWindowClickListener;
@Override
public void setOnMapClickListener(IOnMapClickListener listener) throws RemoteException {
}
public Context getContext() {
return context;
@Override
public void setOnMapLongClickListener(IOnMapLongClickListener listener) throws RemoteException {
}
public MapView getMapView() {
return mapView;
}
@Override
public void setOnMarkerClickListener(IOnMarkerClickListener listener) throws RemoteException {
public MapController getController() {
return mapView != null ? mapView.getController() : null;
}
public View getView() {
return view;
}
public IGoogleMapDelegate getDelegate() {
return delegate;
}
public void remove(MarkerImpl marker) {
mapView.getOverlays().remove(marker.getOverlay());
try {
if (infoWindow != null && infoWindow.getMarker().getId().equals(marker.getId())) {
hideInfoWindow();
}
} catch (RemoteException e) {
// It's not remote...
}
}
public void redraw() {
mapView.postInvalidate();
try {
Class.forName("com.google.android.maps.MapView.WrappedMapView")
.getDeclaredMethod("postInvalidate")
.invoke(MapView.class.getDeclaredMethod("getWrapped").invoke(mapView));
} catch (Exception e) {
Log.w(TAG, "MapView does not support extended microg features", e);
}
@Override
public void setOnMarkerDragListener(IOnMarkerDragListener listener) throws RemoteException {
}
public void onSaveInstanceState(Bundle outState) {
mapView.onSaveInstanceState(outState);
@Override
public void setOnInfoWindowClickListener(IOnInfoWindowClickListener listener)
throws RemoteException {
}
public void hideInfoWindow() {
if (infoWindow != null) {
mapView.getOverlays().remove(infoWindow);
infoWindow.destroy();
}
infoWindow = null;
@Override
public void setOnMyLocationChangeListener(IOnMyLocationChangeListener listener)
throws RemoteException {
}
public void showInfoWindow(final MarkerImpl marker) {
hideInfoWindow();
InfoWindow window = new InfoWindow(context, this, marker);
if (infoWindowAdapter != null) {
try {
IObjectWrapper infoWindow = infoWindowAdapter.getInfoWindow(marker);
window.setWindow((View) ObjectWrapper.unwrap(infoWindow));
} catch (RemoteException e) {
Log.w(TAG, e);
}
}
if (!window.isComplete()) {
if (infoWindowAdapter != null) {
try {
IObjectWrapper contents = infoWindowAdapter.getInfoContents(marker);
window.setContent((View) ObjectWrapper.unwrap(contents));
} catch (RemoteException e) {
Log.w(TAG, e);
}
}
}
if (!window.isComplete()) {
window.buildDefault();
}
if (window.isComplete()) {
infoWindow = window;
Log.d(TAG, "Showing info window " + infoWindow + " for marker " + marker);
mapView.getOverlays().add(infoWindow);
}
@Override
public void setOnMyLocationButtonClickListener(IOnMyLocationButtonClickListener listener)
throws RemoteException {
}
private void runLater(Runnable runnable) {
new Handler(Looper.getMainLooper()).post(runnable);
@Override
public void setOnMapLoadedCallback(IOnMapLoadedCallback callback) throws RemoteException {
}
private class Delegate extends IGoogleMapDelegate.Stub {
@Override
public CameraPosition getCameraPosition() throws RemoteException {
if (mapView == null) return null;
return new CameraPosition(new LatLng(mapView.getMapCenter()), mapView.getZoomLevel(), 0, 0);
}
/*
Misc
*/
@Override
public float getMaxZoomLevel() throws RemoteException {
return mapView.getMaxZoomLevel();
}
@Override
public float getMinZoomLevel() throws RemoteException {
return 1;
}
@Override
public void moveCamera(final IObjectWrapper cameraUpdate) throws RemoteException {
runLater(new Runnable() {
@Override
public void run() {
((CameraUpdate) ObjectWrapper.unwrap(cameraUpdate)).update(GoogleMapImpl.this);
}
});
}
@Override
public void animateCamera(final IObjectWrapper cameraUpdate) throws RemoteException {
runLater(new Runnable() {
@Override
public void run() {
((CameraUpdate) ObjectWrapper.unwrap(cameraUpdate)).update(GoogleMapImpl.this);
}
});
}
@Override
public void animateCameraWithCallback(final IObjectWrapper cameraUpdate, final ICancelableCallback callback) throws RemoteException {
runLater(new Runnable() {
@Override
public void run() {
((CameraUpdate) ObjectWrapper.unwrap(cameraUpdate)).update(GoogleMapImpl.this);
if (callback != null) try {
callback.onFinish();
} catch (RemoteException e) {
Log.w(TAG, e);
}
}
});
}
@Override
public void animateCameraWithDurationAndCallback(final IObjectWrapper cameraUpdate, int duration, final ICancelableCallback callback) throws RemoteException {
runLater(new Runnable() {
@Override
public void run() {
((CameraUpdate) ObjectWrapper.unwrap(cameraUpdate)).update(GoogleMapImpl.this);
if (callback != null) try {
callback.onFinish();
} catch (RemoteException e) {
Log.w(TAG, e);
}
}
});
}
@Override
public void stopAnimation() throws RemoteException {
mapView.getController().stopAnimation(false);
}
@Override
public IPolylineDelegate addPolyline(PolylineOptions options) throws RemoteException {
return new PolylineImpl(options);
}
@Override
public IPolygonDelegate addPolygon(PolygonOptions options) throws RemoteException {
return new PolygonImpl(options);
}
@Override
public IMarkerDelegate addMarker(MarkerOptions options) throws RemoteException {
MarkerImpl marker = new MarkerImpl("m" + markerCounter++, options, GoogleMapImpl.this);
if (infoWindow != null) mapView.getOverlays().remove(infoWindow);
mapView.getOverlays().add(marker.getOverlay());
if (infoWindow != null) mapView.getOverlays().add(infoWindow);
redraw();
return marker;
}
@Override
public IGroundOverlayDelegate addGroundOverlay(GroundOverlayOptions options) throws RemoteException {
return new GroundOverlayImpl(options);
}
@Override
public ITileOverlayDelegate addTileOverlay(TileOverlayOptions options) throws RemoteException {
return null;
}
@Override
public void clear() throws RemoteException {
mapView.getOverlays().clear();
hideInfoWindow();
redraw();
}
@Override
public int getMapType() throws RemoteException {
return mapType;
}
@Override
public void setMapType(int type) throws RemoteException {
mapType = type;
if (mapType == MAP_TYPE_SATELLITE) {
mapView.setSatellite(true);
} else {
mapView.setSatellite(false);
}
}
@Override
public boolean isTrafficEnabled() throws RemoteException {
return false;
}
@Override
public void setTrafficEnabled(boolean traffic) throws RemoteException {
}
@Override
public boolean isIndoorEnabled() throws RemoteException {
return false;
}
@Override
public void setIndoorEnabled(boolean indoor) throws RemoteException {
}
@Override
public boolean isMyLocationEnabled() throws RemoteException {
return false;
}
@Override
public void setMyLocationEnabled(boolean myLocation) throws RemoteException {
}
@Override
public Location getMyLocation() throws RemoteException {
return null;
}
@Override
public void setLocationSource(ILocationSourceDelegate locationSource) throws RemoteException {
}
@Override
public IUiSettingsDelegate getUiSettings() throws RemoteException {
return uiSettings;
}
@Override
public IProjectionDelegate getProjection() throws RemoteException {
return projection;
}
@Override
public void setOnCameraChangeListener(IOnCameraChangeListener listener) throws RemoteException {
cameraChangeListener = listener;
}
@Override
public void setOnMapClickListener(final IOnMapClickListener listener) throws RemoteException {
mapClickListener = listener;
}
@Override
public void setOnMapLongClickListener(final IOnMapLongClickListener listener) throws RemoteException {
mapLongClickListener = listener;
}
@Override
public void setOnMarkerClickListener(IOnMarkerClickListener listener) throws RemoteException {
markerClickListener = listener;
}
@Override
public void setOnMarkerDragListener(IOnMarkerDragListener listener) throws RemoteException {
markerDragListener = listener;
}
@Override
public void setOnInfoWindowClickListener(IOnInfoWindowClickListener listener) throws RemoteException {
infoWindowClickListener = listener;
}
@Override
public void setInfoWindowAdapter(IInfoWindowAdapter adapter) throws RemoteException {
infoWindowAdapter = adapter;
}
@Override
public IObjectWrapper getTestingHelper() throws RemoteException {
return null;
}
@Override
public ICircleDelegate addCircle(CircleOptions options) throws RemoteException {
return new CircleImpl(options);
}
@Override
public void setOnMyLocationChangeListener(IOnMyLocationChangeListener listener) throws RemoteException {
}
@Override
public void setOnMyLocationButtonClickListener(IOnMyLocationButtonClickListener listener) throws RemoteException {
}
@Override
public void snapshot(ISnapshotReadyCallback callback, IObjectWrapper bitmap) throws RemoteException {
}
@Override
public void setPadding(int left, int top, int right, int bottom) throws RemoteException {
}
@Override
public boolean isBuildingsEnabled() throws RemoteException {
return false;
}
@Override
public void setBuildingsEnabled(boolean buildings) throws RemoteException {
}
@Override
public void setOnMapLoadedCallback(IOnMapLoadedCallback callback) throws RemoteException {
mapLoadedCallback = callback;
}
@Override
public IObjectWrapper getTestingHelper() throws RemoteException {
return null;
}
private class UiSettings extends IUiSettingsDelegate.Stub {
@Override
public void snapshot(ISnapshotReadyCallback callback, IObjectWrapper bitmap)
throws RemoteException {
@Override
public void setZoomControlsEnabled(boolean zoom) throws RemoteException {
mapView.setBuiltInZoomControls(zoom);
}
}
@Override
public void setCompassEnabled(boolean compass) throws RemoteException {
// TODO
}
@Override
public void setPadding(int left, int top, int right, int bottom) throws RemoteException {
getView().setPadding(left, top, right, bottom);
}
@Override
public void setMyLocationButtonEnabled(boolean locationButton) throws RemoteException {
// TODO
}
@Override
public Location getMyLocation() throws RemoteException {
return null;
}
@Override
public void setScrollGesturesEnabled(boolean scrollGestures) throws RemoteException {
// TODO
}
@Override
public void setLocationSource(ILocationSourceDelegate locationSource) throws RemoteException {
@Override
public void setZoomGesturesEnabled(boolean zoomGestures) throws RemoteException {
// TODO
}
}
@Override
public void setTiltGesturesEnabled(boolean tiltGestures) throws RemoteException {
// TODO
}
@Override
public void setRotateGesturesEnabled(boolean rotateGestures) throws RemoteException {
// TODO
}
@Override
public void setAllGesturesEnabled(boolean gestures) throws RemoteException {
// TODO
}
@Override
public boolean isZoomControlsEnabled() throws RemoteException {
return false;
}
@Override
public boolean isCompassEnabled() throws RemoteException {
return false;
}
@Override
public boolean isMyLocationButtonEnabled() throws RemoteException {
return false;
}
@Override
public boolean isScrollGesturesEnabled() throws RemoteException {
return false;
}
@Override
public boolean isZoomGesturesEnabled() throws RemoteException {
return false;
}
@Override
public boolean isTiltGesturesEnabled() throws RemoteException {
return false;
}
@Override
public boolean isRotateGesturesEnabled() throws RemoteException {
return false;
}
}
public class Projection extends IProjectionDelegate.Stub {
@Override
public IObjectWrapper toScreenLocation(LatLng latLng) throws RemoteException {
return ObjectWrapper.wrap(mapView.getProjection().toPixels(latLng.toGeoPoint(), null));
}
@Override
public LatLng fromScreenLocation(IObjectWrapper obj) throws RemoteException {
Point point = (Point) ObjectWrapper.unwrap(obj);
return new LatLng(mapView.getProjection().fromPixels(point.x, point.y));
}
@Override
public VisibleRegion getVisibleRegion() throws RemoteException {
LatLng nearLeft = new LatLng(mapView.getProjection().fromPixels(0, mapView.getHeight()));
LatLng nearRight = new LatLng(mapView.getProjection().fromPixels(mapView.getWidth(), mapView.getHeight()));
LatLng farLeft = new LatLng(mapView.getProjection().fromPixels(0, 0));
LatLng farRight = new LatLng(mapView.getProjection().fromPixels(mapView.getWidth(), 0));
return new VisibleRegion(nearLeft, nearRight, farLeft, farRight, new LatLngBounds(farRight, nearLeft));
}
@Override
public void onInputEvent(Event event, MotionEvent motionEvent) {
Log.d(TAG, "onInputEvent(" + event + ", " + motionEvent + ")");
}
}

View file

@ -20,6 +20,7 @@ import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.RemoteException;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -31,84 +32,89 @@ import com.google.android.gms.maps.internal.IMapFragmentDelegate;
public class MapFragmentImpl extends IMapFragmentDelegate.Stub {
private GoogleMapImpl map;
private GoogleMapOptions options;
private Context context;
private GoogleMapImpl map;
private GoogleMapOptions options;
private Context context;
public MapFragmentImpl(Activity activity) {
context = activity;
}
public MapFragmentImpl(Activity activity) {
context = activity;
}
private GoogleMapImpl myMap() {
if (map == null) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
map = new GoogleMapImpl(inflater, options);
}
return map;
}
private GoogleMapImpl myMap() {
if (map == null) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
map = new GoogleMapImpl(inflater, options);
}
return map;
}
@Override
public IGoogleMapDelegate getMap() throws RemoteException {
return myMap().getDelegate();
}
@Override
public IGoogleMapDelegate getMap() throws RemoteException {
return myMap();
}
@Override
public void onInflate(IObjectWrapper activity, GoogleMapOptions options, Bundle savedInstanceState) throws RemoteException {
@Override
public void onInflate(IObjectWrapper activity, GoogleMapOptions options,
Bundle savedInstanceState) throws RemoteException {
Log.d("MapFragmentImpl", "onInflate");
}
}
@Override
public void onCreate(Bundle savedInstanceState) throws RemoteException {
//myMap().onCreate(savedInstanceState);
Log.d("MapFragmentImpl", "onCreate");
}
@Override
public void onCreate(Bundle savedInstanceState) throws RemoteException {
myMap().onCreate(savedInstanceState);
}
@Override
public IObjectWrapper onCreateView(IObjectWrapper layoutInflater, IObjectWrapper container,
Bundle savedInstanceState) throws RemoteException {
if (map == null) {
LayoutInflater inflater = (LayoutInflater) ObjectWrapper.unwrap(layoutInflater);
map = new GoogleMapImpl(inflater, options);
//map.onCreate(savedInstanceState);
} else {
View view = map.getView();
if (view.getParent() instanceof ViewGroup) {
((ViewGroup) view.getParent()).removeView(view);
}
}
return ObjectWrapper.wrap(myMap().getView());
}
@Override
public IObjectWrapper onCreateView(IObjectWrapper layoutInflater, IObjectWrapper container, Bundle savedInstanceState) throws RemoteException {
if (map == null) {
LayoutInflater inflater = (LayoutInflater) ObjectWrapper.unwrap(layoutInflater);
map = new GoogleMapImpl(inflater, options);
map.onCreate(savedInstanceState);
} else {
View view = map.getView();
if (view.getParent() instanceof ViewGroup) {
((ViewGroup) view.getParent()).removeView(view);
}
}
return ObjectWrapper.wrap(myMap().getView());
}
@Override
public void onResume() throws RemoteException {
myMap().onResume();
}
@Override
public void onResume() throws RemoteException {
@Override
public void onPause() throws RemoteException {
myMap().onPause();
}
}
@Override
public void onDestroyView() throws RemoteException {
@Override
public void onPause() throws RemoteException {
}
}
@Override
public void onDestroy() throws RemoteException {
myMap().onDestroy();
}
@Override
public void onDestroyView() throws RemoteException {
@Override
public void onLowMemory() throws RemoteException {
}
}
@Override
public void onDestroy() throws RemoteException {
@Override
public void onSaveInstanceState(Bundle outState) throws RemoteException {
//myMap().onSaveInstanceState(outState);
}
}
@Override
public void onLowMemory() throws RemoteException {
}
@Override
public void onSaveInstanceState(Bundle outState) throws RemoteException {
myMap().onSaveInstanceState(outState);
}
@Override
public boolean isReady() throws RemoteException {
return false;
}
@Override
public boolean isReady() throws RemoteException {
Log.d("MapFragmentImpl", "isReady");
return false;
}
}

View file

@ -19,6 +19,7 @@ package org.microg.gms.maps;
import android.content.Context;
import android.os.Bundle;
import android.os.RemoteException;
import android.util.Log;
import android.view.LayoutInflater;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.android.gms.dynamic.ObjectWrapper;
@ -28,60 +29,62 @@ import com.google.android.gms.maps.internal.IMapViewDelegate;
public class MapViewImpl extends IMapViewDelegate.Stub {
private GoogleMapImpl map;
private GoogleMapOptions options;
private Context context;
private GoogleMapImpl map;
private GoogleMapOptions options;
private Context context;
public MapViewImpl(Context context, GoogleMapOptions options) {
this.context = context;
this.options = options;
}
public MapViewImpl(Context context, GoogleMapOptions options) {
this.context = context;
this.options = options;
}
private GoogleMapImpl myMap() {
if (map == null) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
map = new GoogleMapImpl(inflater, options);
}
return map;
}
private GoogleMapImpl myMap() {
if (map == null) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
map = new GoogleMapImpl(inflater, options);
}
return map;
}
@Override
public IGoogleMapDelegate getMap() throws RemoteException {
return myMap().getDelegate();
}
@Override
public IGoogleMapDelegate getMap() throws RemoteException {
return myMap();
}
@Override
public void onCreate(Bundle savedInstanceState) throws RemoteException {
myMap().onCreate(savedInstanceState);
}
@Override
public void onCreate(Bundle savedInstanceState) throws RemoteException {
//myMap().onCreate(savedInstanceState);
Log.d("MapViewImpl", "onCreate");
}
@Override
public void onResume() throws RemoteException {
@Override
public void onResume() throws RemoteException {
myMap().onResume();
}
}
@Override
public void onPause() throws RemoteException {
myMap().onPause();
}
@Override
public void onPause() throws RemoteException {
@Override
public void onDestroy() throws RemoteException {
myMap().onDestroy();
}
}
@Override
public void onLowMemory() throws RemoteException {
@Override
public void onDestroy() throws RemoteException {
}
}
@Override
public void onSaveInstanceState(Bundle outState) throws RemoteException {
@Override
public void onLowMemory() throws RemoteException {
}
}
@Override
public void onSaveInstanceState(Bundle outState) throws RemoteException {
}
@Override
public IObjectWrapper getView() throws RemoteException {
return ObjectWrapper.wrap(myMap().getView());
}
@Override
public IObjectWrapper getView() throws RemoteException {
return ObjectWrapper.wrap(myMap().getView());
}
}

View file

@ -0,0 +1,38 @@
package org.microg.gms.maps;
import android.os.RemoteException;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.android.gms.dynamic.ObjectWrapper;
import com.google.android.gms.maps.internal.IProjectionDelegate;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.VisibleRegion;
import org.oscim.core.Point;
import org.oscim.map.Viewport;
public class ProjectionImpl extends IProjectionDelegate.Stub {
private Viewport viewport;
public ProjectionImpl(Viewport viewport) {
this.viewport = viewport;
}
@Override
public LatLng fromScreenLocation(IObjectWrapper obj) throws RemoteException {
Point point = GmsMapsTypeHelper
.fromPoint((android.graphics.Point) ObjectWrapper.unwrap(obj));
return GmsMapsTypeHelper
.toLatLng(viewport.fromScreenPoint((float) point.x, (float) point.y));
}
@Override
public IObjectWrapper toScreenLocation(LatLng latLng) throws RemoteException {
Point point = new Point();
viewport.toScreenPoint(GmsMapsTypeHelper.fromLatLng(latLng), point);
return ObjectWrapper.wrap(GmsMapsTypeHelper.toPoint(point));
}
@Override
public VisibleRegion getVisibleRegion() throws RemoteException {
return new VisibleRegion(GmsMapsTypeHelper.toLatLngBounds(viewport.getBBox()));
}
}

View file

@ -19,15 +19,17 @@ package org.microg.gms.maps;
import android.content.res.Resources;
public class ResourcesContainer {
private static Resources resources;
public static void set(Resources resources) {
ResourcesContainer.resources = resources;
}
public static Resources get() {
if (resources == null) {
throw new IllegalStateException("Resources have not been initialized");
} else {
return resources;
}
}
private static Resources resources;
public static void set(Resources resources) {
ResourcesContainer.resources = resources;
}
public static Resources get() {
if (resources == null) {
throw new IllegalStateException("Resources have not been initialized");
} else {
return resources;
}
}
}

View file

@ -0,0 +1,117 @@
package org.microg.gms.maps;
import android.os.RemoteException;
import com.google.android.gms.maps.internal.IUiSettingsDelegate;
public class UiSettingsImpl extends IUiSettingsDelegate.Stub {
private boolean zoomControlsEnabled;
private boolean compassEnabled;
private boolean myLocationButtonEnabled;
private boolean scrollGesturesEnabled;
private boolean zoomGesturesEnabled;
private boolean tiltGesturesEnabled;
private boolean rotateGesturesEnabled;
private UiSettingsListener listener;
public UiSettingsImpl() {
}
public UiSettingsImpl(UiSettingsListener listener) {
this.listener = listener;
}
public void setListener(UiSettingsListener listener) {
this.listener = listener;
}
@Override
public void setZoomControlsEnabled(boolean zoomControlsEnabled) throws RemoteException {
this.zoomControlsEnabled = zoomControlsEnabled;
listener.onUiSettingsChanged(this);
}
@Override
public void setCompassEnabled(boolean compassEnabled) throws RemoteException {
this.compassEnabled = compassEnabled;
listener.onUiSettingsChanged(this);
}
@Override
public void setMyLocationButtonEnabled(boolean myLocationButtonEnabled) throws RemoteException {
this.myLocationButtonEnabled = myLocationButtonEnabled;
listener.onUiSettingsChanged(this);
}
@Override
public void setScrollGesturesEnabled(boolean scrollGesturesEnabled) throws RemoteException {
this.scrollGesturesEnabled = scrollGesturesEnabled;
listener.onUiSettingsChanged(this);
}
@Override
public void setZoomGesturesEnabled(boolean zoomGestures) throws RemoteException {
this.zoomGesturesEnabled = zoomGestures;
listener.onUiSettingsChanged(this);
}
@Override
public void setTiltGesturesEnabled(boolean tiltGesturesEnabled) throws RemoteException {
this.tiltGesturesEnabled = tiltGesturesEnabled;
listener.onUiSettingsChanged(this);
}
@Override
public void setRotateGesturesEnabled(boolean rotateGesturesEnabled) throws RemoteException {
this.rotateGesturesEnabled = rotateGesturesEnabled;
listener.onUiSettingsChanged(this);
}
@Override
public void setAllGesturesEnabled(boolean gestures) throws RemoteException {
scrollGesturesEnabled = gestures;
zoomGesturesEnabled = gestures;
tiltGesturesEnabled = gestures;
rotateGesturesEnabled = gestures;
listener.onUiSettingsChanged(this);
}
@Override
public boolean isZoomControlsEnabled() throws RemoteException {
return zoomControlsEnabled;
}
@Override
public boolean isCompassEnabled() throws RemoteException {
return compassEnabled;
}
@Override
public boolean isMyLocationButtonEnabled() throws RemoteException {
return myLocationButtonEnabled;
}
@Override
public boolean isScrollGesturesEnabled() throws RemoteException {
return scrollGesturesEnabled;
}
@Override
public boolean isZoomGesturesEnabled() throws RemoteException {
return zoomGesturesEnabled;
}
@Override
public boolean isTiltGesturesEnabled() throws RemoteException {
return tiltGesturesEnabled;
}
@Override
public boolean isRotateGesturesEnabled() throws RemoteException {
return rotateGesturesEnabled;
}
public static interface UiSettingsListener {
void onUiSettingsChanged(UiSettingsImpl settings) throws RemoteException;
}
}

View file

@ -28,7 +28,8 @@ public abstract class AbstractBitmapDescriptor {
public Bitmap loadBitmap(Context context) {
if (bitmap == null) {
synchronized (this) {
if (bitmap == null) bitmap = generateBitmap(context);
if (bitmap == null)
bitmap = generateBitmap(context);
}
}
return bitmap;

View file

@ -25,9 +25,9 @@ import java.io.IOException;
public class AssetBitmapDescriptor extends AbstractBitmapDescriptor {
private String assetName;
public AssetBitmapDescriptor(String assetName) {
public AssetBitmapDescriptor(String assetName) {
this.assetName = assetName;
}
}
@Override
protected Bitmap generateBitmap(Context context) {

View file

@ -20,14 +20,19 @@ import android.content.Context;
import android.graphics.Bitmap;
public class BitmapBitmapDescriptor extends AbstractBitmapDescriptor {
private Bitmap bitmap;
private Bitmap bitmap;
public BitmapBitmapDescriptor(Bitmap bitmap) {
this.bitmap = bitmap;
}
public BitmapBitmapDescriptor(Bitmap bitmap) {
this.bitmap = bitmap;
}
@Override
public Bitmap generateBitmap(Context context) {
return bitmap;
}
@Override
public Bitmap getBitmap() {
return bitmap;
}
@Override
public Bitmap generateBitmap(Context context) {
return bitmap;
}
}

View file

@ -24,38 +24,38 @@ import com.google.android.gms.maps.model.internal.IBitmapDescriptorFactoryDelega
public class BitmapDescriptorFactoryImpl extends IBitmapDescriptorFactoryDelegate.Stub {
@Override
public IObjectWrapper fromResource(int resourceId) throws RemoteException {
return ObjectWrapper.wrap(new ResourceBitmapDescriptor(resourceId));
}
@Override
public IObjectWrapper fromResource(int resourceId) throws RemoteException {
return ObjectWrapper.wrap(new ResourceBitmapDescriptor(resourceId));
}
@Override
public IObjectWrapper fromAsset(String assetName) throws RemoteException {
return ObjectWrapper.wrap(new AssetBitmapDescriptor(assetName));
}
@Override
public IObjectWrapper fromAsset(String assetName) throws RemoteException {
return ObjectWrapper.wrap(new AssetBitmapDescriptor(assetName));
}
@Override
public IObjectWrapper fromFile(String fileName) throws RemoteException {
return ObjectWrapper.wrap(new FileBitmapDescriptor(fileName));
}
@Override
public IObjectWrapper fromFile(String fileName) throws RemoteException {
return ObjectWrapper.wrap(new FileBitmapDescriptor(fileName));
}
@Override
public IObjectWrapper defaultMarker() throws RemoteException {
return ObjectWrapper.wrap(new DefaultBitmapDescriptor(0));
}
@Override
public IObjectWrapper defaultMarker() throws RemoteException {
return ObjectWrapper.wrap(new DefaultBitmapDescriptor());
}
@Override
public IObjectWrapper defaultMarkerWithHue(float hue) throws RemoteException {
return ObjectWrapper.wrap(new DefaultBitmapDescriptor(hue));
}
@Override
public IObjectWrapper defaultMarkerWithHue(float hue) throws RemoteException {
return ObjectWrapper.wrap(new DefaultBitmapDescriptor(hue));
}
@Override
public IObjectWrapper fromBitmap(Bitmap bitmap) throws RemoteException {
return ObjectWrapper.wrap(new BitmapBitmapDescriptor(bitmap));
}
@Override
public IObjectWrapper fromBitmap(Bitmap bitmap) throws RemoteException {
return ObjectWrapper.wrap(new BitmapBitmapDescriptor(bitmap));
}
@Override
public IObjectWrapper fromPath(String absolutePath) throws RemoteException {
return ObjectWrapper.wrap(new PathBitmapDescriptor(absolutePath));
}
@Override
public IObjectWrapper fromPath(String absolutePath) throws RemoteException {
return ObjectWrapper.wrap(new PathBitmapDescriptor(absolutePath));
}
}

View file

@ -1,19 +1,3 @@
/*
* Copyright (c) 2014 μg Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.microg.gms.maps.bitmap;
import android.content.Context;
@ -21,22 +5,28 @@ import android.graphics.Bitmap;
import android.util.Log;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.android.gms.dynamic.ObjectWrapper;
import com.google.android.gms.maps.model.BitmapDescriptor;
public class BitmapDescriptor {
private final IObjectWrapper remoteObject;
public class BitmapDescriptorImpl {
private BitmapDescriptor descriptor;
private boolean loadStarted = false;
public BitmapDescriptor(IObjectWrapper remoteObject) {
this.remoteObject = remoteObject;
}
public BitmapDescriptorImpl(IObjectWrapper remoteObject) {
this(new BitmapDescriptor(remoteObject));
}
public IObjectWrapper getRemoteObject() {
return remoteObject;
}
public BitmapDescriptorImpl(BitmapDescriptor descriptor) {
this.descriptor = descriptor;
}
public BitmapDescriptorImpl() {
this(new ObjectWrapper<>(new DefaultBitmapDescriptor(0)));
}
public AbstractBitmapDescriptor getDescriptor() {
if (remoteObject == null) return null;
Object unwrap = ObjectWrapper.unwrap(remoteObject);
if (descriptor.getRemoteObject() == null)
return null;
Object unwrap = ObjectWrapper.unwrap(descriptor.getRemoteObject());
if (unwrap instanceof AbstractBitmapDescriptor) {
return ((AbstractBitmapDescriptor) unwrap);
} else {
@ -51,15 +41,9 @@ public class BitmapDescriptor {
return null;
}
@Override
public String toString() {
return "BitmapDescriptor{" +
"remote=" + getDescriptor() +
'}';
}
public synchronized void loadBitmapAsync(final Context context, final Runnable after) {
if (loadStarted) return;
if (loadStarted)
return;
loadStarted = true;
if (getDescriptor() != null) {
new Thread(new Runnable() {

View file

@ -24,25 +24,31 @@ import com.google.android.gms.R;
import org.microg.gms.maps.ResourcesContainer;
public class DefaultBitmapDescriptor extends AbstractBitmapDescriptor {
private float hue;
private float hue;
public DefaultBitmapDescriptor(float hue) {
this.hue = hue;
}
public DefaultBitmapDescriptor() {
this(0);
}
@Override
public Bitmap generateBitmap(Context context) {
Bitmap source = BitmapFactory.decodeResource(ResourcesContainer.get(), R.drawable.maps_default_marker);
Bitmap bitmap = Bitmap.createBitmap(source.getWidth(), source.getHeight(), source.getConfig());
float[] hsv = new float[3];
for (int x = 0; x < bitmap.getWidth(); x++) {
for (int y = 0; y < bitmap.getHeight(); y++) {
int pixel = source.getPixel(x, y);
Color.colorToHSV(pixel, hsv);
hsv[0] = (hsv[0] + hue) % 360;
bitmap.setPixel(x, y, Color.HSVToColor(Color.alpha(pixel), hsv));
}
}
return bitmap;
}
public DefaultBitmapDescriptor(float hue) {
this.hue = hue;
}
@Override
public Bitmap generateBitmap(Context context) {
Bitmap source = BitmapFactory
.decodeResource(ResourcesContainer.get(), R.drawable.maps_default_marker);
Bitmap bitmap = Bitmap
.createBitmap(source.getWidth(), source.getHeight(), source.getConfig());
float[] hsv = new float[3];
for (int x = 0; x < bitmap.getWidth(); x++) {
for (int y = 0; y < bitmap.getHeight(); y++) {
int pixel = source.getPixel(x, y);
Color.colorToHSV(pixel, hsv);
hsv[0] = (hsv[0] + hue) % 360;
bitmap.setPixel(x, y, Color.HSVToColor(Color.alpha(pixel), hsv));
}
}
return bitmap;
}
}

View file

@ -23,7 +23,7 @@ import android.graphics.BitmapFactory;
public class FileBitmapDescriptor extends AbstractBitmapDescriptor {
private String fileName;
public FileBitmapDescriptor(String fileName) {
public FileBitmapDescriptor(String fileName) {
this.fileName = fileName;
}

View file

@ -17,6 +17,6 @@
package org.microg.gms.maps.bitmap;
public class PathBitmapDescriptor {
public PathBitmapDescriptor(String absolutePath) {
}
public PathBitmapDescriptor(String absolutePath) {
}
}

View file

@ -25,7 +25,7 @@ public class ResourceBitmapDescriptor extends AbstractBitmapDescriptor {
private int resourceId;
public ResourceBitmapDescriptor(int resourceId) {
public ResourceBitmapDescriptor(int resourceId) {
this.resourceId = resourceId;
}

View file

@ -16,8 +16,9 @@
package org.microg.gms.maps.camera;
import org.microg.gms.maps.GoogleMapImpl;
import org.oscim.map.Map;
public interface CameraUpdate {
void update(GoogleMapImpl map);
void apply(Map map);
void applyAnimated(Map map, int duration);
}

View file

@ -24,139 +24,158 @@ import com.google.android.gms.maps.internal.ICameraUpdateFactoryDelegate;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.android.maps.GeoPoint;
import org.microg.gms.maps.GoogleMapImpl;
import org.microg.gms.maps.GmsMapsTypeHelper;
import org.oscim.core.MapPosition;
import org.oscim.map.Map;
public class CameraUpdateFactoryImpl extends ICameraUpdateFactoryDelegate.Stub {
private static final String TAG = CameraUpdateFactoryImpl.class.getName();
private static final String TAG = CameraUpdateFactoryImpl.class.getName();
@Override
public IObjectWrapper zoomIn() throws RemoteException {
Log.d(TAG, "zoomIn");
return new ObjectWrapper<CameraUpdate>(new CameraUpdate() {
@Override
public void update(GoogleMapImpl map) {
map.getController().zoomIn();
}
});
}
@Override
public IObjectWrapper zoomIn() throws RemoteException {
Log.d(TAG, "zoomIn");
return new ObjectWrapper<CameraUpdate>(new MapPositionCameraUpdate() {
@Override
public IObjectWrapper zoomOut() throws RemoteException {
Log.d(TAG, "zoomOut");
return new ObjectWrapper<CameraUpdate>(new CameraUpdate() {
@Override
public void update(GoogleMapImpl map) {
map.getController().zoomOut();
}
});
}
@Override
public IObjectWrapper scrollBy(final float x, final float y) throws RemoteException {
Log.d(TAG, "scrollBy");
return new ObjectWrapper<CameraUpdate>(new CameraUpdate() {
@Override
public void update(GoogleMapImpl map) {
map.getController().scrollBy((int) x, (int) y);
}
});
}
@Override
public IObjectWrapper zoomTo(final float zoom) throws RemoteException {
Log.d(TAG, "zoomTo");
return new ObjectWrapper<CameraUpdate>(new CameraUpdate() {
@Override
public void update(GoogleMapImpl map) {
map.getController().setZoom((int) zoom);
}
});
}
@Override
public IObjectWrapper zoomBy(final float zoomDelta) throws RemoteException {
Log.d(TAG, "zoomBy");
return new ObjectWrapper<CameraUpdate>(new CameraUpdate() {
@Override
public void update(GoogleMapImpl map) {
map.getController().setZoom((int) (map.getMapView().getZoomLevel() + zoomDelta));
}
});
}
@Override
public IObjectWrapper zoomByWithFocus(final float zoomDelta, int x, int y) throws RemoteException {
Log.d(TAG, "zoomByWithFocus");
return new ObjectWrapper<CameraUpdate>(new CameraUpdate() {
@Override
public void update(GoogleMapImpl map) {
// TODO focus
map.getController().setZoom((int) (map.getMapView().getZoomLevel() + zoomDelta));
}
});
}
@Override
public IObjectWrapper newCameraPosition(final CameraPosition cameraPosition) throws RemoteException {
Log.d(TAG, "newCameraPosition");
if (cameraPosition == null) {
return new ObjectWrapper<CameraUpdate>(new CameraUpdate() {
@Override
public void update(GoogleMapImpl map) {
// Nothing
}
});
}
return newLatLngZoom(cameraPosition.target, cameraPosition.zoom);
}
@Override
public IObjectWrapper newLatLng(final LatLng latLng) throws RemoteException {
Log.d(TAG, "newLatLng");
return new ObjectWrapper<CameraUpdate>(new CameraUpdate() {
@Override
public void update(GoogleMapImpl map) {
map.getController().setCenter(new GeoPoint((int) (latLng.latitude * 1E6), (int) (latLng.longitude * 1E6)));
}
});
}
@Override
public IObjectWrapper newLatLngZoom(final LatLng latLng, final float zoom) throws RemoteException {
Log.d(TAG, "newLatLngZoom");
return new ObjectWrapper<CameraUpdate>(new CameraUpdate() {
@Override
public void update(GoogleMapImpl map) {
map.getController().setZoom((int) zoom);
map.getController().setCenter(new GeoPoint((int) (latLng.latitude * 1E6), (int) (latLng.longitude * 1E6)));
}
});
}
@Override
public IObjectWrapper newLatLngBounds(final LatLngBounds bounds, int i) throws RemoteException {
Log.d(TAG, "newLatLngBounds");
return new ObjectWrapper<CameraUpdate>(new CameraUpdate() {
@Override
public void update(GoogleMapImpl map) {
double latSpan = bounds.northEast.latitude - bounds.southWest.latitude,
lonSpan = bounds.northEast.longitude - bounds.southWest.longitude;
map.getController().setCenter(new GeoPoint((int) ((bounds.southWest.latitude + latSpan/2) * 1E6),
(int) ((bounds.southWest.longitude + lonSpan/2) * 1E6)));
map.getController().zoomToSpan((int) (latSpan * 1E6), (int) (lonSpan * 1E6));
@Override
MapPosition getMapPosition(Map map) {
MapPosition mapPosition = map.getMapPosition();
mapPosition.setScale(GmsMapsTypeHelper.fromZoom(
GmsMapsTypeHelper.toZoom(mapPosition.getScale()) + 1));
return mapPosition;
}
});
}
@Override
public IObjectWrapper newLatLngBoundsWithSize(LatLngBounds bounds, int i1, int i2, int i3) throws RemoteException {
Log.d(TAG, "newLatLngBoundsWithSize");
return new ObjectWrapper<CameraUpdate>(new CameraUpdate() {
@Override
public void update(GoogleMapImpl map) {
// TODO
}
});
}
@Override
public IObjectWrapper zoomOut() throws RemoteException {
Log.d(TAG, "zoomOut");
return new ObjectWrapper<CameraUpdate>(new MapPositionCameraUpdate() {
@Override
MapPosition getMapPosition(Map map) {
MapPosition mapPosition = map.getMapPosition();
mapPosition.setScale(GmsMapsTypeHelper.fromZoom(
GmsMapsTypeHelper.toZoom(mapPosition.getScale()) - 1));
return mapPosition;
}
});
}
@Override
public IObjectWrapper scrollBy(final float x, final float y) throws RemoteException {
Log.d(TAG, "scrollBy");
return new ObjectWrapper<CameraUpdate>(new MapPositionCameraUpdate() {
@Override
MapPosition getMapPosition(Map map) {
MapPosition mapPosition = map.getMapPosition();
mapPosition.setPosition(map.viewport()
.fromScreenPoint((float) (map.getWidth() / 2.0 + x),
(float) (map.getHeight() / 2.0 + y)));
return mapPosition;
}
});
}
@Override
public IObjectWrapper zoomTo(final float zoom) throws RemoteException {
Log.d(TAG, "zoomTo");
return new ObjectWrapper<CameraUpdate>(new MapPositionCameraUpdate() {
@Override
MapPosition getMapPosition(Map map) {
MapPosition mapPosition = map.getMapPosition();
mapPosition.setScale(GmsMapsTypeHelper.fromZoom(zoom));
return mapPosition;
}
});
}
@Override
public IObjectWrapper zoomBy(final float zoomDelta) throws RemoteException {
Log.d(TAG, "zoomBy");
return new ObjectWrapper<CameraUpdate>(new MapPositionCameraUpdate() {
@Override
MapPosition getMapPosition(Map map) {
MapPosition mapPosition = map.getMapPosition();
mapPosition.setScale(GmsMapsTypeHelper.fromZoom(
GmsMapsTypeHelper.toZoom(mapPosition.getScale()) + zoomDelta));
return mapPosition;
}
});
}
@Override
public IObjectWrapper zoomByWithFocus(final float zoomDelta, int x, int y)
throws RemoteException {
Log.d(TAG, "zoomByWithFocus");
return new ObjectWrapper<CameraUpdate>(new MapPositionCameraUpdate() {
@Override
MapPosition getMapPosition(Map map) {
MapPosition mapPosition = map.getMapPosition();
mapPosition.setScale(GmsMapsTypeHelper.fromZoom(
GmsMapsTypeHelper.toZoom(mapPosition.getScale()) + zoomDelta));
Log.w(TAG, "zoomBy with focus not yet supported"); // TODO
return mapPosition;
}
});
}
@Override
public IObjectWrapper newCameraPosition(final CameraPosition cameraPosition)
throws RemoteException {
Log.d(TAG, "newCameraPosition");
return new ObjectWrapper<CameraUpdate>(new MapPositionCameraUpdate() {
@Override
MapPosition getMapPosition(Map map) {
return GmsMapsTypeHelper.fromCameraPosition(cameraPosition);
}
});
}
@Override
public IObjectWrapper newLatLng(final LatLng latLng) throws RemoteException {
Log.d(TAG, "newLatLng");
return new ObjectWrapper<CameraUpdate>(new MapPositionCameraUpdate() {
@Override
MapPosition getMapPosition(Map map) {
MapPosition mapPosition = map.getMapPosition();
mapPosition.setPosition(GmsMapsTypeHelper.fromLatLng(latLng));
return mapPosition;
}
});
}
@Override
public IObjectWrapper newLatLngZoom(final LatLng latLng, final float zoom)
throws RemoteException {
Log.d(TAG, "newLatLngZoom");
return new ObjectWrapper<CameraUpdate>(new MapPositionCameraUpdate() {
@Override
MapPosition getMapPosition(Map map) {
MapPosition mapPosition = map.getMapPosition();
mapPosition.setPosition(GmsMapsTypeHelper.fromLatLng(latLng));
mapPosition.setScale(GmsMapsTypeHelper.fromZoom(zoom));
return mapPosition;
}
});
}
@Override
public IObjectWrapper newLatLngBounds(final LatLngBounds bounds, int i) throws RemoteException {
Log.d(TAG, "newLatLngBounds");
return new ObjectWrapper<CameraUpdate>(new MapPositionCameraUpdate() {
@Override
MapPosition getMapPosition(Map map) {
MapPosition mapPosition = map.getMapPosition();
mapPosition.setByBoundingBox(GmsMapsTypeHelper.fromLatLngBounds(bounds),
map.getWidth(), map.getHeight());
return mapPosition;
}
});
}
@Override
public IObjectWrapper newLatLngBoundsWithSize(LatLngBounds bounds, int i1, int i2, int i3)
throws RemoteException {
Log.d(TAG, "newLatLngBoundsWithSize");
return new ObjectWrapper<CameraUpdate>(new NoCameraUpdate());
}
}

View file

@ -0,0 +1,19 @@
package org.microg.gms.maps.camera;
import org.oscim.core.MapPosition;
import org.oscim.map.Map;
public abstract class MapPositionCameraUpdate implements CameraUpdate {
abstract MapPosition getMapPosition(Map map);
@Override
public void apply(Map map) {
map.setMapPosition(getMapPosition(map));
}
@Override
public void applyAnimated(Map map, int duration) {
map.animator().animateTo(duration, getMapPosition(map));
}
}

View file

@ -0,0 +1,15 @@
package org.microg.gms.maps.camera;
import org.oscim.map.Map;
public class NoCameraUpdate implements CameraUpdate {
@Override
public void apply(Map map) {
}
@Override
public void applyAnimated(Map map, int duration) {
}
}

View file

@ -32,7 +32,6 @@ public class CircleImpl extends ICircleDelegate.Stub {
private int fillColor;
public CircleImpl(CircleOptions options) {
}
@Override
@ -117,7 +116,7 @@ public class CircleImpl extends ICircleDelegate.Stub {
@Override
public boolean equalsRemote(ICircleDelegate other) throws RemoteException {
return other != null &&other.getId().equals(getId());
return other != null && other.getId().equals(getId());
}
@Override

View file

@ -17,25 +17,16 @@
package org.microg.gms.maps.markup;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.RemoteException;
import android.util.Log;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.google.android.gms.R;
import com.google.android.gms.maps.internal.IOnInfoWindowClickListener;
import com.google.android.gms.maps.model.internal.IMarkerDelegate;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import org.microg.gms.maps.GoogleMapImpl;
import org.microg.gms.maps.ResourcesContainer;
public class InfoWindow extends Overlay {
public class InfoWindow {
private static final String TAG = InfoWindow.class.getName();
private Context context;
private View window;
@ -61,17 +52,14 @@ public class InfoWindow extends Overlay {
}
public void setContent(View view) {
if (view == null) return;
if (view == null)
return;
setWindow(new DefaultWindow(view));
}
public void buildDefault() {
try {
if (marker.getTitle() != null)
if (marker.getTitle() != null)
setContent(new DefaultContent());
} catch (RemoteException e) {
// Not remote...
}
}
public void destroy() {
@ -84,6 +72,7 @@ public class InfoWindow extends Overlay {
return marker;
}
/*
@Override
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
if (window != null && marker.getHeight() != -1 && !shadow) {
@ -91,12 +80,13 @@ public class InfoWindow extends Overlay {
Log.d(TAG, "draw InfoWindow");
window.measure(0, 0);
window.layout(0, 0, window.getMeasuredWidth(), window.getMeasuredHeight());
Point point = mapView.getProjection().toPixels(marker.getPosition().toGeoPoint(), null);
/*
//Point point = mapView.getProjection().toPixels(marker.getPosition().toGeoPoint(), null);
// osmdroid 4.1 bugfix
Point zero = mapView.getProjection().toPixels(new GeoPoint(0, 0), null);
point.offset(-zero.x, -zero.y);
*/
point.offset(-window.getMeasuredWidth() / 2, -window.getMeasuredHeight() - marker.getHeight());
Log.d(TAG, point.toString());
@ -104,7 +94,7 @@ public class InfoWindow extends Overlay {
canvas.translate(point.x, point.y);
window.draw(canvas);
canvas.restore();
} catch (RemoteException e) {
} catch (Exception e) {
// This is not remote...
}
}
@ -113,7 +103,7 @@ public class InfoWindow extends Overlay {
@Override
public boolean onTap(GeoPoint p, MapView mapView) {
try {
IOnInfoWindowClickListener listener = map.getInfoWindowClickListener();
IOnInfoWindowClickListener listener = null; //map.getInfoWindowClickListener();
if (listener != null) {
Point clickPoint = mapView.getProjection().toPixels(p, null);
Point markerPoint = mapView.getProjection().toPixels(marker.getPosition().toGeoPoint(), null);
@ -129,12 +119,14 @@ public class InfoWindow extends Overlay {
}
return true;
}
}
} catch (RemoteException e) {
} catch (Exception e) {
// This is not remote...
}
return false;
}
*/
private class DefaultWindow extends FrameLayout {
public DefaultWindow(View view) {
@ -148,19 +140,17 @@ public class InfoWindow extends Overlay {
public DefaultContent() {
super(context);
setOrientation(LinearLayout.VERTICAL);
try {
TextView title = new TextView(context);
title.setTextAppearance(context, android.R.style.TextAppearance_DeviceDefault_Medium_Inverse);
title.setText(marker.getTitle());
addView(title);
if (marker.getSnippet() != null) {
TextView snippet = new TextView(context);
snippet.setTextAppearance(context, android.R.style.TextAppearance_DeviceDefault_Inverse);
snippet.setText(marker.getSnippet());
addView(snippet);
}
} catch (RemoteException e) {
// ...
TextView title = new TextView(context);
title.setTextAppearance(context,
android.R.style.TextAppearance_DeviceDefault_Medium_Inverse);
title.setText(marker.getTitle());
addView(title);
if (marker.getSnippet() != null) {
TextView snippet = new TextView(context);
snippet.setTextAppearance(context,
android.R.style.TextAppearance_DeviceDefault_Inverse);
snippet.setText(marker.getSnippet());
addView(snippet);
}
}
}

View file

@ -16,53 +16,39 @@
package org.microg.gms.maps.markup;
import android.graphics.*;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.RemoteException;
import android.util.Log;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.android.gms.dynamic.ObjectWrapper;
import com.google.android.gms.maps.model.internal.IMarkerDelegate;
import com.google.android.gms.maps.internal.IOnMarkerClickListener;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import org.microg.gms.maps.bitmap.BitmapDescriptor;
import org.microg.gms.maps.bitmap.DefaultBitmapDescriptor;
import org.microg.gms.maps.GoogleMapImpl;
import com.google.android.gms.maps.model.internal.IMarkerDelegate;
import org.microg.gms.maps.GmsMapsTypeHelper;
import org.microg.gms.maps.bitmap.BitmapDescriptorImpl;
import org.oscim.android.canvas.AndroidBitmap;
import org.oscim.layers.marker.MarkerItem;
import org.oscim.layers.marker.MarkerSymbol;
public class MarkerImpl extends IMarkerDelegate.Stub {
public class MarkerImpl extends IMarkerDelegate.Stub implements Markup {
private static final String TAG = MarkerImpl.class.getName();
private final String id;
private float alpha;
private boolean flat;
private boolean draggable;
private LatLng position;
private float anchorU;
private float anchorV;
private float rotation;
private String snippet;
private String title;
private boolean visible;
private MarkerOptions options;
private BitmapDescriptorImpl icon;
private BitmapDescriptor icon;
private GoogleMapImpl map;
private Overlay overlay = new Overlay() {
private MarkupListener listener;
/*private Overlay overlay = new Overlay() {
private Point point = new Point();
@Override
public boolean onTap(GeoPoint p, MapView mapView) {
Point touchPoint = mapView.getProjection().toPixels(p, null);
Bitmap bitmap = icon.getBitmap();
if (bitmap == null) return false;
mapView.getProjection().toPixels(position.toGeoPoint(), point);
if (bitmap == null)
return false;
//mapView.getProjection().toPixels(position.toGeoPoint(), point);
float xTest = bitmap.getWidth() * anchorU + touchPoint.x - point.x;
float yTest = bitmap.getHeight() * anchorV + touchPoint.y - point.y;
if (0 < xTest && xTest < bitmap.getWidth() && 0 < yTest && yTest < bitmap.getHeight()) {
@ -87,16 +73,19 @@ public class MarkerImpl extends IMarkerDelegate.Stub {
@Override
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
if (shadow /*&& flat*/) return; // shadows are broken right now, we skip them
if (shadow && flat)
return; // shadows are broken right now, we skip them
Bitmap bitmap = icon.getBitmap();
if (bitmap != null) {
mapView.getProjection().toPixels(position.toGeoPoint(), point);
//mapView.getProjection().toPixels(position.toGeoPoint(), point);
float x = point.x - bitmap.getWidth() * anchorU;
float y = point.y - bitmap.getHeight() * anchorV;
Paint paint = new Paint();
paint.setAlpha((int) (alpha * 255));
if (shadow) {
paint.setColorFilter(new PorterDuffColorFilter(Color.argb((int) (128 * alpha), 0, 0, 0), PorterDuff.Mode.SRC_IN));
paint.setColorFilter(
new PorterDuffColorFilter(Color.argb((int) (128 * alpha), 0, 0, 0),
PorterDuff.Mode.SRC_IN));
}
Matrix matrix = new Matrix();
matrix.setRotate(rotation, bitmap.getWidth() / 2, bitmap.getHeight() / 2);
@ -115,100 +104,95 @@ public class MarkerImpl extends IMarkerDelegate.Stub {
});
}
}
};
};*/
public MarkerImpl(String id, MarkerOptions options, GoogleMapImpl map) {
public MarkerImpl(String id, MarkerOptions options, MarkupListener listener) {
this.id = id;
this.map = map;
this.alpha = options.getAlpha();
this.draggable = options.isDraggable();
this.position = options.getPosition();
if (position == null) position = new LatLng(0, 0);
this.rotation = options.getRotation();
this.anchorU = options.getAnchorU();
this.anchorV = options.getAnchorV();
this.snippet = options.getSnippet();
this.title = options.getTitle();
this.visible = options.isVisible();
this.icon = options.getIcon();
if (icon == null)
icon = new BitmapDescriptor(new ObjectWrapper<DefaultBitmapDescriptor>(new DefaultBitmapDescriptor(0)));
Log.d(TAG, "New marker " + id + " with title " + title + " @ " + position);
this.listener = listener;
this.options = options == null ? new MarkerOptions() : options;
if (options.getPosition() == null) {
options.position(new LatLng(0, 0));
}
icon = options.getIcon() == null ? null : new BitmapDescriptorImpl(options.getIcon());
Log.d(TAG, "New marker " + id + " with title " + options.getTitle() + " @ " +
options.getPosition());
}
@Override
public void remove() throws RemoteException {
map.remove(this);
public void remove() {
listener.remove(this);
}
@Override
public String getId() throws RemoteException {
public String getId() {
return id;
}
@Override
public void setPosition(LatLng pos) throws RemoteException {
this.position = pos;
public void setPosition(LatLng pos) {
options.position(pos);
listener.update(this);
}
@Override
public LatLng getPosition() throws RemoteException {
return position;
public LatLng getPosition() {
return options.getPosition();
}
@Override
public void setTitle(String title) throws RemoteException {
this.title = title;
public void setTitle(String title) {
options.title(title);
listener.update(this);
}
@Override
public String getTitle() throws RemoteException {
return title;
public String getTitle() {
return options.getTitle();
}
@Override
public void setSnippet(String snippet) throws RemoteException {
this.snippet = snippet;
public void setSnippet(String snippet) {
options.snippet(snippet);
}
@Override
public String getSnippet() throws RemoteException {
return snippet;
public String getSnippet() {
return options.getSnippet();
}
@Override
public void setDraggable(boolean drag) throws RemoteException {
this.draggable = drag;
public void setDraggable(boolean drag) {
options.draggable(drag);
}
@Override
public boolean isDraggable() throws RemoteException {
return draggable;
public boolean isDraggable() {
return options.isDraggable();
}
@Override
public void showInfoWindow() throws RemoteException {
public void showInfoWindow() {
}
@Override
public void hideInfoWindow() throws RemoteException {
public void hideInfoWindow() {
}
@Override
public boolean isInfoWindowShown() throws RemoteException {
public boolean isInfoWindowShown() {
return false;
}
@Override
public void setVisible(boolean visible) throws RemoteException {
this.visible = visible;
public void setVisible(boolean visible) {
options.visible(visible);
}
@Override
public boolean isVisible() throws RemoteException {
return visible;
public boolean isVisible() {
return options.isVisible();
}
@Override
@ -217,69 +201,89 @@ public class MarkerImpl extends IMarkerDelegate.Stub {
}
@Override
public int hashCodeRemote() throws RemoteException {
public int hashCodeRemote() {
return hashCode();
}
@Override
public void setIcon(IObjectWrapper obj) throws RemoteException {
icon = new BitmapDescriptor(obj);
if (icon == null)
icon = new BitmapDescriptor(new ObjectWrapper<DefaultBitmapDescriptor>(new DefaultBitmapDescriptor(0)));
map.redraw();
public void setIcon(IObjectWrapper obj) {
if (obj == null) {
icon = new BitmapDescriptorImpl();
} else {
icon = new BitmapDescriptorImpl(obj);
}
listener.update(this);
}
@Override
public void setAnchor(float x, float y) throws RemoteException {
anchorU = x;
anchorV = y;
map.redraw();
public void setAnchor(float x, float y) {
options.anchor(x, y);
listener.update(this);
}
@Override
public void setFlat(boolean flat) throws RemoteException {
map.redraw();
public void setFlat(boolean flat) {
options.flat(flat);
listener.update(this);
}
@Override
public boolean isFlat() throws RemoteException {
return false;
public boolean isFlat() {
return options.isFlat();
}
@Override
public void setRotation(float rotation) throws RemoteException {
this.rotation = rotation;
map.redraw();
public void setRotation(float rotation) {
options.rotation(rotation);
listener.update(this);
}
@Override
public float getRotation() throws RemoteException {
return rotation;
public float getRotation() {
return options.getRotation();
}
@Override
public void setInfoWindowAnchor(float x, float y) throws RemoteException {
public void setInfoWindowAnchor(float x, float y) {
options.infoWindowAnchor(x, y);
}
@Override
public void setAlpha(float alpha) throws RemoteException {
this.alpha = alpha;
map.redraw();
public void setAlpha(float alpha) {
options.alpha(alpha);
listener.update(this);
}
@Override
public float getAlpha() throws RemoteException {
return alpha;
}
public Overlay getOverlay() {
return overlay;
public float getAlpha() {
return options.getAlpha();
}
public int getHeight() {
Bitmap bitmap = icon.getBitmap();
if (bitmap == null) return -1;
if (bitmap == null)
return -1;
return bitmap.getHeight();
}
@Override
public MarkerItem getMarkerItem(Context context) {
MarkerItem item = new MarkerItem(getId(), getTitle(), getSnippet(),
GmsMapsTypeHelper.fromLatLng(getPosition()));
if (icon != null) {
if (icon.getBitmap() != null) {
item.setMarker(
new MarkerSymbol(new AndroidBitmap(icon.getBitmap()), options.getAnchorU(),
options.getAnchorV(), isFlat()));
} else {
icon.loadBitmapAsync(context, new Runnable() {
@Override
public void run() {
listener.update(MarkerImpl.this);
}
});
}
}
return item;
}
}

View file

@ -0,0 +1,16 @@
package org.microg.gms.maps.markup;
import android.content.Context;
import org.oscim.layers.marker.MarkerItem;
public interface Markup {
public MarkerItem getMarkerItem(Context context);
public String getId();
public static interface MarkupListener {
void update(Markup markup);
void remove(Markup markup);
}
}

View file

@ -0,0 +1,6 @@
package org.microg.gms.maps.markup;
import com.google.android.gms.maps.model.internal.ITileOverlayDelegate;
public class TileOverlayImpl extends ITileOverlayDelegate.Stub {
}