@Override public void onResume() { super.onResume(); mActivity .getApplicationContext() .getContentResolver() .registerContentObserver( android.provider.Settings.System.CONTENT_URI, true, mSettingsContentObserver); restorePlayer(); updateSoundSystemInfo(); }
@Override public void onPause() { playbackInfo.setStatus(PlaybackStatus.PAUSED); playbackInfo.setTime(player.getCurrentPosition()); player.release(); player = null; mActivity.getSmartHouseController().updatePlaybackInfo(playbackInfo); mActivity .getApplicationContext() .getContentResolver() .unregisterContentObserver(mSettingsContentObserver); super.onPause(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mActivity.setVolumeControlStream(AudioManager.STREAM_MUSIC); mAudioManager = (AudioManager) mActivity.getSystemService(Context.AUDIO_SERVICE); mSettingsContentObserver = new SettingsContentObserver(soundSystemHandler); mSongComparator = new SongComparator(); initPlayList(); playbackInfo.setTimeSetOnDevice(true); playbackInfo.setVolumeSetOnDevice(false); playbackInfo.setMaxVolume(mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC)); playbackInfo.setVolume(mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC)); }
@Override public void onDestroy() { super.onDestroy(); }