mirror of
https://github.com/YTVanced/VancedMicroG
synced 2024-11-27 13:43:00 +00:00
Initial commit.
This commit is contained in:
commit
bf92d2715b
84 changed files with 2711 additions and 0 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
*.iml
|
||||
gen
|
||||
bin
|
||||
build
|
39
Android.mk
Normal file
39
Android.mk
Normal file
|
@ -0,0 +1,39 @@
|
|||
# Copyright (c) 2014 μg Project
|
||||
#
|
||||
# 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.
|
||||
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
unified_dir := ../UnifiedNlp
|
||||
res_dir := res $(unified_dir)/res
|
||||
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under, src)
|
||||
LOCAL_SRC_FILES += $(call all-Iaidl-files-under, src)
|
||||
LOCAL_SRC_FILES += $(call all-java-files-under, $(unified_dir)/src)
|
||||
LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dir))
|
||||
LOCAL_AAPT_FLAGS := --auto-add-overlay --extra-packages org.microg.nlp
|
||||
|
||||
# For some reason framework has to be added here else GeocoderParams is not found,
|
||||
# this way everything else is duplicated, but atleast compiles...
|
||||
LOCAL_JAVA_LIBRARIES := com.google.android.maps framework com.android.location.provider
|
||||
|
||||
LOCAL_STATIC_JAVA_LIBRARIES := UnifiedNlpApi
|
||||
LOCAL_PACKAGE_NAME := GmsCore
|
||||
LOCAL_SDK_VERSION := current
|
||||
LOCAL_PRIVILEGED_MODULE := true
|
||||
|
||||
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
|
||||
|
||||
include $(BUILD_PACKAGE)
|
88
AndroidManifest.xml
Normal file
88
AndroidManifest.xml
Normal file
|
@ -0,0 +1,88 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.google.android.gms"
|
||||
android:versionCode="4243036">
|
||||
|
||||
<uses-sdk android:minSdkVersion="16" />
|
||||
|
||||
<uses-permission android:name="android.permission.INSTALL_LOCATION_PROVIDER" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
|
||||
<application
|
||||
android:icon="@drawable/nlp_app_icon"
|
||||
android:label="@string/nlp_app_name">
|
||||
<uses-library
|
||||
android:name="com.android.location.provider"
|
||||
android:required="false" />
|
||||
<uses-library
|
||||
android:name="com.google.android.maps"
|
||||
android:required="false" />
|
||||
|
||||
<!-- Jelly Bean / KitKat -->
|
||||
<service
|
||||
android:name="org.microg.nlp.location.LocationServiceV2"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<!-- KitKat changed the action name but nothing else, hence we handle it the same -->
|
||||
<action android:name="com.android.location.service.v3.NetworkLocationProvider" />
|
||||
<action android:name="com.android.location.service.v2.NetworkLocationProvider" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="serviceVersion"
|
||||
android:value="2" />
|
||||
<meta-data
|
||||
android:name="serviceIsMultiuser"
|
||||
android:value="false" />
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name="org.microg.nlp.geocode.GeocodeServiceV1"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<!-- Jelly Bean changed the action name but nothing else, hence we handle it the same -->
|
||||
<action android:name="com.android.location.service.GeocodeProvider" />
|
||||
<action android:name="com.google.android.location.GeocodeProvider" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="serviceVersion"
|
||||
android:value="2" />
|
||||
<meta-data
|
||||
android:name="serviceIsMultiuser"
|
||||
android:value="false" />
|
||||
</service>
|
||||
|
||||
<activity
|
||||
android:name="org.microg.nlp.ui.LocationBackendConfig"
|
||||
android:theme="@android:style/Theme.Holo.Light">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<receiver android:name="org.microg.nlp.PackageReceiver" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.PACKAGE_ADDED" />
|
||||
<action android:name="android.intent.action.PACKAGE_CHANGED" />
|
||||
<action android:name="android.intent.action.PACKAGE_UPGRADED" />
|
||||
<action android:name="android.intent.action.PACKAGE_REMOVED" />
|
||||
<action android:name="android.intent.action.PACKAGE_REPLACED" />
|
||||
<action android:name="android.intent.action.PACKAGE_RESTARTED" />
|
||||
|
||||
<data android:scheme="package" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
|
||||
<service android:name="com.google.android.location.internal.GoogleLocationManagerService" android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.location.internal.GoogleLocationManagerService.START" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
</application>
|
||||
</manifest>
|
5
proguard.flags
Normal file
5
proguard.flags
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Disable ProGuard Notes, they won't help here
|
||||
-dontnote
|
||||
|
||||
# Keep dynamically loaded GMS classes
|
||||
-keep public class com.google.android.gms.maps.internal.CreatorImpl
|
3
res/drawable/ic_plusone_medium.xml
Normal file
3
res/drawable/ic_plusone_medium.xml
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector>
|
||||
</selector>
|
3
res/drawable/ic_plusone_small.xml
Normal file
3
res/drawable/ic_plusone_small.xml
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector>
|
||||
</selector>
|
3
res/drawable/ic_plusone_standard.xml
Normal file
3
res/drawable/ic_plusone_standard.xml
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector>
|
||||
</selector>
|
3
res/drawable/ic_plusone_tall.xml
Normal file
3
res/drawable/ic_plusone_tall.xml
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector>
|
||||
</selector>
|
4
res/values/dimens.xml
Normal file
4
res/values/dimens.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="maps_watermark_margin">5.0dip</dimen>
|
||||
</resources>
|
|
@ -0,0 +1,127 @@
|
|||
package com.google.android.gms.common.internal;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
|
||||
public abstract class AbstractGmsServiceBroker extends IGmsServiceBroker.Stub {
|
||||
@Override
|
||||
public void getPlusService(IGmsCallbacks callback, int code, String str1, String str2, String[] paramArrayOfString, String str3, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Plus service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getPanoramaService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Panorama service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppDataSearchService(IGmsCallbacks callback, int code, String str) throws RemoteException {
|
||||
throw new IllegalArgumentException("App Data Search service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWalletService(IGmsCallbacks callback, int code) throws RemoteException {
|
||||
throw new IllegalArgumentException("Wallet service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getPeopleService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("People service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getReportingService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Reporting service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getLocationService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Location service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGoogleLocationManagerService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Google Location Manager service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGamesService(IGmsCallbacks callback, int code, String str1, 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 code, String str1, String str2, String[] args) throws RemoteException {
|
||||
throw new IllegalArgumentException("App State service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getPlayLogService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Play Log service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAdMobService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("AdMob service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDroidGuardService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("DroidGuard service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getLockboxService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Lockbox service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getCastMirroringService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Cast Mirroring service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNetworkQualityService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Network Quality service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGoogleIdentityService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Google Identity service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGoogleFeedbackService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Google Feedback service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getCastService(IGmsCallbacks callback, int code, String str, IBinder binder, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Cast service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDriveService(IGmsCallbacks callback, int code, String str1, String[] args, String str2, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Drive service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getLightweightAppDataSearchService(IGmsCallbacks callback, int code, String str) throws RemoteException {
|
||||
throw new IllegalArgumentException("Lightweight App Data Search service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSearchAdministrationService(IGmsCallbacks callback, int code, String str) throws RemoteException {
|
||||
throw new IllegalArgumentException("Search Administration service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAutoBackupService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Auto Backup service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAddressService(IGmsCallbacks callback, int code, String str) throws RemoteException {
|
||||
throw new IllegalArgumentException("Address service not supported");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package com.google.android.gms.common.internal;
|
||||
|
||||
interface IGmsCallbacks {
|
||||
void onPostInitComplete(int code, IBinder binder, in Bundle params);
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
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);
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
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;
|
||||
}
|
104
src/com/google/android/gms/common/safeparcel/SafeReader.java
Normal file
104
src/com/google/android/gms/common/safeparcel/SafeReader.java
Normal file
|
@ -0,0 +1,104 @@
|
|||
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 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);
|
||||
}
|
||||
}
|
||||
}
|
212
src/com/google/android/gms/common/safeparcel/SafeWriter.java
Normal file
212
src/com/google/android/gms/common/safeparcel/SafeWriter.java
Normal file
|
@ -0,0 +1,212 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
4
src/com/google/android/gms/dynamic/IObjectWrapper.aidl
Normal file
4
src/com/google/android/gms/dynamic/IObjectWrapper.aidl
Normal file
|
@ -0,0 +1,4 @@
|
|||
package com.google.android.gms.dynamic;
|
||||
|
||||
interface IObjectWrapper {
|
||||
}
|
45
src/com/google/android/gms/dynamic/ObjectWrapper.java
Normal file
45
src/com/google/android/gms/dynamic/ObjectWrapper.java
Normal file
|
@ -0,0 +1,45 @@
|
|||
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 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);
|
||||
}
|
||||
}
|
3
src/com/google/android/gms/maps/GoogleMapOptions.aidl
Normal file
3
src/com/google/android/gms/maps/GoogleMapOptions.aidl
Normal file
|
@ -0,0 +1,3 @@
|
|||
package com.google.android.gms.maps;
|
||||
|
||||
parcelable GoogleMapOptions;
|
104
src/com/google/android/gms/maps/GoogleMapOptions.java
Normal file
104
src/com/google/android/gms/maps/GoogleMapOptions.java
Normal file
|
@ -0,0 +1,104 @@
|
|||
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 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];
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
public interface CameraUpdate {
|
||||
void update(GoogleMapImpl map);
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
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.CameraPosition;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.gms.maps.model.LatLngBounds;
|
||||
import com.google.android.maps.GeoPoint;
|
||||
|
||||
public class CameraUpdateFactoryImpl extends ICameraUpdateFactoryDelegate.Stub {
|
||||
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 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");
|
||||
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) {
|
||||
// TODO
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@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
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
43
src/com/google/android/gms/maps/internal/CreatorImpl.java
Normal file
43
src/com/google/android/gms/maps/internal/CreatorImpl.java
Normal file
|
@ -0,0 +1,43 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.os.RemoteException;
|
||||
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.model.internal.BitmapDescriptorFactoryImpl;
|
||||
import com.google.android.gms.maps.model.internal.IBitmapDescriptorFactoryDelegate;
|
||||
|
||||
public class CreatorImpl extends ICreator.Stub {
|
||||
@Override
|
||||
public void init(IObjectWrapper resources) throws RemoteException {
|
||||
initV2(resources, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMapFragmentDelegate newMapFragmentDelegate(IObjectWrapper activity) throws RemoteException {
|
||||
return new MapFragmentImpl((Activity)ObjectWrapper.unwrap(activity));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMapViewDelegate newMapViewDelegate(IObjectWrapper context, GoogleMapOptions options) throws RemoteException {
|
||||
return new MapViewImpl((Context)ObjectWrapper.unwrap(context), options);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICameraUpdateFactoryDelegate newCameraUpdateFactoryDelegate() throws RemoteException {
|
||||
return new CameraUpdateFactoryImpl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBitmapDescriptorFactoryDelegate newBitmapDescriptorFactoryDelegate() throws RemoteException {
|
||||
return new BitmapDescriptorFactoryImpl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initV2(IObjectWrapper resources, int flags) throws RemoteException {
|
||||
ResourcesContainer.set((Resources) ObjectWrapper.unwrap(resources));
|
||||
}
|
||||
}
|
384
src/com/google/android/gms/maps/internal/GoogleMapImpl.java
Normal file
384
src/com/google/android/gms/maps/internal/GoogleMapImpl.java
Normal file
|
@ -0,0 +1,384 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
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.model.*;
|
||||
import com.google.android.gms.maps.model.internal.*;
|
||||
import com.google.android.maps.MapController;
|
||||
import com.google.android.maps.MapView;
|
||||
|
||||
public class GoogleMapImpl {
|
||||
private static final String TAG = GoogleMapImpl.class.getName();
|
||||
|
||||
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 ViewGroup view;
|
||||
private final GoogleMapOptions options;
|
||||
private final Delegate delegate = new Delegate();
|
||||
private MapView mapView;
|
||||
private int mapType = 1;
|
||||
|
||||
public GoogleMapImpl(LayoutInflater inflater, GoogleMapOptions options) {
|
||||
this.view = new FrameLayout(inflater.getContext());
|
||||
try {
|
||||
mapView = (MapView) Class.forName("com.google.android.maps.MapView").getConstructor(Context.class, String.class).newInstance(inflater.getContext(), null);
|
||||
view.addView(mapView);
|
||||
} catch (Exception e) {
|
||||
Log.d(TAG, "Sorry, can't create legacy MapView");
|
||||
}
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
}
|
||||
|
||||
MapView getMapView() {
|
||||
return mapView;
|
||||
}
|
||||
|
||||
MapController getController() {
|
||||
return mapView != null ? mapView.getController() : null;
|
||||
}
|
||||
|
||||
public View getView() {
|
||||
return view;
|
||||
}
|
||||
|
||||
public IGoogleMapDelegate getDelegate() {
|
||||
return delegate;
|
||||
}
|
||||
|
||||
private class Delegate extends IGoogleMapDelegate.Stub {
|
||||
@Override
|
||||
public CameraPosition getCameraPosition() throws RemoteException {
|
||||
if (mapView == null) return null;
|
||||
LatLng center = new LatLng(mapView.getMapCenter().getLatitudeE6() / 1E6F, mapView.getMapCenter().getLongitudeE6() / 1E6F);
|
||||
return new CameraPosition(center, mapView.getZoomLevel(), 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMaxZoomLevel() throws RemoteException {
|
||||
return mapView.getMaxZoomLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMinZoomLevel() throws RemoteException {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveCamera(IObjectWrapper cameraUpdate) throws RemoteException {
|
||||
((CameraUpdate) ObjectWrapper.unwrap(cameraUpdate)).update(GoogleMapImpl.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void animateCamera(IObjectWrapper cameraUpdate) throws RemoteException {
|
||||
((CameraUpdate) ObjectWrapper.unwrap(cameraUpdate)).update(GoogleMapImpl.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void animateCameraWithCallback(IObjectWrapper cameraUpdate, ICancelableCallback callback) throws RemoteException {
|
||||
((CameraUpdate) ObjectWrapper.unwrap(cameraUpdate)).update(GoogleMapImpl.this);
|
||||
if (callback != null) callback.onFinish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void animateCameraWithDurationAndCallback(IObjectWrapper cameraUpdate, int duration, ICancelableCallback callback) throws RemoteException {
|
||||
((CameraUpdate) ObjectWrapper.unwrap(cameraUpdate)).update(GoogleMapImpl.this);
|
||||
if (callback != null) callback.onFinish();
|
||||
}
|
||||
|
||||
@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 null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMarkerDelegate addMarker(MarkerOptions options) throws RemoteException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGroundOverlayDelegate addGroundOverlay(GroundOverlayOptions options) throws RemoteException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileOverlayDelegate addTileOverlay(TileOverlayOptions options) throws RemoteException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@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 new UiSettings();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProjectionDelegate getProjection() throws RemoteException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnCameraChangeListener(IOnCameraChangeListener listener) throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnMapClickListener(final IOnMapClickListener listener) throws RemoteException {
|
||||
mapView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
try {
|
||||
Log.d(TAG, "onMapClick:");
|
||||
listener.onMapClick(new LatLng(0, 0));
|
||||
} catch (RemoteException ignored) {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnMapLongClickListener(final IOnMapLongClickListener listener) throws RemoteException {
|
||||
mapView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
try {
|
||||
Log.d(TAG, "onMapLongClick:");
|
||||
listener.onMapLongClick(new LatLng(0, 0));
|
||||
} catch (RemoteException e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnMarkerClickListener(IOnMarkerClickListener listener) throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnMarkerDragListener(IOnMarkerDragListener listener) throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnInfoWindowClickListener(IOnInfoWindowClickListener listener) throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInfoWindowAdapter(IInfoWindowAdapter adapter) throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IObjectWrapper getTestingHelper() throws RemoteException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICircleDelegate addCircle(CircleOptions options) throws RemoteException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@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 {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private class UiSettings extends IUiSettingsDelegate.Stub {
|
||||
|
||||
@Override
|
||||
public void setZoomControlsEnabled(boolean zoom) throws RemoteException {
|
||||
mapView.setBuiltInZoomControls(zoom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompassEnabled(boolean compass) throws RemoteException {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMyLocationButtonEnabled(boolean locationButton) throws RemoteException {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScrollGesturesEnabled(boolean scrollGestures) throws RemoteException {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
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);
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
interface ICancelableCallback {
|
||||
void onFinish();
|
||||
void onCancel();
|
||||
}
|
17
src/com/google/android/gms/maps/internal/ICreator.aidl
Normal file
17
src/com/google/android/gms/maps/internal/ICreator.aidl
Normal file
|
@ -0,0 +1,17 @@
|
|||
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);
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
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);
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
interface IInfoWindowAdapter {
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
interface ILocationSourceDelegate {
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
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();
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
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();
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
interface IOnCameraChangeListener {
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
interface IOnInfoWindowClickListener {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
|
||||
interface IOnMapClickListener {
|
||||
void onMapClick(in LatLng latLng);
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
interface IOnMapLoadedCallback {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
|
||||
interface IOnMapLongClickListener {
|
||||
void onMapLongClick(in LatLng latLng);
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
interface IOnMarkerClickListener {
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
interface IOnMarkerDragListener {
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
interface IOnMyLocationButtonClickListener {
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
interface IOnMyLocationChangeListener {
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
interface IProjectionDelegate {
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
interface ISnapshotReadyCallback {
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
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();
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.RemoteException;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import com.google.android.gms.dynamic.IObjectWrapper;
|
||||
import com.google.android.gms.dynamic.ObjectWrapper;
|
||||
import com.google.android.gms.maps.GoogleMapOptions;
|
||||
|
||||
public class MapFragmentImpl extends IMapFragmentDelegate.Stub {
|
||||
|
||||
private GoogleMapImpl map;
|
||||
private GoogleMapOptions options;
|
||||
private Context context;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGoogleMapDelegate getMap() throws RemoteException {
|
||||
return myMap().getDelegate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInflate(IObjectWrapper activity, GoogleMapOptions options, Bundle savedInstanceState) throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@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 void onResume() throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReady() throws RemoteException {
|
||||
return false;
|
||||
}
|
||||
}
|
69
src/com/google/android/gms/maps/internal/MapViewImpl.java
Normal file
69
src/com/google/android/gms/maps/internal/MapViewImpl.java
Normal file
|
@ -0,0 +1,69 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.RemoteException;
|
||||
import android.view.LayoutInflater;
|
||||
import com.google.android.gms.dynamic.IObjectWrapper;
|
||||
import com.google.android.gms.dynamic.ObjectWrapper;
|
||||
import com.google.android.gms.maps.GoogleMapOptions;
|
||||
|
||||
public class MapViewImpl extends IMapViewDelegate.Stub {
|
||||
|
||||
private GoogleMapImpl map;
|
||||
private GoogleMapOptions options;
|
||||
private Context context;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGoogleMapDelegate getMap() throws RemoteException {
|
||||
return myMap().getDelegate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) throws RemoteException {
|
||||
myMap().onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() 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());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
15
src/com/google/android/gms/maps/model/BitmapDescriptor.java
Normal file
15
src/com/google/android/gms/maps/model/BitmapDescriptor.java
Normal file
|
@ -0,0 +1,15 @@
|
|||
package com.google.android.gms.maps.model;
|
||||
|
||||
import com.google.android.gms.dynamic.IObjectWrapper;
|
||||
|
||||
public class BitmapDescriptor {
|
||||
private final IObjectWrapper remoteObject;
|
||||
|
||||
public BitmapDescriptor(IObjectWrapper remoteObject) {
|
||||
this.remoteObject = remoteObject;
|
||||
}
|
||||
|
||||
public IObjectWrapper getRemoteObject() {
|
||||
return remoteObject;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
package com.google.android.gms.maps.model;
|
||||
|
||||
parcelable CameraPosition;
|
100
src/com/google/android/gms/maps/model/CameraPosition.java
Normal file
100
src/com/google/android/gms/maps/model/CameraPosition.java
Normal file
|
@ -0,0 +1,100 @@
|
|||
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);
|
||||
}
|
||||
}
|
3
src/com/google/android/gms/maps/model/CircleOptions.aidl
Normal file
3
src/com/google/android/gms/maps/model/CircleOptions.aidl
Normal file
|
@ -0,0 +1,3 @@
|
|||
package com.google.android.gms.maps.model;
|
||||
|
||||
parcelable CircleOptions;
|
86
src/com/google/android/gms/maps/model/CircleOptions.java
Normal file
86
src/com/google/android/gms/maps/model/CircleOptions.java
Normal file
|
@ -0,0 +1,86 @@
|
|||
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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
package com.google.android.gms.maps.model;
|
||||
|
||||
parcelable GroundOverlayOptions;
|
107
src/com/google/android/gms/maps/model/GroundOverlayOptions.java
Normal file
107
src/com/google/android/gms/maps/model/GroundOverlayOptions.java
Normal file
|
@ -0,0 +1,107 @@
|
|||
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;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
3
src/com/google/android/gms/maps/model/LatLng.aidl
Normal file
3
src/com/google/android/gms/maps/model/LatLng.aidl
Normal file
|
@ -0,0 +1,3 @@
|
|||
package com.google.android.gms.maps.model;
|
||||
|
||||
parcelable LatLng;
|
85
src/com/google/android/gms/maps/model/LatLng.java
Normal file
85
src/com/google/android/gms/maps/model/LatLng.java
Normal file
|
@ -0,0 +1,85 @@
|
|||
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 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);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
3
src/com/google/android/gms/maps/model/LatLngBounds.aidl
Normal file
3
src/com/google/android/gms/maps/model/LatLngBounds.aidl
Normal file
|
@ -0,0 +1,3 @@
|
|||
package com.google.android.gms.maps.model;
|
||||
|
||||
parcelable LatLngBounds;
|
61
src/com/google/android/gms/maps/model/LatLngBounds.java
Normal file
61
src/com/google/android/gms/maps/model/LatLngBounds.java
Normal file
|
@ -0,0 +1,61 @@
|
|||
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;
|
||||
private LatLng southWest;
|
||||
private LatLng northEast;
|
||||
|
||||
public LatLngBounds() {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
3
src/com/google/android/gms/maps/model/MarkerOptions.aidl
Normal file
3
src/com/google/android/gms/maps/model/MarkerOptions.aidl
Normal file
|
@ -0,0 +1,3 @@
|
|||
package com.google.android.gms.maps.model;
|
||||
|
||||
parcelable MarkerOptions;
|
32
src/com/google/android/gms/maps/model/MarkerOptions.java
Normal file
32
src/com/google/android/gms/maps/model/MarkerOptions.java
Normal file
|
@ -0,0 +1,32 @@
|
|||
package com.google.android.gms.maps.model;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class MarkerOptions implements Parcelable {
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
}
|
||||
|
||||
public MarkerOptions() {
|
||||
}
|
||||
|
||||
private MarkerOptions(Parcel in) {
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
package com.google.android.gms.maps.model;
|
||||
|
||||
parcelable PolygonOptions;
|
32
src/com/google/android/gms/maps/model/PolygonOptions.java
Normal file
32
src/com/google/android/gms/maps/model/PolygonOptions.java
Normal file
|
@ -0,0 +1,32 @@
|
|||
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];
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
package com.google.android.gms.maps.model;
|
||||
|
||||
parcelable PolylineOptions;
|
45
src/com/google/android/gms/maps/model/PolylineOptions.java
Normal file
45
src/com/google/android/gms/maps/model/PolylineOptions.java
Normal file
|
@ -0,0 +1,45 @@
|
|||
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];
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
package com.google.android.gms.maps.model;
|
||||
|
||||
parcelable TileOverlayOptions;
|
|
@ -0,0 +1,32 @@
|
|||
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];
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package com.google.android.gms.maps.model.internal;
|
||||
|
||||
public class AssetBitmapDescriptor {
|
||||
public AssetBitmapDescriptor(String assetName) {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package com.google.android.gms.maps.model.internal;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
public class BitmapBitmapDescriptor {
|
||||
public BitmapBitmapDescriptor(Bitmap bitmap) {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.google.android.gms.maps.model.internal;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.RemoteException;
|
||||
import com.google.android.gms.dynamic.IObjectWrapper;
|
||||
import com.google.android.gms.dynamic.ObjectWrapper;
|
||||
|
||||
public class BitmapDescriptorFactoryImpl extends IBitmapDescriptorFactoryDelegate.Stub {
|
||||
|
||||
@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 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 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 fromPath(String absolutePath) throws RemoteException {
|
||||
return ObjectWrapper.wrap(new PathBitmapDescriptor(absolutePath));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.google.android.gms.maps.model.internal;
|
||||
|
||||
public class DefaultBitmapDescriptor {
|
||||
public DefaultBitmapDescriptor(float hue) {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package com.google.android.gms.maps.model.internal;
|
||||
|
||||
public class FileBitmapDescriptor {
|
||||
public FileBitmapDescriptor(String fileName) {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
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);
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.google.android.gms.maps.model.internal;
|
||||
|
||||
interface ICircleDelegate {
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.google.android.gms.maps.model.internal;
|
||||
|
||||
interface IGroundOverlayDelegate {
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.google.android.gms.maps.model.internal;
|
||||
|
||||
interface IMarkerDelegate {
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.google.android.gms.maps.model.internal;
|
||||
|
||||
interface IPolygonDelegate {
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
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();
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.google.android.gms.maps.model.internal;
|
||||
|
||||
interface ITileOverlayDelegate {
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package com.google.android.gms.maps.model.internal;
|
||||
|
||||
public class PathBitmapDescriptor {
|
||||
public PathBitmapDescriptor(String absolutePath) {
|
||||
}
|
||||
}
|
108
src/com/google/android/gms/maps/model/internal/PolylineImpl.java
Normal file
108
src/com/google/android/gms/maps/model/internal/PolylineImpl.java
Normal file
|
@ -0,0 +1,108 @@
|
|||
package com.google.android.gms.maps.model.internal;
|
||||
|
||||
import android.os.RemoteException;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.gms.maps.model.PolylineOptions;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
public class PolylineImpl extends IPolylineDelegate.Stub {
|
||||
private List<LatLng> points;
|
||||
private float zIndex;
|
||||
private boolean geodesic;
|
||||
private boolean visible;
|
||||
private String id;
|
||||
private float width;
|
||||
private int color;
|
||||
|
||||
public PolylineImpl(PolylineOptions options) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() throws RemoteException {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPoints(List<LatLng> points) throws RemoteException {
|
||||
this.points = points;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LatLng> getPoints() throws RemoteException {
|
||||
return points == null ? Collections.<LatLng>emptyList() : points;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWidth(float width) throws RemoteException {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWidth() throws RemoteException {
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColor(int color) throws RemoteException {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() throws RemoteException {
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setZIndex(float zIndex) throws RemoteException {
|
||||
this.zIndex = zIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getZIndex() throws RemoteException {
|
||||
return zIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean visible) throws RemoteException {
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible() throws RemoteException {
|
||||
return visible;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGeodesic(boolean geod) throws RemoteException {
|
||||
this.geodesic = geod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGeodesic() throws RemoteException {
|
||||
return geodesic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsRemote(IPolylineDelegate other) throws RemoteException {
|
||||
if (other.getId().equals(getId())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCodeRemote() throws RemoteException {
|
||||
return id.hashCode();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.google.android.gms.maps.model.internal;
|
||||
|
||||
public class ResourceBitmapDescriptor {
|
||||
public ResourceBitmapDescriptor(int resourceId) {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
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);
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.google.android.gms.plus.plusone;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.RemoteException;
|
||||
import com.google.android.gms.dynamic.IObjectWrapper;
|
||||
import com.google.android.gms.dynamic.ObjectWrapper;
|
||||
import com.google.android.gms.plus.internal.IPlusOneButtonCreator;
|
||||
|
||||
public class PlusOneButtonCreatorImpl extends IPlusOneButtonCreator.Stub {
|
||||
@Override
|
||||
public IObjectWrapper create(IObjectWrapper context, int size, int annotation, String url, int activityRequestCode) throws RemoteException {
|
||||
Context ctx = (Context) ObjectWrapper.unwrap(context);
|
||||
return ObjectWrapper.wrap(new PlusOneButtonImpl(ctx, size, annotation, url, "<< default account >>"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IObjectWrapper createForAccount(IObjectWrapper context, int size, int annotation, String url, String account) throws RemoteException {
|
||||
Context ctx = (Context) ObjectWrapper.unwrap(context);
|
||||
return ObjectWrapper.wrap(new PlusOneButtonImpl(ctx, size, annotation, url, account));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.google.android.gms.plus.plusone;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
public class PlusOneButtonImpl extends View {
|
||||
public PlusOneButtonImpl(Context context, int size, int annotation, String url, String account) {
|
||||
super(context);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.google.android.location.internal;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
import com.google.android.gms.common.internal.AbstractGmsServiceBroker;
|
||||
|
||||
public class GoogleLocationManagerService extends Service {
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return new Broker().asBinder();
|
||||
}
|
||||
|
||||
private class Broker extends AbstractGmsServiceBroker {
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue