use of android.support.v4.media.MediaBrowserCompat in project android-UniversalMusicPlayer by googlesamples.
the class TvBrowseActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LogHelper.d(TAG, "Activity onCreate");
setContentView(R.layout.tv_activity_player);
mMediaBrowser = new MediaBrowserCompat(this, new ComponentName(this, MusicService.class), mConnectionCallback, null);
}
use of android.support.v4.media.MediaBrowserCompat in project android-UniversalMusicPlayer by googlesamples.
the class TvVerticalGridActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tv_vertical_grid);
mMediaId = getIntent().getStringExtra(TvBrowseActivity.SAVED_MEDIA_ID);
mTitle = getIntent().getStringExtra(TvBrowseActivity.BROWSE_TITLE);
getWindow().setBackgroundDrawableResource(R.drawable.bg);
mMediaBrowser = new MediaBrowserCompat(this, new ComponentName(this, MusicService.class), mConnectionCallback, null);
}
use of android.support.v4.media.MediaBrowserCompat in project android-UniversalMusicPlayer by googlesamples.
the class TvVerticalGridFragment method onStop.
@Override
public void onStop() {
super.onStop();
MediaBrowserCompat mediaBrowser = mMediaFragmentListener.getMediaBrowser();
if (mediaBrowser != null && mediaBrowser.isConnected() && mMediaId != null) {
mediaBrowser.unsubscribe(mMediaId);
}
}
use of android.support.v4.media.MediaBrowserCompat in project android-UniversalMusicPlayer by googlesamples.
the class TvVerticalGridFragment method setMediaId.
protected void setMediaId(String mediaId) {
LogHelper.d(TAG, "setMediaId: ", mediaId);
if (TextUtils.equals(mMediaId, mediaId)) {
return;
}
MediaBrowserCompat 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);
}
use of android.support.v4.media.MediaBrowserCompat in project android-UniversalMusicPlayer by googlesamples.
the class MediaBrowserFragment method onStart.
@Override
public void onStart() {
super.onStart();
// fetch browsing information to fill the listview:
MediaBrowserCompat mediaBrowser = mMediaFragmentListener.getMediaBrowser();
LogHelper.d(TAG, "fragment.onStart, mediaId=", mMediaId, " onConnected=" + mediaBrowser.isConnected());
if (mediaBrowser.isConnected()) {
onConnected();
}
// Registers BroadcastReceiver to track network connection changes.
this.getActivity().registerReceiver(mConnectivityChangeReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
}
Aggregations