Lots of progress with dynamic theming, the nav drawer now uses a RecyclerView, AboutDeveloperDialogHelper is now a DialogFragment, RTL support (to suppress Lint warnings), other various small fixes, cleaned up and formatted lot of code (and removed un-used resources), R.string.ok > android.R.string.ok, R.string.cancel > android.R.string.cancel, switched dialog helpers to DialogFragments.

This commit is contained in:
Aidan Follestad 2015-04-16 16:47:02 -05:00
commit 7ce86afd74
265 changed files with 2853 additions and 2292 deletions

View file

@ -38,7 +38,6 @@ import com.squareup.picasso.Target;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class MusicService extends Service implements MediaPlayer.OnPreparedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnCompletionListener, AudioManager.OnAudioFocusChangeListener {
public static final String ACTION_TOGGLE_PLAYBACK = "com.kabouzeid.gramophone.action.TOGGLE_PLAYBACK";
@ -66,8 +65,8 @@ public class MusicService extends Service implements MediaPlayer.OnPreparedListe
}
};
private MediaPlayer player;
private List<Song> playingQueue;
private List<Song> originalPlayingQueue;
private ArrayList<Song> playingQueue;
private ArrayList<Song> originalPlayingQueue;
private int currentSongId = -1;
private int position = -1;
private int shuffleMode;
@ -355,7 +354,7 @@ public class MusicService extends Service implements MediaPlayer.OnPreparedListe
.into(remoteAlbumArt);
}
private Target remoteAlbumArt = new Target() {
private final Target remoteAlbumArt = new Target() {
@Override
public void onBitmapLoaded(final Bitmap bitmap, Picasso.LoadedFrom from) {
updateRemoteControlClientBitmap(bitmap.copy(bitmap.getConfig(), true));
@ -432,7 +431,7 @@ public class MusicService extends Service implements MediaPlayer.OnPreparedListe
return getPosition() == getPlayingQueue().size() - 1;
}
public List<Song> getPlayingQueue() {
public ArrayList<Song> getPlayingQueue() {
return playingQueue;
}
@ -475,7 +474,7 @@ public class MusicService extends Service implements MediaPlayer.OnPreparedListe
savePosition();
}
public void openQueue(final List<Song> playingQueue, final int startPosition, final boolean startPlaying) {
public void openQueue(final ArrayList<Song> playingQueue, final int startPosition, final boolean startPlaying) {
if (playingQueue != null && !playingQueue.isEmpty() && startPosition >= 0 && startPosition < playingQueue.size()) {
originalPlayingQueue = playingQueue;
this.playingQueue = new ArrayList<>(originalPlayingQueue);
@ -514,7 +513,7 @@ public class MusicService extends Service implements MediaPlayer.OnPreparedListe
}
}
public void restorePreviousState(final List<Song> originalPlayingQueue, final List<Song> playingQueue, int position) {
public void restorePreviousState(final ArrayList<Song> originalPlayingQueue, final ArrayList<Song> playingQueue, int position) {
this.originalPlayingQueue = originalPlayingQueue;
this.playingQueue = playingQueue;
this.position = position;
@ -772,6 +771,8 @@ public class MusicService extends Service implements MediaPlayer.OnPreparedListe
}
public int getAudioSessionId() {
if (player == null)
return AudioEffect.ERROR_BAD_VALUE;
return player.getAudioSessionId();
}