// Path: app/src/main/java/com/sregg/android/tv/spotifyPlayer/events/AbsPlayingEvent.java
// public class AbsPlayingEvent {
//     private final ContentState mContentState;
// 
//     public AbsPlayingEvent(ContentState contentState) {
//         mContentState = contentState;
//     }
// 
//     public ContentState getPlayingState() {
//         return mContentState;
//     }
// }
// 
// Path: app/src/main/java/com/sregg/android/tv/spotifyPlayer/events/ContentState.java
// public class ContentState {
//     private final String mCurrentObjectUri;
//     private final List<TrackSimple> mTracksQueue;
//     private String mCurrentTrackUri;
//     private List<String> mTrackUrisQueue;
//     private TrackSimple mCurrentTrack;
// 
//     public ContentState(String currentObjectUri, String currentTrackUri, List<String> trackUrisQueue, List<TrackSimple> tracksQueue) {
//         mCurrentObjectUri = currentObjectUri;
//         mCurrentTrackUri = currentTrackUri;
//         mTrackUrisQueue = trackUrisQueue;
//         mTracksQueue = tracksQueue;
//     }
// 
//     /**
//      * @return the currently playing object (can be a playlist, an album or a single track)
//      */
//     public String getCurrentObjectUri() {
//         return mCurrentObjectUri;
//     }
// 
//     public void setCurrentTrackUri(String currentTrackUri) {
//         mCurrentTrackUri = currentTrackUri;
//     }
// 
//     public boolean isCurrentObject(String objectUri) {
//         return mCurrentObjectUri.equals(objectUri);
//     }
// 
//     public boolean isCurrentTrack(String trackUri) {
//         return mCurrentTrackUri.equals(trackUri);
//     }
// 
//     public List<String> getTrackUrisQueue() {
//         return mTrackUrisQueue;
//     }
// 
//     public void setCurrentTrack(TrackSimple currentTrack) {
//         mCurrentTrack = currentTrack;
//     }
// 
//     public TrackSimple getCurrentTrack() {
//         return mCurrentTrack;
//     }
// 
//     public List<TrackSimple> getTracksQueue() {
//         return mTracksQueue;
//     }
// }
// 
// Path: app/src/main/java/com/sregg/android/tv/spotifyPlayer/events/OnPause.java
// public class OnPause extends AbsPlayingEvent {
// 
//     public OnPause(ContentState contentState) {
//         super(contentState);
//     }
// }
// 
// Path: app/src/main/java/com/sregg/android/tv/spotifyPlayer/events/OnPlay.java
// public class OnPlay extends AbsPlayingEvent {
//     public OnPlay(ContentState contentState) {
//         super(contentState);
//     }
// }
// 
// Path: app/src/main/java/com/sregg/android/tv/spotifyPlayer/events/OnTrackChanged.java
// public class OnTrackChanged extends AbsPlayingEvent {
//     public OnTrackChanged(ContentState contentState) {
//         super(contentState);
//     }
// }


import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.support.annotation.ColorInt;
import android.support.v17.leanback.widget.BaseCardView;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.squareup.otto.Subscribe;
import com.sregg.android.tv.spotifyPlayer.BusProvider;
import com.sregg.android.tv.spotifyPlayer.R;
import com.sregg.android.tv.spotifyPlayer.events.AbsPlayingEvent;
import com.sregg.android.tv.spotifyPlayer.events.ContentState;
import com.sregg.android.tv.spotifyPlayer.events.OnPause;
import com.sregg.android.tv.spotifyPlayer.events.OnPlay;
import com.sregg.android.tv.spotifyPlayer.events.OnTrackChanged;
import com.sregg.android.tv.spotifyPlayer.utils.Utils;
import kaaes.spotify.webapi.android.models.TrackSimple;
    @Override
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        mAttachedToWindow = true;
        if (mImageView.getAlpha() == 0) fadeIn();
        BusProvider.getInstance().register(this);
    }

    @Override
    protected void onDetachedFromWindow() {
        mAttachedToWindow = false;
        mImageView.animate().cancel();
        mImageView.setAlpha(1f);
        BusProvider.unregister(this);
        super.onDetachedFromWindow();
    }

    public void setItem(Object item) {
        mItem = item;
        mUri = Utils.getUriFromSpotiyObject(item);
    }

    @SuppressWarnings("unused")
    @Subscribe
    public void onTrackChanged(OnTrackChanged onTrackChanged) {
        initNowPlaying(isSelf(onTrackChanged));
    }

    @SuppressWarnings("unused")
    @Subscribe
// Path: app/src/main/java/com/sregg/android/tv/spotifyPlayer/events/AbsPlayingEvent.java
// public class AbsPlayingEvent {
//     private final ContentState mContentState;
// 
//     public AbsPlayingEvent(ContentState contentState) {
//         mContentState = contentState;
//     }
// 
//     public ContentState getPlayingState() {
//         return mContentState;
//     }
// }
// 
// Path: app/src/main/java/com/sregg/android/tv/spotifyPlayer/events/ContentState.java
// public class ContentState {
//     private final String mCurrentObjectUri;
//     private final List<TrackSimple> mTracksQueue;
//     private String mCurrentTrackUri;
//     private List<String> mTrackUrisQueue;
//     private TrackSimple mCurrentTrack;
// 
//     public ContentState(String currentObjectUri, String currentTrackUri, List<String> trackUrisQueue, List<TrackSimple> tracksQueue) {
//         mCurrentObjectUri = currentObjectUri;
//         mCurrentTrackUri = currentTrackUri;
//         mTrackUrisQueue = trackUrisQueue;
//         mTracksQueue = tracksQueue;
//     }
// 
//     /**
//      * @return the currently playing object (can be a playlist, an album or a single track)
//      */
//     public String getCurrentObjectUri() {
//         return mCurrentObjectUri;
//     }
// 
//     public void setCurrentTrackUri(String currentTrackUri) {
//         mCurrentTrackUri = currentTrackUri;
//     }
// 
//     public boolean isCurrentObject(String objectUri) {
//         return mCurrentObjectUri.equals(objectUri);
//     }
// 
//     public boolean isCurrentTrack(String trackUri) {
//         return mCurrentTrackUri.equals(trackUri);
//     }
// 
//     public List<String> getTrackUrisQueue() {
//         return mTrackUrisQueue;
//     }
// 
//     public void setCurrentTrack(TrackSimple currentTrack) {
//         mCurrentTrack = currentTrack;
//     }
// 
//     public TrackSimple getCurrentTrack() {
//         return mCurrentTrack;
//     }
// 
//     public List<TrackSimple> getTracksQueue() {
//         return mTracksQueue;
//     }
// }
// 
// Path: app/src/main/java/com/sregg/android/tv/spotifyPlayer/events/OnPause.java
// public class OnPause extends AbsPlayingEvent {
// 
//     public OnPause(ContentState contentState) {
//         super(contentState);
//     }
// }
// 
// Path: app/src/main/java/com/sregg/android/tv/spotifyPlayer/events/OnPlay.java
// public class OnPlay extends AbsPlayingEvent {
//     public OnPlay(ContentState contentState) {
//         super(contentState);
//     }
// }
// 
// Path: app/src/main/java/com/sregg/android/tv/spotifyPlayer/events/OnTrackChanged.java
// public class OnTrackChanged extends AbsPlayingEvent {
//     public OnTrackChanged(ContentState contentState) {
//         super(contentState);
//     }
// }


// Path: app/src/main/java/com/sregg/android/tv/spotifyPlayer/views/SpotifyCardView.java
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.support.annotation.ColorInt;
import android.support.v17.leanback.widget.BaseCardView;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.squareup.otto.Subscribe;
import com.sregg.android.tv.spotifyPlayer.BusProvider;
import com.sregg.android.tv.spotifyPlayer.R;
import com.sregg.android.tv.spotifyPlayer.events.AbsPlayingEvent;
import com.sregg.android.tv.spotifyPlayer.events.ContentState;
import com.sregg.android.tv.spotifyPlayer.events.OnPause;
import com.sregg.android.tv.spotifyPlayer.events.OnPlay;
import com.sregg.android.tv.spotifyPlayer.events.OnTrackChanged;
import com.sregg.android.tv.spotifyPlayer.utils.Utils;
import kaaes.spotify.webapi.android.models.TrackSimple;

    @Override
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        mAttachedToWindow = true;
        if (mImageView.getAlpha() == 0) fadeIn();
        BusProvider.getInstance().register(this);
    }

    @Override
    protected void onDetachedFromWindow() {
        mAttachedToWindow = false;
        mImageView.animate().cancel();
        mImageView.setAlpha(1f);
        BusProvider.unregister(this);
        super.onDetachedFromWindow();
    }

    public void setItem(Object item) {
        mItem = item;
        mUri = Utils.getUriFromSpotiyObject(item);
    }

    @SuppressWarnings("unused")
    @Subscribe
    public void onTrackChanged(OnTrackChanged onTrackChanged) {
        initNowPlaying(isSelf(onTrackChanged));
    }

    @SuppressWarnings("unused")
    @Subscribe
    public void onPlay(OnPlay onPlay) {