mirror of
https://github.com/moparisthebest/android_external_GmsApi
synced 2024-11-27 11:02:18 -05:00
Add api stuff
This commit is contained in:
parent
95fabdd877
commit
c1f66a6b3b
@ -15,7 +15,7 @@ dependencies {
|
||||
|
||||
android {
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion "21.0.2"
|
||||
buildToolsVersion "21.1.2"
|
||||
lintOptions.abortOnError false
|
||||
|
||||
sourceSets {
|
||||
|
8
src/com/google/android/gms/common/api/Result.java
Normal file
8
src/com/google/android/gms/common/api/Result.java
Normal file
@ -0,0 +1,8 @@
|
||||
package com.google.android.gms.common.api;
|
||||
|
||||
/**
|
||||
* Represents the final result of invoking an API method in Google Play Services.
|
||||
*/
|
||||
public interface Result {
|
||||
public Status getStatus();
|
||||
}
|
79
src/com/google/android/gms/common/api/Status.java
Normal file
79
src/com/google/android/gms/common/api/Status.java
Normal file
@ -0,0 +1,79 @@
|
||||
package com.google.android.gms.common.api;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
|
||||
/**
|
||||
* Represents the results of work.
|
||||
* <p/>
|
||||
* TODO: Docs
|
||||
*/
|
||||
public final class Status extends AutoSafeParcelable implements Result {
|
||||
private static final int STATUS_CODE_INTERRUPTED = 14;
|
||||
private static final int STATUS_CODE_CANCELED = 16;
|
||||
|
||||
public static final Status INTERRUPTED = new Status(STATUS_CODE_INTERRUPTED);
|
||||
public static final Status CANCELED = new Status(STATUS_CODE_CANCELED);
|
||||
|
||||
private final int versionCode;
|
||||
private final int statusCode;
|
||||
private final String statusMessage;
|
||||
private final PendingIntent resolution;
|
||||
|
||||
private Status() {
|
||||
versionCode = 1;
|
||||
statusCode = 0;
|
||||
statusMessage = null;
|
||||
resolution = null;
|
||||
}
|
||||
|
||||
public Status(int statusCode) {
|
||||
this(statusCode, null);
|
||||
}
|
||||
|
||||
public Status(int statusCode, String statusMessage) {
|
||||
this(statusCode, statusMessage, null);
|
||||
}
|
||||
|
||||
public Status(int statusCode, String statusMessage, PendingIntent resolution) {
|
||||
this.versionCode = 1;
|
||||
this.statusCode = statusCode;
|
||||
this.statusMessage = statusMessage;
|
||||
this.resolution = resolution;
|
||||
}
|
||||
|
||||
public PendingIntent getResolution() {
|
||||
return resolution;
|
||||
}
|
||||
|
||||
public int getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
public String getStatusMessage() {
|
||||
return statusMessage;
|
||||
}
|
||||
|
||||
public boolean hasResolution() {
|
||||
return resolution != null;
|
||||
}
|
||||
|
||||
public boolean isCanceled() {
|
||||
return statusCode == STATUS_CODE_CANCELED;
|
||||
}
|
||||
|
||||
public boolean isInterrupted() {
|
||||
return statusCode == STATUS_CODE_INTERRUPTED;
|
||||
}
|
||||
|
||||
public boolean isSuccess() {
|
||||
return statusCode <= 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Status getStatus() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public static final Creator<Status> CREATOR = new AutoCreator<>(Status.class);
|
||||
}
|
@ -9,6 +9,7 @@ public class Constants {
|
||||
public static final String ACTION_GMS_LOCATION_MANAGER_SERVICE_START = "com.google.android.location.internal.GoogleLocationManagerService.START";
|
||||
public static final String KEY_MOCK_LOCATION = "mockLocation";
|
||||
public static final String DEFAULT_ACCOUNT = "<<default account>>";
|
||||
public static final String GMS_PACKAGE_NAME = "com.google.android.gms";
|
||||
|
||||
/**
|
||||
* No base map tiles.
|
||||
|
Loading…
Reference in New Issue
Block a user