/* Handles intent to show player from notification or from shortcut */ private void handleShowPlayer(Intent intent) { // get station from intent Station station = null; if (intent.hasExtra(TransistorKeys.EXTRA_STATION)) { // get station from notification station = intent.getParcelableExtra(TransistorKeys.EXTRA_STATION); } else if (intent.hasExtra(TransistorKeys.EXTRA_STREAM_URI)) { // get Uri of station from home screen shortcut station = mCollectionAdapter.findStation( Uri.parse(intent.getStringExtra(TransistorKeys.EXTRA_STREAM_URI))); } else if (intent.hasExtra(TransistorKeys.EXTRA_LAST_STATION) && intent.getBooleanExtra(TransistorKeys.EXTRA_LAST_STATION, false)) { // try to get last station loadAppState(mActivity); if (mStationIDLast > -1 && mStationIDLast < mCollectionAdapter.getItemCount()) { station = mCollectionAdapter.getStation(mStationIDLast); } } if (station == null) { Toast.makeText(mActivity, getString(R.string.toastalert_station_not_found), Toast.LENGTH_LONG) .show(); } // get playback action from intent boolean startPlayback; if (intent.hasExtra(TransistorKeys.EXTRA_PLAYBACK_STATE)) { startPlayback = intent.getBooleanExtra(TransistorKeys.EXTRA_PLAYBACK_STATE, false); } else { startPlayback = false; } // prepare arguments or intent if (mTwoPane && station != null) { mStationIDSelected = mCollectionAdapter.getStationID(station); mCollectionAdapter.setStationIDSelected( mStationIDSelected, station.getPlaybackState(), startPlayback); } else if (station != null) { // start player activity - on phone Intent playerIntent = new Intent(mActivity, PlayerActivity.class); playerIntent.setAction(TransistorKeys.ACTION_SHOW_PLAYER); playerIntent.putExtra(TransistorKeys.EXTRA_STATION, station); playerIntent.putExtra(TransistorKeys.EXTRA_PLAYBACK_STATE, startPlayback); startActivity(playerIntent); } }