Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8a5f335 authored by Marvin W.'s avatar Marvin W. 🐿️
Browse files

Add basic play-services-cast

parent 1df00663
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
/*
 * 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'
+40 −0
Original line number Diff line number Diff line
/*
 * 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')
}
+24 −0
Original line number Diff line number Diff line
<?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>
+153 −0
Original line number Diff line number Diff line
/*
 * 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);
    }
}
+64 −0
Original line number Diff line number Diff line
/*
 * 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
    }
}
Loading