Add basic play-services-cast

This commit is contained in:
mar-v-in 2015-10-01 21:36:38 +02:00
parent 1df0066367
commit d8a5f3351f
9 changed files with 391 additions and 11 deletions

View File

@ -1,3 +1,19 @@
/*
* Copyright 2013-2015 microG Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Top-level build file where you can add configuration options common to all sub-projects/modules.
subprojects {
group = 'org.microg'

View File

@ -0,0 +1,40 @@
/*
* Copyright 2013-2015 microG Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
}
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
}
}
dependencies {
compile project(':play-services-base')
}

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2013-2015 microG Project Team
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.microg.gms.wearable">
<uses-sdk android:minSdkVersion="9" />
<application />
</manifest>

View File

@ -0,0 +1,153 @@
/*
* Copyright 2013-2015 microG Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.gms.cast;
import com.google.android.gms.common.api.Api;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.PendingResult;
import com.google.android.gms.common.api.Result;
import com.google.android.gms.common.api.Status;
import java.io.IOException;
public class Cast {
public static final Api<CastOptions> API = new Api<CastOptions>(null); // TODO
public static final Cast.CastApi CastApi = null; // TODO
public interface ApplicationConnectionResult extends Result {
ApplicationMetadata getApplicationMetadata();
String getApplicationStatus();
String getSessionId();
boolean getWasLaunched();
}
public interface CastApi {
int getActiveInputState(GoogleApiClient client);
ApplicationMetadata getApplicationMetadata(GoogleApiClient client);
String getApplicationStatus(GoogleApiClient client);
int getStandbyState(GoogleApiClient client);
double getVolume(GoogleApiClient client);
boolean isMute(GoogleApiClient client);
PendingResult<Cast.ApplicationConnectionResult> joinApplication(GoogleApiClient client);
PendingResult<Cast.ApplicationConnectionResult> joinApplication(GoogleApiClient client, String applicationId, String sessionId);
PendingResult<Cast.ApplicationConnectionResult> joinApplication(GoogleApiClient client, String applicationId);
PendingResult<Cast.ApplicationConnectionResult> launchApplication(GoogleApiClient client, String applicationId, LaunchOptions launchOptions);
PendingResult<Cast.ApplicationConnectionResult> launchApplication(GoogleApiClient client, String applicationId);
@Deprecated
PendingResult<Cast.ApplicationConnectionResult> launchApplication(GoogleApiClient client, String applicationId, boolean relaunchIfRunning);
PendingResult<Status> leaveApplication(GoogleApiClient client);
void removeMessageReceivedCallbacks(GoogleApiClient client, String namespace) throws IOException;
void requestStatus(GoogleApiClient client) throws IOException;
PendingResult<Status> sendMessage(GoogleApiClient client, String namespace, String message);
void setMessageReceivedCallbacks(GoogleApiClient client, String namespace, Cast.MessageReceivedCallback callbacks) throws IOException;
void setMute(GoogleApiClient client, boolean mute) throws IOException;
void setVolume(GoogleApiClient client, double volume) throws IOException;
PendingResult<Status> stopApplication(GoogleApiClient client);
PendingResult<Status> stopApplication(GoogleApiClient client, String sessionId);
}
public static class CastOptions implements Api.ApiOptions.HasOptions {
private final CastDevice castDevice;
private final Listener castListener;
private final boolean verboseLoggingEnabled;
public CastOptions(CastDevice castDevice, Listener castListener, boolean verboseLoggingEnabled) {
this.castDevice = castDevice;
this.castListener = castListener;
this.verboseLoggingEnabled = verboseLoggingEnabled;
}
@Deprecated
public static Builder builder(CastDevice castDevice, Listener castListener) {
return new Builder(castDevice, castListener);
}
public static class Builder {
private final CastDevice castDevice;
private final Listener castListener;
private boolean verboseLoggingEnabled;
public Builder(CastDevice castDevice, Listener castListener) {
this.castDevice = castDevice;
this.castListener = castListener;
}
public CastOptions build() {
return new CastOptions(castDevice, castListener, verboseLoggingEnabled);
}
public Builder setVerboseLoggingEnabled(boolean verboseLoggingEnabled) {
this.verboseLoggingEnabled = verboseLoggingEnabled;
return this;
}
}
}
public static class Listener {
public void onActiveInputStateChanged(int activeInputState) {
}
public void onApplicationDisconnected(int statusCode) {
}
public void onApplicationMetadataChanged(ApplicationMetadata applicationMetadata) {
}
public void onApplicationStatusChanged() {
}
public void onStandbyStateChanged(int standbyState) {
}
public void onVolumeChanged() {
}
}
public interface MessageReceivedCallback {
void onMessageReceived(CastDevice castDevice, String namespace, String message);
}
}

View File

@ -0,0 +1,64 @@
/*
* Copyright 2013-2015 microG Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.gms.cast;
import java.util.Collection;
import java.util.Locale;
public class CastMediaControlIntent {
public static final String ACTION_SYNC_STATUS = "com.google.android.gms.cast.ACTION_SYNC_STATUS";
@Deprecated
public static final String CATEGORY_CAST = "com.google.android.gms.cast.CATEGORY_CAST";
public static final String EXTRA_CAST_APPLICATION_ID = "com.google.android.gms.cast.EXTRA_CAST_APPLICATION_ID";
public static final String EXTRA_CAST_LANGUAGE_CODE = "com.google.android.gms.cast.EXTRA_CAST_LANGUAGE_CODE";
public static final String EXTRA_CAST_RELAUNCH_APPLICATION = "com.google.android.gms.cast.EXTRA_CAST_RELAUNCH_APPLICATION";
public static final String EXTRA_CAST_STOP_APPLICATION_WHEN_SESSION_ENDS = "com.google.android.gms.cast.EXTRA_CAST_STOP_APPLICATION_WHEN_SESSION_ENDS";
public static final String EXTRA_CUSTOM_DATA = "com.google.android.gms.cast.EXTRA_CUSTOM_DATA";
public static final String EXTRA_DEBUG_LOGGING_ENABLED = "com.google.android.gms.cast.EXTRA_DEBUG_LOGGING_ENABLED";
public static final String EXTRA_ERROR_CODE = "com.google.android.gms.cast.EXTRA_ERROR_CODE";
public static final String DEFAULT_MEDIA_RECEIVER_APPLICATION_ID = "CC1AD845";
public static final int ERROR_CODE_REQUEST_FAILED = 1;
public static final int ERROR_CODE_SESSION_START_FAILED = 2;
public static final int ERROR_CODE_TEMPORARILY_DISCONNECTED = 3;
public static String categoryForCast(String applicationId) {
return CATEGORY_CAST; // TODO
}
public static String categoryForCast(String applicationId, Collection<String> namespaces) {
return CATEGORY_CAST; // TODO
}
public static String categoryForCast(Collection<String> namespaces) {
return CATEGORY_CAST; // TODO
}
public static String categoryForRemotePlayback(String applicationId) {
return CATEGORY_CAST; // TODO
}
public static String categoryForRemotePlayback() {
return CATEGORY_CAST; // TODO
}
public static String languageTagForLocale(Locale locale) {
return CATEGORY_CAST; // TODO
}
}

View File

@ -0,0 +1,33 @@
/*
* Copyright 2013-2015 microG Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.gms.cast;
import android.annotation.TargetApi;
import android.app.Presentation;
import android.content.Context;
import android.view.Display;
@TargetApi(17)
public class CastPresentation extends Presentation {
public CastPresentation(Context outerContext, Display display) {
super(outerContext, display);
}
public CastPresentation(Context outerContext, Display display, int theme) {
super(outerContext, display, theme);
}
}

View File

@ -1,26 +1,43 @@
/*
* Copyright 2013-2015 microG Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.1'
classpath 'com.github.dcendents:android-maven-plugin:1.2'
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
}
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
dependencies {
compile project(':play-services-base')
compile project(':play-services-location')
compile project(':play-services-wearable')
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
compileSdkVersion 23
buildToolsVersion "23.0.1"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
}
}
dependencies {
compile project(':play-services-base')
compile project(':play-services-cast')
compile project(':play-services-location')
compile project(':play-services-wearable')
}

View File

@ -1,4 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2013-2015 microG Project Team
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.microg.gms">

View File

@ -1,8 +1,25 @@
/*
* Copyright 2013-2015 microG Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
include ':safe-parcel'
include ':play-services-api'
include ':play-services-base'
include ':play-services-cast'
include ':play-services-location'
include ':play-services-wearable'