Example usage for android.media.browse MediaBrowser unsubscribe

List of usage examples for android.media.browse MediaBrowser unsubscribe

Introduction

In this page you can find the example usage for android.media.browse MediaBrowser unsubscribe.

Prototype

public void unsubscribe(@NonNull String parentId) 

Source Link

Document

Unsubscribes for changes to the children of the specified media id.

Usage

From source file:com.orangesoft.jook.ui.tv.TvVerticalGridFragment.java

protected void setMediaId(String mediaId) {
    Log.d(TAG, "setMediaId: " + mediaId);
    if (TextUtils.equals(this.mediaId, mediaId))
        return;//w  w  w  .  j  av a  2s  .c  o  m
    MediaBrowser mediaBrowser = mediaFragmentListener.getMediaBrowser();

    if (this.mediaId != null)
        mediaBrowser.unsubscribe(mediaId);
    if (null == mediaId)
        mediaId = mediaBrowser.getRoot();
    this.mediaId = mediaId;
    mediaBrowser.subscribe(this.mediaId, subscriptionCallback);
}

From source file:com.orangesoft.jook.ui.tv.TvVerticalGridFragment.java

@Override
public void onStop() {
    super.onStop();
    MediaBrowser mediaBrowser = mediaFragmentListener.getMediaBrowser();
    if (mediaBrowser != null && mediaBrowser.isConnected() && mediaId != null)
        mediaBrowser.unsubscribe(mediaId);
}

From source file:com.example.android.spotifystreamer.ui.tv.TvVerticalGridFragment.java

@Override
public void onStop() {
    super.onStop();
    MediaBrowser mediaBrowser = mMediaFragmentListener.getMediaBrowser();
    if (mediaBrowser != null && mediaBrowser.isConnected() && mMediaId != null) {
        mediaBrowser.unsubscribe(mMediaId);
    }/*w w  w.  ja  va 2s  . co m*/
}

From source file:com.example.android.spotifystreamer.ui.tv.TvVerticalGridFragment.java

protected void setMediaId(String mediaId) {
    LogHelper.d(TAG, "setMediaId: ", mediaId);
    if (TextUtils.equals(mMediaId, mediaId)) {
        return;/*from  w  w w .  java  2 s  .  c o m*/
    }
    MediaBrowser mediaBrowser = mMediaFragmentListener.getMediaBrowser();

    // First, unsubscribe from old mediaId:
    if (mMediaId != null) {
        mediaBrowser.unsubscribe(mMediaId);
    }
    if (mediaId == null) {
        mediaId = mediaBrowser.getRoot();
    }
    mMediaId = mediaId;
    mediaBrowser.subscribe(mMediaId, mSubscriptionCallback);
}

From source file:com.misterpereira.android.kiteplayer.ui.MediaBrowserFragment.java

@Override
public void onStop() {
    super.onStop();
    MediaBrowser mediaBrowser = mMediaFragmentListener.getMediaBrowser();
    if (mediaBrowser != null && mediaBrowser.isConnected() && mMediaId != null) {
        mediaBrowser.unsubscribe(mMediaId);
    }// w  w  w.  j  a v a2s.  co m
    if (getActivity().getMediaController() != null) {
        getActivity().getMediaController().unregisterCallback(mMediaControllerCallback);
    }
    this.getActivity().unregisterReceiver(mConnectivityChangeReceiver);
}