Fixed some of the apps most common FCs according to its fabric.io statistics
This commit is contained in:
parent
6a6da75fd6
commit
5a25738993
3 changed files with 34 additions and 21 deletions
|
|
@ -231,8 +231,10 @@ public class MusicPlayerRemote {
|
|||
|
||||
public static void shuffleAllSongs(final Context context) {
|
||||
ArrayList<Song> songs = SongLoader.getAllSongs(context);
|
||||
MusicPlayerRemote.openQueue(songs, new Random().nextInt(songs.size()), true);
|
||||
forceSetShuffleMode(context, MusicService.SHUFFLE_MODE_SHUFFLE);
|
||||
if (!songs.isEmpty()) {
|
||||
MusicPlayerRemote.openQueue(songs, new Random().nextInt(songs.size()), true);
|
||||
forceSetShuffleMode(context, MusicService.SHUFFLE_MODE_SHUFFLE);
|
||||
}
|
||||
}
|
||||
|
||||
public static void playNext(Song song) {
|
||||
|
|
|
|||
|
|
@ -290,27 +290,31 @@ public class MusicService extends Service implements MediaPlayer.OnPreparedListe
|
|||
isPlayerPrepared = false;
|
||||
player.reset();
|
||||
player.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK);
|
||||
try {
|
||||
Uri trackUri = getCurrentPositionTrackUri();
|
||||
player.setDataSource(getApplicationContext(), trackUri);
|
||||
player.prepareAsync();
|
||||
} catch (Exception e) {
|
||||
Log.e("MUSIC SERVICE", "Error setting data source", e);
|
||||
player.reset();
|
||||
player = null;
|
||||
Toast.makeText(getApplicationContext(), getResources().getString(R.string.unplayable_file), Toast.LENGTH_SHORT).show();
|
||||
notifyOnMusicRemoteEventListeners(MusicRemoteEvent.STOP);
|
||||
if (position != -1) {
|
||||
try {
|
||||
Uri trackUri = getCurrentPositionTrackUri();
|
||||
player.setDataSource(getApplicationContext(), trackUri);
|
||||
player.prepareAsync();
|
||||
} catch (Exception e) {
|
||||
player.reset();
|
||||
player = null;
|
||||
|
||||
notifyOnMusicRemoteEventListeners(MusicRemoteEvent.STOP);
|
||||
playingNotificationHelper.updatePlayState(false);
|
||||
MusicPlayerWidget.updateWidgetsPlayState(this, false);
|
||||
remoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED);
|
||||
|
||||
Toast.makeText(getApplicationContext(), getResources().getString(R.string.unplayable_file), Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
currentSongId = playingQueue.get(getPosition()).id;
|
||||
updateNotification();
|
||||
updateWidgets();
|
||||
updateRemoteControlClient();
|
||||
} else {
|
||||
playingNotificationHelper.updatePlayState(false);
|
||||
MusicPlayerWidget.updateWidgetsPlayState(this, false);
|
||||
remoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED);
|
||||
updateNotification();
|
||||
updateRemoteControlClient();
|
||||
return;
|
||||
}
|
||||
currentSongId = playingQueue.get(getPosition()).id;
|
||||
updateNotification();
|
||||
updateWidgets();
|
||||
updateRemoteControlClient();
|
||||
}
|
||||
notifyOnMusicRemoteEventListeners(MusicRemoteEvent.TRACK_CHANGED);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,8 +95,15 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
|||
setContentView(getContentViewResId());
|
||||
|
||||
getIntentExtras();
|
||||
headerVariableSpace = getResources().getDimensionPixelSize(R.dimen.tagEditorHeaderVariableSpace);
|
||||
|
||||
songPaths = getSongPaths();
|
||||
if (songPaths.isEmpty()) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
headerVariableSpace = getResources().getDimensionPixelSize(R.dimen.tagEditorHeaderVariableSpace);
|
||||
|
||||
|
||||
initViews();
|
||||
setUpViews();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue