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) {
|
public static void shuffleAllSongs(final Context context) {
|
||||||
ArrayList<Song> songs = SongLoader.getAllSongs(context);
|
ArrayList<Song> songs = SongLoader.getAllSongs(context);
|
||||||
MusicPlayerRemote.openQueue(songs, new Random().nextInt(songs.size()), true);
|
if (!songs.isEmpty()) {
|
||||||
forceSetShuffleMode(context, MusicService.SHUFFLE_MODE_SHUFFLE);
|
MusicPlayerRemote.openQueue(songs, new Random().nextInt(songs.size()), true);
|
||||||
|
forceSetShuffleMode(context, MusicService.SHUFFLE_MODE_SHUFFLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void playNext(Song song) {
|
public static void playNext(Song song) {
|
||||||
|
|
|
||||||
|
|
@ -290,27 +290,31 @@ public class MusicService extends Service implements MediaPlayer.OnPreparedListe
|
||||||
isPlayerPrepared = false;
|
isPlayerPrepared = false;
|
||||||
player.reset();
|
player.reset();
|
||||||
player.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK);
|
player.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK);
|
||||||
try {
|
if (position != -1) {
|
||||||
Uri trackUri = getCurrentPositionTrackUri();
|
try {
|
||||||
player.setDataSource(getApplicationContext(), trackUri);
|
Uri trackUri = getCurrentPositionTrackUri();
|
||||||
player.prepareAsync();
|
player.setDataSource(getApplicationContext(), trackUri);
|
||||||
} catch (Exception e) {
|
player.prepareAsync();
|
||||||
Log.e("MUSIC SERVICE", "Error setting data source", e);
|
} catch (Exception e) {
|
||||||
player.reset();
|
player.reset();
|
||||||
player = null;
|
player = null;
|
||||||
Toast.makeText(getApplicationContext(), getResources().getString(R.string.unplayable_file), Toast.LENGTH_SHORT).show();
|
|
||||||
notifyOnMusicRemoteEventListeners(MusicRemoteEvent.STOP);
|
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);
|
playingNotificationHelper.updatePlayState(false);
|
||||||
MusicPlayerWidget.updateWidgetsPlayState(this, 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);
|
notifyOnMusicRemoteEventListeners(MusicRemoteEvent.TRACK_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,8 +95,15 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
||||||
setContentView(getContentViewResId());
|
setContentView(getContentViewResId());
|
||||||
|
|
||||||
getIntentExtras();
|
getIntentExtras();
|
||||||
headerVariableSpace = getResources().getDimensionPixelSize(R.dimen.tagEditorHeaderVariableSpace);
|
|
||||||
songPaths = getSongPaths();
|
songPaths = getSongPaths();
|
||||||
|
if (songPaths.isEmpty()) {
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
headerVariableSpace = getResources().getDimensionPixelSize(R.dimen.tagEditorHeaderVariableSpace);
|
||||||
|
|
||||||
|
|
||||||
initViews();
|
initViews();
|
||||||
setUpViews();
|
setUpViews();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue