Added proper menu for current song. Also some small code clean ups.
This commit is contained in:
parent
dc14e62df5
commit
49d6ef97a3
3 changed files with 29 additions and 20 deletions
|
|
@ -6,7 +6,6 @@ import android.content.Context;
|
|||
import android.content.ContextWrapper;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.media.audiofx.AudioEffect;
|
||||
import android.os.IBinder;
|
||||
import android.provider.MediaStore;
|
||||
import android.support.annotation.NonNull;
|
||||
|
|
@ -331,7 +330,7 @@ public class MusicPlayerRemote {
|
|||
}
|
||||
|
||||
public static boolean removeFromQueue(int position) {
|
||||
if (musicService != null) {
|
||||
if (musicService != null && position >= 0 && position < getPlayingQueue().size()) {
|
||||
musicService.removeSong(position);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -339,7 +338,7 @@ public class MusicPlayerRemote {
|
|||
}
|
||||
|
||||
public static boolean moveSong(int from, int to) {
|
||||
if (musicService != null) {
|
||||
if (musicService != null && from >= 0 && to >= 0 && from < getPlayingQueue().size() && to < getPlayingQueue().size()) {
|
||||
musicService.moveSong(from, to);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -350,7 +349,7 @@ public class MusicPlayerRemote {
|
|||
if (musicService != null) {
|
||||
return musicService.getAudioSessionId();
|
||||
}
|
||||
return AudioEffect.ERROR_NO_INIT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static void playFile(String path) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import com.kabouzeid.gramophone.util.NavigationUtil;
|
|||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class SongMenuHelper {
|
||||
public static int MENU_RES = R.menu.menu_item_song;
|
||||
public static final int MENU_RES = R.menu.menu_item_song;
|
||||
|
||||
public static boolean handleMenuClick(@NonNull AppCompatActivity activity, @NonNull Song song, @NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue