Android Open Source - ChromeCastAgainstHumanity Cast C A H Application






From Project

Back to project page ChromeCastAgainstHumanity.

License

The source code is released under:

GNU General Public License

If you think the Android project ChromeCastAgainstHumanity listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.meadowhawk.cah;
//from w ww  .  j av a2  s  . c  o m
import android.app.Application;

import com.google.cast.CastContext;
import com.google.cast.CastDevice;
import com.google.cast.Logger;

/**
 * An application that provides getter and setter methods for passing Cast-related objects between 
 * multiple activities, as well as a way to access its currently running instance.
 */
public class CastCAHApplication extends Application {
    private static final String TAG = CastCAHApplication.class.getSimpleName();

    private static Logger sLog = new Logger(TAG);
    private static CastCAHApplication singleton;
    private CastContext mCastContext;
    private CastDevice mDevice;

    /**
     * Initializes the CastContext associated with this application's context, upon application
     * creation.
     */
    @Override
    public final void onCreate() {
        super.onCreate();
        singleton = this;

        try {
            mCastContext = new CastContext(getApplicationContext());
        } catch (IllegalArgumentException e) {
            sLog.e(e, "Unable to create CastContext");
        }
    }

    /**
     * Returns the instance of this class that is currently running.
     */
    public static CastCAHApplication getInstance() {
        return singleton;
    }

    /**
     * Returns the CastContext associated with this application's context.
     */
    public CastContext getCastContext() {
        return mCastContext;
    }

    /**
     * Returns the currently selected device, or null if no device is selected.
     */
    public CastDevice getDevice() {
        return mDevice;
    }

    /**
     * Sets the currently selected device.
     */
    public void setDevice(CastDevice device) {
        mDevice = device;
    }
}




Java Source Code List

com.meadowhawk.cah.CardSlidePageFragment.java
com.meadowhawk.cah.CardSlidePagerActivity.java
com.meadowhawk.cah.CastCAHApplication.java
com.meadowhawk.cah.DeviceSelectionDialog.java
com.meadowhawk.cah.GameActivity.java
com.meadowhawk.cah.GameMessageStream.java
com.meadowhawk.cah.MainActivity.java
com.meadowhawk.cah.model.Card.java
com.meadowhawk.cah.ui.OnSwipeTouchListener.java
com.meadowhawk.cah.widget.AutoResizeTextView.java
com.meadowhawk.cah.widget.CardDisplayView.java