Added queue total time in playing screen
This commit is contained in:
parent
f0a648e8e8
commit
ae1af52bb6
4 changed files with 18 additions and 0 deletions
|
|
@ -239,6 +239,13 @@ public class MusicPlayerRemote {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getQueueDurationMillis(int position) {
|
||||||
|
if (musicService != null) {
|
||||||
|
return musicService.getQueueDurationMillis(position);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
public static int seekTo(int millis) {
|
public static int seekTo(int millis) {
|
||||||
if (musicService != null) {
|
if (musicService != null) {
|
||||||
return musicService.seek(millis);
|
return musicService.seek(millis);
|
||||||
|
|
|
||||||
|
|
@ -946,6 +946,13 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
||||||
return playback.duration();
|
return playback.duration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getQueueDurationMillis(int position) {
|
||||||
|
int ret=0;
|
||||||
|
for(int i=position+1;i<playingQueue.size();i++)
|
||||||
|
ret+=playingQueue.get(i).duration;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
public int seek(int millis) {
|
public int seek(int millis) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -198,6 +198,7 @@ public class CardPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
|
||||||
|
|
||||||
private void updateQueue() {
|
private void updateQueue() {
|
||||||
playingQueueAdapter.swapDataSet(MusicPlayerRemote.getPlayingQueue(), MusicPlayerRemote.getPosition());
|
playingQueueAdapter.swapDataSet(MusicPlayerRemote.getPlayingQueue(), MusicPlayerRemote.getPosition());
|
||||||
|
playerQueueSubHeader.setText(getResources().getString(R.string.up_next)+" • "+ MusicUtil.getReadableDurationString(MusicPlayerRemote.getQueueDurationMillis( MusicPlayerRemote.getPosition())));
|
||||||
if (slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
if (slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
||||||
resetToCurrentPosition();
|
resetToCurrentPosition();
|
||||||
}
|
}
|
||||||
|
|
@ -205,6 +206,7 @@ public class CardPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
|
||||||
|
|
||||||
private void updateQueuePosition() {
|
private void updateQueuePosition() {
|
||||||
playingQueueAdapter.setCurrent(MusicPlayerRemote.getPosition());
|
playingQueueAdapter.setCurrent(MusicPlayerRemote.getPosition());
|
||||||
|
playerQueueSubHeader.setText(getResources().getString(R.string.up_next)+" • "+ MusicUtil.getReadableDurationString(MusicPlayerRemote.getQueueDurationMillis( MusicPlayerRemote.getPosition())));
|
||||||
if (slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
if (slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
||||||
resetToCurrentPosition();
|
resetToCurrentPosition();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -194,6 +194,7 @@ public class FlatPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
|
||||||
|
|
||||||
private void updateQueue() {
|
private void updateQueue() {
|
||||||
playingQueueAdapter.swapDataSet(MusicPlayerRemote.getPlayingQueue(), MusicPlayerRemote.getPosition());
|
playingQueueAdapter.swapDataSet(MusicPlayerRemote.getPlayingQueue(), MusicPlayerRemote.getPosition());
|
||||||
|
playerQueueSubHeader.setText(getResources().getString(R.string.up_next)+" • "+ MusicUtil.getReadableDurationString(MusicPlayerRemote.getQueueDurationMillis( MusicPlayerRemote.getPosition())));
|
||||||
if (slidingUpPanelLayout == null || slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
if (slidingUpPanelLayout == null || slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
||||||
resetToCurrentPosition();
|
resetToCurrentPosition();
|
||||||
}
|
}
|
||||||
|
|
@ -201,6 +202,7 @@ public class FlatPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
|
||||||
|
|
||||||
private void updateQueuePosition() {
|
private void updateQueuePosition() {
|
||||||
playingQueueAdapter.setCurrent(MusicPlayerRemote.getPosition());
|
playingQueueAdapter.setCurrent(MusicPlayerRemote.getPosition());
|
||||||
|
playerQueueSubHeader.setText(getResources().getString(R.string.up_next)+" • "+ MusicUtil.getReadableDurationString(MusicPlayerRemote.getQueueDurationMillis( MusicPlayerRemote.getPosition())));
|
||||||
if (slidingUpPanelLayout == null || slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
if (slidingUpPanelLayout == null || slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
||||||
resetToCurrentPosition();
|
resetToCurrentPosition();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue